|
| 1 | +--- |
| 2 | + |
| 3 | +# Arduino Sensor Serial Reader |
| 4 | + |
| 5 | +A fun and simple project that allows you to use an Arduino to read sensor data from selected pins and send the results over the serial connection. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +To get started, you’ll need the following hardware: |
| 10 | + |
| 11 | +- **Arduino Nano** |
| 12 | +- **LDR** (Light Dependent Resistor, 2-pin model) |
| 13 | +- **Resistor** (10kΩ, preferred) |
| 14 | +- **Thermistor** (LM35 model for temperature) |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +### Circuit Assembly |
| 19 | + |
| 20 | +Here’s how to set up the circuitry: |
| 21 | + |
| 22 | +- LM35 (Temperature Sensor) |
| 23 | + - **VCC**: Connect to **5V** on the Arduino Nano. |
| 24 | + - **GND**: Connect to **GND** on the Arduino Nano. |
| 25 | + - **Output (Analog Signal)**: Connect to **A0** on the Arduino Nano. |
| 26 | +- LDR (Light Dependent Resistor) |
| 27 | + - One leg of the LDR: Connect to **A1** on the Arduino Nano. |
| 28 | + - The other leg of the LDR: Connect to **5V** on the Arduino Nano through a **10kΩ pull-down resistor** to **GND**. This configuration ensures the LDR provides a readable voltage level at **A1**. |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +### Receiver Side |
| 33 | + |
| 34 | +The Arduino code sends data over the serial connection every second (note: not the most precise, but functional). The communication uses a **BAUD RATE** of **115200**. |
| 35 | + |
| 36 | +> [!Important] |
| 37 | +> Ensure you're familiar with uploading code to the Arduino Nano using the Arduino IDE. If you face issues during upload, please note: |
| 38 | +> |
| 39 | +> - When using a **CH341** chip for serial communication, you must upload the code with the **Old Bootloader**. |
| 40 | +> - The driver version must be **3.7.2022.1**. You can download the correct version from [this link](https://cdn.sparkfun.com/assets/learn_tutorials/8/4/4/CH341SER.EXE). |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +Once uploaded, the Arduino Nano will send a string containing two float values over the serial connection. The first value represents the temperature from the LM35, and the second is the reading from the LDR. The data is in a **JSON-like** format, structured as follows: |
| 45 | + `[int, float]` where the `int` is temperature (In Celsius) and `float` is LDR |
| 46 | + |
| 47 | +You can easily parse this string into an array for further use in your application. |
| 48 | + |
| 49 | +------ |
| 50 | + |
0 commit comments