Peter Bell | 20/11/2020 11:04:45 |
399 forum posts 167 photos | Hello Not really model engineering but at least I'm using my Myford to make the parts! As a fairly inexperienced Arduino user I am building a dedicated weighing scale using a 1kg load cell. Its all working fine using a lcd display but what I would like is use a larger display and this where it gets difficult as there so many variations to choose from. Tried a max 7219 without much success also some tft but all seem difficult to use, at least for me! Can anyone reccomend an easy to use current larger display that worked for them, say 1.8" or 2.2"? Thanks Peter |
Andy Stopford | 20/11/2020 20:18:27 |
241 forum posts 35 photos | You need the 7-segment display with i2c backpack - that way there are only two data lines to connect up. They are readily available from ebay and look really good. Unfortunately I've only used one with a Raspberry Pi zero, so I can't give you the C code to make one work (I used Python for the Pi, and the libraries are different anyway). Hopefully the following link to Adafruit's information and instructions won't fall foul of the forum rules: https://learn.adafruit.com/adafruit-led-backpack/ edit: Sorry, the ebay ones are SPI rather than i2c; they should be similar to get working, but for simplicity, it might be best to use the Adafruit ones - if you're in the UK, Pimoroni sell them - they cost a bit more than the ebay ones, unfortunately. Edited By Andy Stopford on 20/11/2020 20:27:24 |
duncan webster | 20/11/2020 23:15:35 |
5307 forum posts 83 photos | I think you want one of these TM1637 I've not used this particular one, I've used 8 digit and other 4 digit serial displays, much better than LCD for visibility, but limited scope of non numeric characters |
Ady1 | 20/11/2020 23:29:24 |
![]() 6137 forum posts 893 photos | The max 7219 is good with the MD_Parola library but it uses a lot of memory There's a chap here who has made an LCD version with teeny code The parola library is worth the extra effort though, because it lets you do virtually anything with an LED dot matrix, pins 10 11 and 13 have given me the least problems so far an awful lot of examples are like crippleware for a beginner with the arduino, but small tweaks suddenly make all the difference Coding is still the same old teeth grinding brain squeezing grope in the dark subject that it was 20 years ago but at least the arduino can give you a leg up and start talking to stuff I think the problem with dot matrixes is you have to tell it EVERYTHING, so you get stuff like below x 100s to define every character or shape, like every dot in newsprint ////////////// const char font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data) B10000000, //! B10100000, //" B01010000, //#
Edited By Ady1 on 20/11/2020 23:48:02 |
Ady1 | 21/11/2020 00:05:51 |
![]() 6137 forum posts 893 photos | If you can dump your readings into the serial monitor this should transfer them to a 7219 Just add these lines to your routine, tweaking the names of variables as required I'm assuming your readings are floats and you have a 4 module 7219 ------------------------------- #include <MD_Parola.h> #define HARDWARE_TYPE MD_MAX72XX::FC16_HW #define CLK_PIN 13
String J; float weight; void setup() P1.begin(); void loop() J=String(weight); P1.print(J);
--------------------------------------- Somewhere in your void loop() will be a Serial.print(weight); line for printing your weighing sensors output to the monitor, the variable in brackets is your float omg...I hate code... Edited By Ady1 on 21/11/2020 00:25:51 |
Peter Bell | 21/11/2020 09:48:58 |
399 forum posts 167 photos | Many thanks for the help, hesitated asking but pleased I did! The power of this site is amazing. Never heard of an I2c backpack so ordered some Adafruit bits also a TM1637 to try. Nice tutorial on the Adafruit. Meanwhile Ady I'll have a go with the Parola suggestion but looks far more than what I need. Copied the code and got it to compile after adding some curly braces. Added to my weighing sketch but its doing some funny things with the Max display, need more time to play, hopefully later. |
Ady1 | 21/11/2020 10:18:15 |
![]() 6137 forum posts 893 photos | Don't forget your wires on the arduino, use 10 11 an 13 Pasting your current code in here would be the simplest route |
Ady1 | 21/11/2020 11:46:09 |
![]() 6137 forum posts 893 photos | Posted by Peter Bell on 21/11/2020 09:48:58:
Copied the code and got it to compile after adding some curly braces. It needs to be done in steps 1. Get your weighing machine outputting data to the computer monitor 2. connect up the 7219 3. insert my code into your weight routine to transfer data to the 7219 simples! (we wish) Edited By Ady1 on 21/11/2020 11:53:13 |
Peter Bell | 23/11/2020 10:42:02 |
399 forum posts 167 photos | This is my working sketch at least for weighing and LCD display--must have got it wrong as I cannot make the Parola do anything? Inserted what I think but probably not in the right place! Certaily takes a lot of memory. Can make the 7219 scroll from other sketches so the module is working. #include <MD_Parola.h> void loop() { J=String(weight); |
Ady1 | 23/11/2020 11:08:47 |
![]() 6137 forum posts 893 photos | Can make the 7219 scroll from other sketches so the module is working. #include <MD_Parola.h> void loop() { J=String(i); |
Ady1 | 23/11/2020 11:12:13 |
![]() 6137 forum posts 893 photos | Get rid of anything to do with the LCD and give that a go GL |
Peter Bell | 23/11/2020 11:17:23 |
399 forum posts 167 photos | Got rid of all lcd but no difference I'm afraid....
|
Ady1 | 23/11/2020 11:49:25 |
![]() 6137 forum posts 893 photos | Is your weight sensor outputting to the monitor ok? |
Peter Bell | 23/11/2020 11:57:16 |
399 forum posts 167 photos | Sorry forgot to say---yes working fine |
Ady1 | 23/11/2020 13:13:17 |
![]() 6137 forum posts 893 photos | Well All I'm doing is outputting that number (i) to the 7219... Try changing Serial.begin(9600); to Serial.begin(57600); And check your LED wiring is ok EDIT: I have gone and bought a HX711 from the bay because I've finished my last project, arrives in about a week or less Package include: Edited By Ady1 on 23/11/2020 13:48:58 |
SillyOldDuffer | 23/11/2020 14:24:53 |
10668 forum posts 2415 photos | Just a suggestion but I see Peter's code says: J=String(i); The problem may be because P1.print() expects to be given a C string (small s) rather than a C++ String (big S) Try P1.print( J.c_str() ); // get a C null terminated string from the C++ String J, If memory is very short, causing the dreaded 'undefined behaviour', remove big S Strings from the program because they use a lot of memory. C++ may be much clearer and less error prone with: J=String(weight); but pure C is faster and uses far less memory with: char buf[24]; // big enough to hold a 23 digit number Dave
Edited By SillyOldDuffer on 23/11/2020 14:29:53 |
Peter Bell | 23/11/2020 18:46:57 |
399 forum posts 167 photos | Thanks for the suggestions. Tried thems in many combinations including baud rate but didnt make any difference, When read i instead of weight got the display to do something, see attached reading a 1kg weight , no weight just flashes the decimal places. Put the lcd back as it doesnt seem to be the culprit. Tried another display with identical results, perhaps its time to give up and wait for the I2c display and other to arrive!
void setup() { void loop() { J=String(i); Edited By Peter Bell on 23/11/2020 18:47:21 Edited By Peter Bell on 23/11/2020 18:48:13 |
SillyOldDuffer | 24/11/2020 16:44:27 |
10668 forum posts 2415 photos | So it's trying - the output suggests the display is being controlled via SPI but sent the wrong commands, therefore lighting up the wrong segments. The Parola library depends on the MD_MAX72XX library, and its .h file explains as there is no standard way of connecting the LCD blocks to the converter chip on the end, so the library supports 4 options. They are: GENERIC_HW, ///< Use 'generic' style hardware modules commonly available. Possibly your module isn't an FC16? Anyway, no harm trying the 3 alternatives to #define HARDWARE_TYPE MD_MAX72XX::FC16_HW eg. #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW or #define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW or #define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW Dave |
Peter Bell | 24/11/2020 19:24:30 |
399 forum posts 167 photos | Thanks for the help Dave. Tried all the 3 alternatives but still got the same result I'm afraid. Also tried another display just in case this one is a dud or not what it's marked with identical results. Think its time to put this display aside and wait until the ones arrive that were suggested earlier in the thread, sure they will bring new problems to the surface and then more learning. Peter |
SillyOldDuffer | 25/11/2020 09:30:27 |
10668 forum posts 2415 photos | Had another couple of thoughts. Maybe you have the correct device, wiring, and HARDWARE_TYPE, but are sending it data it can't cope with. The floating point number generated by: J=String(i); // Could send too many characters to fit the display, or the decimal point is illegal punctuation. (Floating point numbers change size depending on the result. By default String does 2 places of decimals eg String(1.0/3) gives "0.33", but watch out for the likes of 1000000.0/3 giving 333333.33. The Parola documentation looks as if punctuation is allowed, so the decimal point should be ok.) Test by assigning some short constants to J in your code , to see if they work. Eg. J=String("ABC" ) ; // Note - fits in a 4-cell block J=String("123" ) ; J=String("1.3" ) ; J=String(1.3); Assuming all that fails, have you tried any of Parola's examples? (See File->Examples menu ) This one does nothing but say 'Hello', always a good first step to prove the basics are working. If Parola's own example can't be made to work, suspect wiring error or dud device. Note HARDWARE_TYPE needs to change to do your FC31. If the LEDs display hello, experiment by sending it Strings as above. // Program to demonstrate the MD_Parola library #include // Define the number of devices we have in the chain and the hardware interface #define CLK_PIN 13 // Hardware SPI connection void setup(void) void loop(void)
Edited By SillyOldDuffer on 25/11/2020 09:31:39 |
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
Sign up to our newsletter and get a free digital issue.
You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy
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.