Tutorial 6: One wire temperature sensor and sonar rangefinder
The DS18B20 chip is a digital thermometer that provides 9-bit to 12-bit Celsius temperature measurements (and has an alarm function with nonvolatile user-programmable upper and lower trigger points). It can be obtained as a waterproof sealed unit with a 1M lead. The DS18B20 chip is contained in the stainless steel tip, and communicates over a 1-Wire bus that requires only one data line (and ground) for communication with the Arduino. In addition, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply. Each DS18B20 has a unique 64-bit serial code, which allows multiple sensors to be placed on the same 1-Wire bus. XOD provides a node in the "common hardware" library that can read single 18DSB20 devices in a circuit.
The sensor measures temperatures from -55°C to +125°C with better than ±0.5°C Accuracy from -10°C to +85°C (see graph) - the chip is internally calibrated and returns a digital measurement that can be displayed directly. (For more information, see: https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806)
Your challenge is to devise and implement in XOD a temperature alarm system using the Arduino prototyping system, DS18B20 sensor, LCD panel readout and buzzer.
XOD contains a node that supports use of an ultrasonic sonar distance sensor, the HC-SR04. For more information about the device, see: (https://components101.com/ultrasonic-sensor-working-pinout-datasheet).
The ultrasonic transmitter emits an sound waves at 40 000 Hz which travel through the air and if there is an object or obstacle on its path It will bounce back to the module. The module also has a receiver that allows measurement of the travel time. Knowing the speed of the sound allows calculation of the distance. The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. The GND and the VCC pins of the module need to be connected to ground and the 5 volts pins on the Arduino board and the trig and echo pins to any Digital I/O pin on the Arduino Board.
Can you use this code to create a theremin-like device, using different forms of input to control the (potentially) tuneful passive buzzer output device?