In this article, we will use Odysseus to process measurements from two light dependent resistors (LDR). To do so, we use the Arduino open-source electronics prototyping platform.
- RS232 wrapper bundle
- Arduino IDE or dfu-programmer
- Arduino Board
- 2x Light dependent resistor
- 2x Resistor (10kΩ)
- Soldering iron and solder
- USB Cable to connect the Arduino to your computer
For this example we will use an Arduino Mega 2560. To measure the voltage at the LDR we simple build a voltage divider as shown the following image.
Next, we solder all the parts together. We use three pins to connect the wires later. However, you can also just solder the wires on the parts.
After that, the three wires of both LDRs are connected to the Arduino (red: 5V, black: GND, and green on A0). In the image we used the ScrewShield to connect the wires.
When all wires are connected you can plugin the USB-cable and start writing the software for the Arduino.
To measure the voltage at the LDR we simple use the analogRead method with the pin id as parameter. The output is done by the Serial.println method that puts the readings on the serial connection as a CSV string.
The query reads the sensor measurements from the serial connection on device ttyACM0. To do so, the Access operator uses the RS232 Transport Handler and the CSV Protocol Handler. Further, we set our stream schema to light1 as Double and light2 respectively.
After writing down the query you can start it and open the operator graph to see the measurements in the List View.