In this part of the series I’ll discuss how to read data from the temperature sensor, make the Arduino react to claps and I’ll also go over the software that controls all these features and then displays the right numbers on the Nixie tube display. Like I said in part 1, I used the well-known DHT-11 temperature (and humidity) sensor. At this stage of the build I’ll use a breadboard and jumper wires to test the functionality and ensure, that the code works correctly, where it is possible. In part 3 of the series the temperature sensor, along with all the other necessary components, will be integrated on one single PCB that will (hopefully) fit nicely into a beautiful custom case.
Reading the temperature
Hardware
You might have already heard about the DHT-11 (or the DHT-22) combined temperature and humidity sensor:

The only difference between this sensor and the DHT-22 is the accuracy and measuring range. The 22 has a higher range and better accuracy, but for measuring the room temperature, the DHT-11 is more than sufficient and cheaper, even though it can only deliver integer results.
The sensor requires three connections: VCC, GND and a single line for serial communication. Simply connect it to the voltage source and connect the single wire for communication to a GPIO pin of the Arduino. The datasheet suggests to add a pull-up resistor between the com-line and VCC, so that the communication line is in a high state, when not used:

That’s all that is needed for now. The rest is done via software.
Software
Luckily there’s already a library for the DHT-11 (and a bunch of well-documented libraries for the DHT-22), which will handle the communication between the Arduino and the temperature sensor. So a test application for this part is quite short:
#include dht11 DHT11; int compin = 7; //celsius to fahrenheit conversion double Fahrenheit(double celsius) { return 1.8 * celsius + 32; } void setup() { Serial.begin(9600); } void loop() { // returns a checksum you can check for errors DHT11.read(compin); // THe standard unit of this device is celsius, // fahrenheit conversion available above. Serial.println((float)DHT11.temperature, 2); // wait for one second delay(1000); }
Controlling the Nixie tubes
To turn a certain number on a tube on, you have to transmit a 4-bit code to the decoder, which will turn on the correct transistor. Furthermore, you also need to transmit one bit that indicates, which of the two tubes you want to set right now.
I decided to add an R/S-Latch right in-front of each input of the decoder. For those of you, that don’t know, how one of these latches works, here’s a quick explanation:
It basically allows you to store one bit of information. The latch can be SET and RESET (hence the name R/S-Latch, also known as S/R-Latch or R/S-Flip-Flop). By activating the SET input of the latch, the output Q is set to 1. By activating the RESET input, Q becomes 0. If both inputs are not active, the previous state of Q is retained. If both inputs get activated at the same time you have a problem, because the latch is forced into an unstable state, which basically means that its behavior will be unpredictable, so avoid this state at all cost.
So to display the number 5 on the first (the left) and the number 7 on the second Nixie tube, you have to:
- RESET all the latches
- Activate the left tube (Send 0 over the EN-line)
- Set the inputs of the decoder (D, C, B and A): 0101
- Set D, C, B and A all to 0, so that the last state is retained (This doesn’t need to be done if both tubes should display the same number)
- Activate the right tube
- Set the inputs of the decoder (D, C, B and A): 0111
- Set D, C, B and A all to 0, so that the last state is retained
To turn the tubes off you can transmit an invalid value (like 10 or 15). The decoder will then turn all the outputs off and therefore none of the available transistors will be activated and no current will flow through the Nixie tube.
Complete Arduino sketch
Click here to download the code
Table of contents
Part 1 – Nixie tube basics and electronics
Part 2 – Sensors and Software (You are here)
Part 3 – Custom PCB and case
Sources
DHT-11 Arduino library – arduino.cc
Image sources
[Fig. 1] DHT-11 temperature sensor – tinytronics.nl
hello What software you used for the figure 2 and 3, thank you
LikeLike
Hi! I used fritzing for those images. You can get it here: http://fritzing.org/home/
I don’t use it often, but it’s nice for these types of images.
LikeLike