Hi,
This question was asked on our blog (for this article: Arduino 5 Minute Tutorials: Lesson 8 – Wheatstone Shield & LCD ), but due to its size and complexity, it would not have been appropriate as a blog comment.
Lawrence:
I have had a set of scales from Royal for years that gets used frequently.
They look like a set of bathroom scales with no read out but have a remote RF connected read out.
The read out died and I could not fix it so the scales were headed for the garbage when I got an idea to read the strain gauge some other way.
Using a printer serial cable I connected the strain gauge to RobotShop’s Wheatstone Amplifier Shield.
Not being a programmer I muttered through getting the code to add up 300 measurements of the analog input at the beginning of the code and saving that at a offset called Tare.
Then the code goes into a forever loop that add up 300 more measurements from the analog input and subtracts the Tare value and divides by 300.
My variables were floating variables and I don’t think the map instruction worked consistently with floating variables so I just scaled the outputs results by dividing by the ratio of a test weight and the read out.
Success a good readout with less than .1 pound variation over several hours.
I had a good read out on the computer by way of the serial port but I wanted a LCD read out with no computer connected.
The RobotShop’s LCD shield kit for Arduino looked like a good solution.
I uploaded some examples for that load cell LCD package but they would not compile until I uploaded them from github.com site.
I got the code and the drivers together and it compiled.
Next I put the LCD screen on top of the amplifier as described in the tutorial.
The program compiled and uploaded but that is where the progress stalled for a while.
I was having a hard time trying to follow what the code was trying to do.
Did I mention I am NOT A PROGRAMMER!
The buttons did not do what the tutorial and screen indicated they would.
By looking in the associated Library files I found a couple of commands (lcd.setCursor(x,y) and lcd.print()) that would do what I wanted.
By adding the Strain_gauge….Function library and Initialization line for LiquidCrystal to my already working scale code the new commands allowed the display to show the weight on the scale.
Ok it works and will run on any of the Aurdino power sources.
But what about those buttons how do I use them.
By looking at some of the code that did not work and the schematic I could see that the buttons just changed the voltage on analog input pin 5 so I added a line of code to print to the serial port analog(5) and uploaded it.
The analog reading appeared below the weight read out on the serial monitor.
As I pushed different buttons the readout changed except for the select button.
When I pushed the select button the number did not change.
I should mention that I am using a Arduino Zero.
I assumed a bad solder joint or switch.
After close visual inspection I went to the ohm meter and found everything looked reasonable and the switch worked.
So I put it back together and powered it up with the same results.
I hooked up a volt meter between Gnd and analog(5).
With no button pushed the voltage is 3.816 volts.
That is higher voltage than the Zero should have connected to it and over the AtoD range.
With the select button pushed the voltage is 3.530 volts.
Still too high.
So my Zero still works but I have it unplugged for now.
I can see a couple of ways of using the LCD with a Zero.
I could just leave the jumper off but then I lose the ability to use the buttons in a later project.
Might be able to power it from the 3.3 V rather than the 5 V but that would require some board hacking or input pin bending.
I like putting a resistor between A(0) and ground.
A 3.9K resistor would work nicely a 3.3K might be a better choice giving better protection to the Zero if VCC goes above 5 volts.
With the resistor clipped in I get a voltage change and an A(5) reading change with all the buttons and the no button pushed is below 3.3 volts.
Since the Arduino Zero can only read voltages up-to 3.3 V DC and the LCD screen used (RB-Ite-161 ) is powered by 5 V DC, there is an obvious voltage level issue.
As you can see in the LCD screen’s schematic (found on the product page under Useful Links ), the VDD of the entire circuit comes from the 5V pin of the Arduino and the resistor network (basically a variable voltage divider) is based on that VDD for its output.
A possible fix to this issue would be to take the analog output of the shield (the button value) and pass it through a fixed voltage divider (basically 2 resistors) before sending it on to the Arduino Zero. Simply choose resistor values that would set the maximum voltage outputted to be divided to below 3.3 V DC and you should have no issue. You could simply use two 10 kOhm resistors and divide it by half. It would most likely still give you more than enough resolution to figure out which buttons is pressed, even with a quick ADC in 8-bit mode.
We hope this helps!
Sincerely,
Thanks Scharette
I have soldered the one resistor fix on to the board as I described above. The resistor goes from ground to analog(0).
My hope for posting was to let others who use the LCD device with a Zero would do something to prevent over voltageing their Zero.