Temperature monitoring – Making coding easier
Warning – long post! If your bored already, look at the bottom picture for results
With my new outlook and fresh enthusiasm for the project, I thought I’d tackle the more basic issues first, temperature readings.
I wanted two temp setups, one for the chemical temp, and one for the water bath temp. I decided against an extra devtank sensor for design reasons and the fact, I’ll build a warm-up time into the dev process for heating at the start of a dev session.
I have decided to use a separate Arduino for the temps. Why you ask? Simple really, to keep things simple!! When you start adding lots and lots of time-specific coding to an arduino, you can’t use the delay() function as it stops other parts of code, knackering up the whole project. You have to use millis() with references to keep track of what is happening when. It’s fine for a few basic things, such as keeping track of the agitation, but adding temp checks, and monitoring and the code can get very complicated.
Another thing I found is that whilst there is alot of useful information on the internet, Asking for coding help on arduino forums in general can quickly go from friendly pointers to ‘we know everything and you must learn everything from scratch’. I appreciate that they must get sick of people asking for the same things, but for the ‘copy and paste’ coding person like myself, this normally turns into, ‘I just want a bit of help, not a lecture into why I MUST LEARN EVERYTHING’. I find coding boring, fact and just want to learn what I need to know. I don’t want to spend 3 months of my life learning how to turn an LED off with 20 different methods. I just want to understand the basics of what I need. This might cause some annoyance to some reading this. If your a coder, great, well done. I’m not and want to balance my work and life. Each to their own.
You can get round this by using a separate arduino for the temp side, which keeps the temp coding very simple. If you do need to send a temp signal to the other arduino, then this can be done through a wire, eg. if it reaches a certain temp, send a signal over a pin, etc. And the best thing, chinese knock offs of the arduino are super cheap!, I got a chinese mega and uno for the project for £15 combined including postage. A genuine uno is £25 on its own.
After doing some research, I found that the easiest to use waterproof sensor is the digital DS18B20. It can be submerged in liquids upto 100 degrees and being digital unlike an analog sensor is easy to wire. In fact you can daisychain them and they work with each sensor having their own ‘address’.
Quite easy to wire up, power and the sensor wire. But they do need a 4k7 resistor wired between positive and signal. I could go into why, but to be honest I’m not bothered as long as they work. They are cheap too.
I used my chinese uno and a LCD I had spare and used some copy/paste code to get them tested and working.
Ignore the text on screen, I was going to do a car one but the electrical interference from the engine was too much for the length of the cables. Anyway, with it working, I moved onto getting them to work on a 7-segment display as this is what I wanted for the project.
Again, after just getting more annoyed and confused reading forums, I found a wonderful arduino library called Bremme’s tm1637. It uses the tm1637 chipset to drive the displays like most found on ebay, but it uses almost plain-english coding for the display like LCD Print, taking all of the nightmare coding required by other libraries.
I quickly adjusted the arduino sketch to fit the new displays and below is the result. Works fine. I used the last digit to put the celsius ‘C’ on, taking note that the temp will never be 3 digits for home dev, otherwise the C would vanish off screen, due to the spacing required.