Arduino 5 Minute Tutorials: Lesson 8 - Wheatstone Shield & LCD

note: for discussing any technical issues with your Load Cell Amplifier Shield, please proceed to our forum and create a new topic here.

arduino-tutorial-lesson-8_2

Since the creation of the post Interfacing a Load Cell With an Arduino Board, we received many requests from customers about displaying the data read from the load cell on an LCD screen. This tutorial will show you a simple method to achieve this goal quickly.

Lessons Menu:

Bill of Materials (BoM)

Setup

First, we recommend that you check the post mentioned above. It covers the basics of getting an Arduino, the Wheatstone bridge shield and the load cell connected together and testing them to ensure they work. Please note our example uses A1 and the Strain 2 connection on the Wheatstone bridge shield and A5 for the buttons on the LCD/Button shield. Once you have the basic setup of the Wheatstone bridge shield and load cell completed and working, we can move to adding the LCD screen shield.

Place the stackable headers on top of the Wheatstone shield’s female headers. Make sure to bend the stackable header’s A0 pin towards the outside instead of straight into the female header of the Wheatstone shield (see the image below).

Stackable headers - A0 pin is bent to outsideStackable headers - A0 is bent towards the outside

Then, place the LCD shield on top of the stackable headers. Follow this by using a female / female 1-pin jumper cable and connect the protruding pin from the stackable header to the A5 male pin on top of the LCD shield (see the image below).

LCD Shield A0 rewired to A5LCD Shield A0 rewired to A5

Once all the parts are assembled, simply connect your Arduino by USB to your computer and start the Arduino IDE. If you do not have the Arduino already installed or have an older version, you can obtain the most recent version here (for Windows, OSX and Linux). Make sure to select the appropriate board type (processor if needed) and port.

Sample Code

The code for this blog post can be obtained on the RobotShop GitHub under the Wheatstone Bridge Amplifier Shield repository. The code is set as one of the examples and uses the Wheatstone Shield and LiquidCrystal libraries. You can obtain it with the Wheatstone shield library (zip file) or by itself here.

Once you have installed the library (how to install a library), simply go through the following menus:

File -> Examples -> Wheatstone Bridge Amplifier Shield -> Examples -> strain_gauge_shield_and_lcd_arduino_uno_code.

Once the example is open, you can then program the Arduino sketch to your board using the Upload arrow, Arduino Upload Arrow.

LCD in action #1Title screen

Results!

As soon as the code is uploaded to the Arduino, the screen should start displaying text concerning the application. After a few screens, you will be asked to perform the linear calibration. First, you will have to enter the low point for force (defaults to 0). It can be changed using the left/right/up/down buttons. Once you press select, you will be ask to choose the raw ADC value that is equivalent to 0. Then, you will be asked for the high point of the force measurement. This is ideally the largest force you wish to measure but it can be any force that is higher than the low point. Add a weight/tension to your load cell equivalent to the force entered and press select. The screen will then show you the raw ADC value for the high point with the weight/tension. Press select to calibrate the system.

You can now attach weights to/put to tension your load cell and get an estimate of the force produced based on your calibration. Have fun with this little project and don’t be shy to comment about your attempts here, on Let’s Make Robots (via a project page) or through the GitHub if you have code fixes, updates, ideas or even new examples to offer!

LCD in action #2Real-time measurements

More information

If you followed this tutorial but are curious about the electrical inner workings of this project and its parts, such as the load cell and the Wheatstone bridge amplifier shield, you can obtain more information here:
This is a companion discussion topic for the original entry at https://community.robotshop.com/tutorials/show/arduino-5-minute-tutorials-lesson-8-wheatstone-shield-amp-lcd

I don’t know anything about robot so how i learned and to develope the robot for some mechanical work…
Give me a full detail of arduino and robot programme and its parts working also assemble of robot.

@GOKUL That is not something we can provide here. You need to either get a formal education (college / university), or teach yourself using books / projects. https://www.robotshop.com/en/books.html

hi, please connect to me for robotic question

@emtiyaz If you have design related questions, feel free to post a new topic on the RobotShop Forum

I get this error message when I try to upload the program on the arduino software:
C:\Users\Mattias\Documents\Arduino\libraries\Wheatstone-Bridge-Amplifier-Shield-master\Examples\strain_gauge_shield_and_lcd_arduino_uno_code\strain_gauge_shield_and_lcd_arduino_uno_code.ino:102:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

How do i fix this?

@Mattias Evans: We compiled the example with a fresh install of the Arduino IDE 1.6.7 and a copy of Wheatstone Bridge Amplifier Shield library and did not receive any warning or errors. If your Arduino IDE is not up-to-date, we recommend that you update it now.
Also, you may want to check this page and search for -Wwrite-strings on it. It describe the use of this warning, which is off by default for C but on by default for C++. Please note that you can simply disable or ignore this warning as it is not an error.

I can’t ignore these messages as it states that there is a problem uploading to board.

@Mattias: Blog comments are not the best place to answer complex technical issues. Please post about this on our forum here or open a support ticket here.

Any advice on this error message?
Imgur

@Raji It seems like you need to add a specific library; look for it on the Arduino website.

@ColemanBenson I have the same error but I can’t determine what is missing or wrong. Do you have any idea of what I have to installed?

@Luc What error exactly? If it’s the same as Mattias Evans, please see @scharette’s solution.

@ColemanBenson Not the same as Mattias Evans but the same as Raji: error ‘unknown type name ‘LiquidCrystal’’ on the line ‘extern LiquidCrystal lcd;’ I have opened an issue on the github’s repository (https://github.com/RobotShop/Wheatstone-Bridge-Amplifier-Shield/issues/)

@ColemanBenson In fact, I have found the error. In the example of the library, the ‘strain_gauge_shield_and_lcd_arduino_uno_code’ directory contains a ‘.c’ file. To obtain a correct compilation the extension must be change to ‘.cpp’.

@Raji, Luc: Thank you for reporting this error. A fix has been added to the GitHub (renaming to .cpp).

EDIT Comment was moved to the forum of RobotShop due to its length and technical nature. It can be found here: https://www.robotshop.com/forum/wheatstone-amplifier-shield-lcd-issue-arduino-zero-t14987.

@Lawrence: We have answered your comment on our forum (post here). Please note blog comments are meant for small clarifications of details in the article. For integration issues or other troubleshooting, please use our forum. If you received a defective part or have other complex issues, you can open a support ticket here.

You use A1 and Strain2 in the example above. The LCD shield does not seem to use A0 so would it be possible to use a switch to connect either A1 or A0 to A5 as required to show the output of both Strai 1 and Strain2, not simultaneously of course.

@Bill the 16x2 LCD Shield Kit for Arduino uses the A0 pin for buttons. That’s why we used the “bent pin” workaround to connect A0 (from the LCD Shield) to A5. With this hack, you still have access to Strain 1 and Strain 2 (A0 and A1).