In this tutorial we will learn how to display a temperature on a NeoPixel LED Ring from a DHT11 sensor using Arduino and Visuino software.
Watch the Video!
Step 1: What You Will Need
- Arduino Uno or any other Arduino board
- NeoPixel – RGB LED Ring
- DHT11 Temperature and Humidity Sensor
- Jumper wires
- Visuino software: Download here
Step 2: The Circuit
- Connect Arduino board pin 5V to LedRing pin VCC
- Connect Arduino board pin GND to LedRing pin GND
- Connect Arduino board Digital pin 2 to LedRing pin DI
- Connect Arduino board pin 5V to DHT11 pin VCC {+}
- Connect Arduino board pin GND to DHT11 pin GND (-)
- Connect Arduino board Digital pin 6 to DHT11 pin S (Out)
Note: some generic LED rings or DHT11 sensors might have a diferent configuration of pins or diferent pin names.
Step 3: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Arduino UNO” as shown on Picture 2
Step 4: In Visuino Add Components
- Add “DHT11” component
- Add “Map Range Analog” component
- Add “Ramp To Analog Value” component
- Add “Analog To Unsigned” component
- Add 3X “Compare Analog Value” component
- Add “Color Value” component
- Add “NeoPixels” component
Note that since the LED Ring only has 12 LEDs (in our example) and we are getting a temperature value let’s say 23, we need to transform this value to display it on the LED Ring, that is why we are going to use “Map Range Analog” component, it will transform our first range temperature from 0-40 into LED Ring range 0-12
Step 5: In Visuino Set Components
- Select “MapRange1” and in the properties window set Input Range>Max 40 (because we will measure the temperature up to 40 degrees)
- Select “MapRange1” and in the properties window set Input Range>Min 0 (because we will measure the temperature from 0 degrees and up)
- Select “MapRange1” and in the properties window set Output Range>Max 12 (because our LED ring contains 12 LEDs)
- Select “MapRange1” and in the properties window set Output Range>Min 0 (because our LED ring starts at zero)
- Select “RampToValue1” and in the properties window set Max Step to 1 and Slope (S) to 10
- Select “CompareValue1” and in the properties window set “Compare Type” to “ctSmaller” and Value to 3
- Select “CompareValue2” and in the properties window set “Compare Type” to “ctBiggerOrEqual” and Value to 3
- Select “CompareValue3” and in the properties window set “Compare Type” to “ctBiggerOrEqual” and Value to 8
- Select “ColorValue1” and in the properties window set Value to clGreen
- Double click on the “ColorValue1” and in the Elements window drag “Set Value” to the left side and in the properties window set Value to clBlue
- drag another “Set Value” to the left side and in the properties window set Value to clGreen
- drag another “Set Value” to the left side and in the properties window set Value to clRed
- Close the Elements window
- Double click on the “NeoPixels1” and in the “PixelGroups” window drag “Color Pixel” to the left side and in the properties window set “Count Pixels” to 12 (the number of the LEDs on your LED Ring)
- Close the “PixelGroups” window
Step 6: In Visuino Connect Components
- Connect “HumidityThermometer1” pin Sensor to Arduino board Digital pin 6
- Connect “HumidityThermometer1” pin Temperature to “MapRange1” pin In
- Connect “MapRange1” pin Out to “RampToValue1” pin In
- Connect “MapRange1” pin Out to “CompareValue1” pin In, “CompareValue2″ pin In,”CompareValue3” pin In
- Connect “MapRange1” pin Out to “CompareValue1” pin In to “AnalogToUnsigned1” pin In
- Connect “AnalogToUnsigned1” pin Out to “NeoPixels1” pin Index
- Connect “CompareValue1” pin Out to “ColorValue1″>”Set Value1” pin In
- Connect “CompareValue2” pin Out to “ColorValue2″>”Set Value1” pin In
- Connect “CompareValue3” pin Out to “ColorValue3″>”Set Value1” pin In
- Connect “ColorValue1” pin Out to “NeoPixels1” pin Color
- Connect “NeoPixels1” pin Out to Arduino board Digital pin 2
Step 7: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 8: Play
If you power the Arduino UNO module, the LED Ring will start to show the temperature value.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu
Download ledring-temp.zip