By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Allendale Jan 24th

Display for Arduino

All Topics | Latest Posts

Search for:  in Thread Title in  
SillyOldDuffer25/11/2020 18:31:25
Moderator
6682 forum posts
1501 photos

Just a cotton-picking minute!

Just noticed the board shown in Peter's picture is an 7-segment LED type and the Parola library is for 16x16 dot matrix display. They both use the MAX72xx and SPI, but otherwise aren't compatible

Instead try a MAX7219 library for segment displays, best downloaded and installed from the Arduino's Library Manager. Several choices but max7219 by Jonathan Evans looks easiest.

Dave

Ady127/11/2020 16:08:28
avatar
4139 forum posts
576 photos

Got it in today, this works ok

#include <MD_Parola.h>
#include <HX711_ADC.h>
#include <Wire.h>

HX711_ADC LoadCell(4, 5); // parameters: dt pin, sck pin

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
MD_Parola P1 = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

const int Reset = 3;
//float weight;

String J;

void setup() {
P1.begin();
Serial.begin(9600);

LoadCell.begin();
LoadCell.start(2000);
LoadCell.setCalFactor(851.58); // calibration factor for load cell => strongly dependent on your individual setup Higher for less
pinMode( Reset,INPUT_PULLUP );// Pin3 pull up

}

void loop() {
LoadCell.update();
float i = LoadCell.getData();


Serial.println(i,1);
delay(1000);
J=String(i);
P1.print(J);

if ((digitalRead(Reset) == LOW)) {

LoadCell.tare();
delay(1000);

}}

Ady127/11/2020 16:12:35
avatar
4139 forum posts
576 photos

I sent the 5v live and ground to the breadboard and connected the modules from there, the 7219 first

The 7219 is greedy because it's 100s of LEDs

Does negatives too

edit: must confess that the outputs look weird to me, 100.5 is 10.05 kgs perhaps... hmmm

Just noticed sods post... oops

well if you get the led one it works ok... ish

my brain has exploded so I'll look at calibration testing later

Edited By Ady1 on 27/11/2020 16:32:31

Peter Bell28/11/2020 09:18:36
338 forum posts
155 photos

May thanks for all the help and suggestions.

Tried them without success, however after reading the other thread on Arduino displays and following the suggestion from SOD I felt inspired enough to start looking up what I had on the 7219 which gave limited success due to my lack of knowledge before being abandoned 2 years ago.

This time around from what I have learned I managed to work out what I was doing wrong and ended up with a working 7219 display on my weighing scale. This is my code below.

The Adafruit display worked immediatly and its nice and large and bright so good suggestion.

Next challenge is to explore storing and then retrieving a float value, can anyone reccomend an easy way or good tutorial etc?

I keep hearing about wearing out eproms, is it best to store things like that on an SD card?

Peter

#include <HX711_ADC.h>
#include <Wire.h>
HX711_ADC LoadCell(4, 5);
#include <HCMAX7219.h>
#include "SPI.h"
#define LOAD 10

const int Reset = 3;
float weight;
HCMAX7219 HCMAX7219(LOAD);

void setup() {

Serial.begin(9600);

HCMAX7219.Init();
HCMAX7219.Clear();
HCMAX7219.print7Seg("27-11-20",8);
HCMAX7219.Refresh();
LoadCell.begin();
LoadCell.start(2000);
LoadCell.setCalFactor(851.58);
pinMode( Reset,INPUT_PULLUP );
}
void loop() {
LoadCell.update();
float i = LoadCell.getData();

Serial.println(i,1);

HCMAX7219.Clear(); /* Clear the output buffer */

HCMAX7219.print7Seg(i,1,4,4); /* Write some text to the output buffer */

HCMAX7219.Refresh(); /* Send the output buffer to the display */

if ((digitalRead(Reset) == LOW)) { //Tare

HCMAX7219.Clear();
HCMAX7219.print7Seg("TARE",4);
HCMAX7219.Refresh();
LoadCell.tare();
delay(500);
}
//delay (1000);
}

7219-11.jpg

7219-22.jpg

7219-33.jpg

SillyOldDuffer28/11/2020 10:17:13
Moderator
6682 forum posts
1501 photos
Posted by Ady1 on 27/11/2020 16:12:35:

I sent the 5v live and ground to the breadboard and connected the modules from there, the 7219 first

The 7219 is greedy because it's 100s of LEDs

Does negatives too

edit: must confess that the outputs look weird to me, 100.5 is 10.05 kgs perhaps... hmmm

Just noticed sods post... oops

well if you get the led one it works ok... ish

my brain has exploded so I'll look at calibration testing later

Can you post a picture of your working Parola Display Ady? Then we can see the difference between Peter's 7 segment display and a 16x16 display.

What confused all of us is both types of display are driven by the same MAX7219 chip. It didn't work because the LEDs are wired differently to the 7219 so the commands sent to create visible characters on the two displays are incompatible.

Peter's Adafruit display uses the #include <HCMAX7219.h> library, while Ady's display uses #include <MD_Parola.h> (which behind the scenes depends on the MD_MAX72XX library, supporting 7219 and 7222 LED drivers. )

Peter bumped into the need to check everything!

  • The display was wired correctly to power and the SPI pins
  • His program was logically and syntactically correct
  • The program loaded and ran correctly on the Arduino, meaning Peter's serial link and processor selections were correct.
  • The program does not cause 'undefined behaviour' due to consuming too much memory, ie Peter's code wasn't a resource hog or running amok.
  • Peter's 7 segment display failed only because it doesn't understand 16x16 commands sent by the Parola library.

All the bother was caused by a simple mistook at the beginning : Peter's chosen library didn't match the hardware.

Ady's mention of the 16x16 display guzzling power reminded me of another problem, fortunately it didn't happen here. There's a chance the bootloader will malfunction whilst burning a new program if the Arduino's power supply is heavily loaded by connected devices, The cure is to connect power greedy devices after loading the new program, or to power them separately.

Dave

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Latest Forum Posts
Support Our Partners
emcomachinetools
EngineDIY
cowells
Warco
Eccentric July 5 2018
ChesterUK
Eccentric Engineering
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest