2 temp sensors, 2 4-digit 7 segment displays, 1 max7219

Hello all,

I am really new to this, but I am jumping in head first.

I have a project that I want to do. This is for my sons power wheel car. We are adding more volts to the motors to make it go faster. The only problem is the motors could get hot enough to fail. So what I want to do is put a temp sensor on each of the two motors and have 2 gauges that show the temperatures of them. I have 2 4-digit 7 segment displays, one for each temperature. I want to display the temps as xxx.x (3 digits, plus 1 decimal place). I have read that the max7219 chip I got to drive them can control all 8 digits on the two displays.

So far I have figured out how to read the temperature on both sensors and monitor it in the serial monitor. Now I have to figure out how to wire and program it to display the temps on the displays. This is what I need help with. I am pretty sure that I have figured out how to wire them, but I'm not sure how to do the programming.

Eventually, after I get this much working, I want to add code to turn on a couple of fans if the temperature goes above a certain temperature.

Thanks for any and all help for this newbie.


Thanks! I have read up some more and I have all the hardware wired and working. I can run the demo sketches and the displays work great!

Now I need to figure out how to take the reading that the temp sensor gives and assign each of the numbers in the value to each of the digits in the display. Can someone point me in the right direction for that?


It would be helpful to know what you can do with your display so far.

Can you display digits or just random patterns of bars?

Do you know how you are controlling these digits or have you simply run an example sketch from somewhere?

From a basic overview you need to:

Define a font (if needed - see below).
Write a function to display a digit by mapping a number onto the display (e.g. using the font & maybe adding a decimal place where appropriate).
Write a function to dissect your temperature measurement and pass it to the writing function one digit at a time.

How you do this will depend on what you have already coded. There are, for example, two ways you can drive the '7219 - you can control the bars directly or you can use the inbuilt font.

Ok, thanks. I have actually figured out how to get the digits to display correctly. Now I have a new problem…

The temperature readings are all over the place. When I first start it up, the 2 display the same temperature, which they should since they are sitting right beside each other. Then as it cycles through the loop ever 5 seconds the temps are all over the place. The 2 vary by up to 15 degrees and are just up and down like crazy.

I have sent the output to the serial monitor as well and it matches the displays, so it is sending to the displays correctly. There must be something with the voltage or something coming from the temp sensors???

If I comment out the code that sends the values to the displays (basically leaving them off) the readings in the serial monitor are nice and consistent.

I have attached a pic of the layout. The temp sensors are in the bottom left corner.

Have you tried some decoupling caps?

The '7219 is pulse width modulating 8 digits hundreds of times a second. If that causes a ripple just at the point that your Ardu' is doing an D to A conversion it could mess things up pretty well.

Have you tried a 100nf ceramic across the supply & Gnd right close to each sensor?

If it's not that then it's either in the code or it's beyond my insight into these things.

I have not tried that as I don't really know what you just said LOL.

I will look into the decoupling caps and see if it helps. Thanks!

Well, I'm no expert but essentially any switching, especially fast switching of significant currents, causes the supply voltage to wobble. It's like trying to measure the pressure in a pipe while someone keeps turning on and off the taps. Eventually more current flows from the power supply but that takes a little time. To help with this you can put small, fast reserves of charge close to sensitive components. Those reservoirs are capacitors. Big ones store more but take longer. Really small ones don't store enough to help much. A 100nf (0.1 uf) is typically a good trade-off and a ceramic capacitor is faster than an electrolytic one.

Just grab a few 100nf ceramic capacitors (they will be useful sometime if not now) and poke them in right next to the sensors (between +5v and Gnd). It might not help but it might and it won't hurt.