MAX7219 8-Digit LED Display 7 Segment and ds18B20

Hi guy´s

Does anyone know if there is any example sketch for using multiple MAX7219 8-Digit LED Display 7 Segment with the DS18B20 tempsensor?

I have a need to have 8 separate temp sensors and display them on 8 different displays for a solar project with the same UNO in my house..

Have seen some example of this in the past but are unable to find it again. As i understand it, the MAX7219 can be daisy chained on the same bus..

Thankful for any tip

BR
/A

Check the Parolo.h library for driving multiple daisychained MAX7219/display units.

I haven't seen library which comes with a DS18B20 & Max7219 example so far.

But I guess it's a quite straight forward:
a) do a sketch with 8 DS18B20 and output the temperatures periodically to serial monitor without delay()
b) do a sketch with 8 MAX7219 and put information on each MAX7219 without any delay()
c) combine a + b into one sketch

for b) I can suggest my MAX7219 library from Arduino Noiasca LED Control with print method (MAX7219/MAX7221)

it handles display output with simple print commands like

lc.setCursor(1, 0);    // second chip (=address), first character (=position)
lc.print("2nd IC");    // print text to LED Display

Hi guy´s and thanks

noiasca, looks like a very nice .lib you have, i have no problem getting 8 sensors data, but do you have any example code for aquiring the 8 separate Max displays and to do a write to them with the temp data aqiured from the DS18B sensors ?

BR

/A

If you have the 8 values available, it should be pretty easy to print them on the 8 displays.

Only the display part (b) might look like this:

// https://forum.arduino.cc/index.php?topic=644552.msg

//We always have to include the library
#include "NoiascaLedControl.h"   // download the library from http://werner.rothschopf.net/201904_arduino_ledcontrol_max7219.htm

const byte devices = 8;

/*
  Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
  pin 12 is connected to the DataIn
  pin 11 is connected to the CLK
  pin 10 is connected to LOAD
 ***** Please set the number of devices you have *****
  But the maximum default of 8 MAX72XX wil also work.
*/
LedControl lc = LedControl(12, 11, 10, devices);

const byte sensors = devices;
float sensorValue[sensors];        // assumption of

void setup() {
  //we have to init all devices in a loop
  for (byte i = 0; i < devices; i++) {
    lc.shutdown(i, false);  /*The MAX72XX is in power-saving mode on startup*/
    lc.setIntensity(i, 8);  /* Set the brightness to a medium values */
    lc.clearDisplay(i);     /* and clear the display */
  }
}

void loop() {

  // do your sensor measurements
  for (byte i = 0; i < devices; i++)
  {
    sensorValue[i] = random(0, 500) / 10;    // just some random numbers for test
  }


  // output your sensor values to the displays
  for (byte i = 0; i < devices; i++) {
    lc.setCursor(i, 0);           // second chip (=address), first character (=position)
    lc.print(F("T"));             // a fix text
    lc.print(i + 1);              // identify the sensor + 1 to make it human readable starting with T1, T2, T3 ... T8
    lc.print(F("      "));        // delete the previous temperature by writing blanks
    lc.setCursor(i, 3);           
    lc.print(sensorValue[i], 1);  // print sensor value to LED Display with one decimal
  }


  delay(5000); // dirty delay
}

if you want to have assistance with (c) you should provide (a).

Hi noiasca

Thank you for the example code, i will try and implement this as soon as i get my LED´s
After the thing is "cooked" up i will post the whole thing on the forum so others can benefit of the sketch..

One question, is the first device always zero on the bus?, meaning the next 7219 on the bus =1, meaning that you can write directly fx. to device 7?

BR

/A

yes.
It's like your are used to have in arrays. C++ starts counting with 0. I do the same in my library.

And by the way, read the chapter

Understanding digit numbering and position of cursor

on my page. If you are missing information, let me know.

I am measuring 10 x DS18B20 simultaneously with a Nano - displaying all temperatures on a 3.5 nch TFT display - works fine.

see Monitoring temperatures in floor heating loops with an Arduino, with data display on a 3.5’ TFT screen – thesolaruniverse

enjoy !

1 Like