Connect load cell to Pi


30 posts   Page 1 of 2   1, 2
by koffie » Tue May 07, 2013 8:27 am
Hi all!
My first introduction as the most of us here: I have little to no knowledge about electronics. I'm learning, but it is all new for me.
Right now I am working on a project for domotica. My project is allready 'in production': I can turn on and off the lights in the living room and can control the central heating based on the temp from a DS18B20 (and desired temp for that moment read from a DB) by switching a relais.

Now I'm starting a second project: I want to measure weight :)
I have ordered 2 Load Cells from ebay (Parallel Beam Load Cell Sensor 50kg/110lb with Shielding Cable : http://www.ebay.com/itm/181118181076?ss ... 1423.l2649).

As I understand, you can't connect a load cell directly to the Pi due to 2 problems: first u need an amplifier to boost the the signal from the load cell, after that you need an ADC as there are no analog inputs on the Pi.

My plan is to combine 2 project examples: http://www.instructables.com/id/Arduino ... ell-Scale/ and http://learn.adafruit.com/reading-a-ana ... -a-mcp3008
The instructables link gives me the information about connecting a load cell to a amplifier (http://www.ti.com/lit/ds/symlink/ina125.pdf) and the adafruit about connecting a ADC to convert analog signals (from the amplifier) to digital signals.

My biggest concern right now are the voltages.
The amplifier can take between 2.7v and 5.5v as input, the ADC can handle between 2.7v and 36v as input.
So it would be no problem to use 3.3v as input for all components?

The ebay page for the load cell says "Excitation Voltage(V):9-12VDC". Does this mean i should power it with a voltage between 9v and 12v ?

Can someone push me in the right direction about what voltages I need to use?
Posts: 5
Joined: Tue Mar 26, 2013 6:03 am
by Ravenous » Mon May 13, 2013 11:52 am
Just saw this quite old post, hope I'm not too late.

I believe the excitation voltage is just the maximum that should be applied, or a guide to the recommended voltage. It might still work with a lower voltage but you might not get very good precision. (Low voltage certainly won't harm the cell by the way.)

Have you done any analog electronics before? With load cells you're typically measuring extremely small voltages, you need a sensitive amplifier and a reasonably good, clean power supply. The only time I ever built something liike this I bought a nice amplifier circuit kit and soldered it up; I'm not qualified to design this sort of thing myself, not at that level.

Oh - be careful not to overload the cell, i.e. apply more than the maximum weight. Ever. I have negative experience of this sort of thing. :oops:

Good luck!
Posts: 1228
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK
by Pieter-Jan5000 » Tue May 14, 2013 9:16 am
koffie wrote:My biggest concern right now are the voltages.
The amplifier can take between 2.7v and 5.5v as input, the ADC can handle between 2.7v and 36v as input.
So it would be no problem to use 3.3v as input for all components?

If you want to use the ADC with good results, you want your input signal to be as close as possible to the reference voltage of the ADC. This is mostly VCC, but you can change this. This is done with the amplifier. So you have to make sure that the maximum signal coming from the load cell amplified by the amplifier is as close as possible to the reference voltage of your ADC.
http://www.pieter-jan.com/
Posts: 37
Joined: Tue Jun 12, 2012 7:20 pm
by abelltx » Fri Jul 19, 2013 2:47 am
I am new to this, I and I want to use a Pi for weight sensing. I still havn't found a solution for all the analog stuff. In fact, I haven't found one page that shows someone making this with a Raspberry. Every site I found used an arduino. Any help would be appreciated.

Adam
Posts: 3
Joined: Fri Jul 19, 2013 2:44 am
by hawkphil » Sun Jul 21, 2013 5:53 am
I am very interested in this topic as well. I have an idea to use this to detect pets moving to a certain area by placing the sensor below that area.

Is there any weight or load sensor that connects to the USB instead?
Posts: 4
Joined: Sun Jul 21, 2013 5:51 am
by joan » Sun Jul 21, 2013 8:59 am
Wouldn't a pressure mat fit your purpose? Much easier to interface as it's in effect a switch.

http://www.ebay.co.uk/itm/380475325118
User avatar
Posts: 4186
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by hawkphil » Sun Jul 21, 2013 9:07 am
Pressure mat is interesting idea. How to program it to have 3 seconds for activation though? So for my special case, the pet running around all the time and I only want to detect when she stands still for 3 seconds.
Posts: 4
Joined: Sun Jul 21, 2013 5:51 am
by joan » Sun Jul 21, 2013 9:15 am
hawkphil wrote:Pressure mat is interesting idea. How to program it to have 3 seconds for activation though? So for my special case, the pet running around all the time and I only want to detect when she stands still for 3 seconds.

That's a straightforward software task (even if you can't program).
User avatar
Posts: 4186
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by abelltx » Sun Jul 21, 2013 12:52 pm
The pressure pad is a great idea, but wont work on my project idea. I am wanting to weigh my beehive. The majority of sites I found said to use this load sensor:
http://www.karlssonrobotics.com/cart/lo ... 7AodBE8Ang

That seems to be about right for my job. I am not sure how to mount it either. I have a big square that another square sits on. So do I have 4 of them? That's a little too much weight detection, but I need that layout idea (I think, I am opened to other ideas).

This sensor is analog, so after a little more research I found this:
http://www.adafruit.com/products/856

I suppose now I just need to follow the wiring, but then I am clueless to the software side of it. Any help would be appreciated.
Posts: 3
Joined: Fri Jul 19, 2013 2:44 am
by hawkphil » Sun Jul 21, 2013 9:52 pm
joan wrote:
hawkphil wrote:Pressure mat is interesting idea. How to program it to have 3 seconds for activation though? So for my special case, the pet running around all the time and I only want to detect when she stands still for 3 seconds.

That's a straightforward software task (even if you can't program).


Well pressure mat doesn't have any API or does it? Can't find any doc around it.
Posts: 4
Joined: Sun Jul 21, 2013 5:51 am
by joan » Sun Jul 21, 2013 10:15 pm
A pressure mat is a switch as far as the Pi is concerned.

You'd connect one of its wires to Pi ground or 3V (depending on whether you wanted 1 to mean on or off) and the other wire to a Pi gpio. You'd then read the gpio (pick a programming language, it'll have a method to read the gpios) to determine if it's currently on or off. The software would loop and regularly check the switch state. On a change from off to on it would record the start time. If it is still on in three seconds it would record pet settled.

Have a look through http://themagpi.com for similar ideas.
User avatar
Posts: 4186
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by hawkphil » Sun Jul 21, 2013 10:30 pm
You're right. So I was looking at this (since I am in US)

http://www.ebay.com/itm/Large-Pressure- ... 588232cb8e

Honestly I am a software guy (Linux + node.js). So how do I turn these into USB connector though!?

There are 2 sets of connections on the pressure mat.

The outside 2 wires are for the tamper circuit and are used only on an alarm system. If this connection is not needed then disregard these 2 wires

The inner 2 wires are the alarm connections. They work in a similar way to a door bell switch. A circuit is made when the mat is stood on.
Posts: 4
Joined: Sun Jul 21, 2013 5:51 am
by joan » Mon Jul 22, 2013 9:00 am
The USB protocol is rather complicated and I don't really see the point of trying to convert a switch to a USB type interface. It's much simpler to attach the wires directly to the gpios on P1 (current limiting resistors, say 1K+, in series would probably be sensible).

See http://elinux.org/Rpi_Low-level_peripherals

p.s. unless you have specially gifted pets you can ignore the tamper wires.
User avatar
Posts: 4186
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by tenochtitlanuk » Mon Jul 22, 2013 12:19 pm
If I wanted to measure the slow small changes in the weight of a hive I'd hang it on a spring ( probably preloaded to the empty hive weight) and measure the extension by a variable resistor or optically. Since Hooke's Law says stress proportional to strain, PI could easily read it. Gert board, PiFace or I2C A2D....
If you want high precision, you could place the hive on a domestic weighing ( digital) scale. Pi +PiCam could snapshot the scale at regular intervals. Could even OCR the scale ( I've shown this on another post) You'd probably have to first add & subtract an extra load to trigger the balance- most turn themselves off after an interval.

In the past I've wired and interfaced load-cells. My view is that it is a very roundabout way to do what you want. And pressure pads make cheap all-or-nothing sensors, but are useless for analog precision or repeatability.

Reminder to self. Make a plant-weight detector & use Pi to time-lapse the growth next year of a tomato plant & it's growth in mass.... that'll be ANOTHER Pi tied up for a few months...
Posts: 89
Joined: Fri Jul 06, 2012 8:51 pm
Location: Taunton, Somerset, UK
by abelltx » Mon Jul 22, 2013 1:06 pm
I will have about 20 of these or so and I need the data pushed hourly, so I need to make a system that is cost effective and practical. I can't suspend an 80 pound box. I really just need it to stand on sensors and measure weight consistently.
Posts: 3
Joined: Fri Jul 19, 2013 2:44 am
by btidey » Mon Jul 22, 2013 6:07 pm
What about using a Wii Fit as the weight measuring sensor? Has the front end all built in, runs on batteries or could be replaced by mains power, and you can collect the data via bluetooth. There's lots of material available on how to do that. I've done it into a PC but should be easy to move to a Pi.
Posts: 178
Joined: Sun Feb 17, 2013 6:51 pm
by PiGraham » Mon Jul 22, 2013 6:39 pm
Posts: 733
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville
by koffie » Tue Oct 29, 2013 9:20 pm
Huge kick ;)

Today I finally received all my parts with a big delay.
I connected the INA125 according the schema in http://www.instructables.com/id/Arduino ... ell-Scale/ and http://cerulean.dk/words/?page_id=42 (exception: I used the RPi 3.3 volts) after that I connected the Analog out to the MCP3008 and connected the other wires of the ADC according to http://learn.adafruit.com/reading-a-ana ... -a-mcp3008

After that I fired up the sample python script from the adafruit lesson and watched the values. I learned that the default value is somewhere 600 and 5 kg is 650. Putting something like 20 kg gives me a low value: 16
I guess the input voltage is still to low? Is it safe to use the 5volt from the RPi, or even higher?
Posts: 5
Joined: Tue Mar 26, 2013 6:03 am
by SteveDee » Sat Nov 02, 2013 7:42 am
koffie wrote:Huge kick ;)...After that I fired up the sample python script from the adafruit lesson and watched the values. I learned that the default value is somewhere 600 and 5 kg is 650. Putting something like 20 kg gives me a low value: 16
I guess the input voltage is still to low? Is it safe to use the 5volt from the RPi, or even higher?


This looks interesting. I spent many years in industry working with strain-gauge loadcells; from conveyor systems measuring packs of peas, to cranes lifting tonnes.

If you need reasonable accuracy, you will have to deal with two problems; electrical and mechanical stability.
The electrical problems stem from the loadcell only delivering 2mV per volt drive (excitation). You need a very stable supply for this. Check the spec, then choose a voltage high within the range(e.g. probably 10V).

At 10V drive you will get an output of 2mV x 10V = 20mV at full scale load (i.e. the rated capacity of the loadcell). Or looking at this another way, 2mV at 10% full scale load. So you can see that your drive voltage and your high gain amplifier need to be very stable; any drift in supply due to (say) temperature change will give you a change in weight reading.

The mechanical issues relate to how you present the load to the loadcell(s). You need to resolve forces due to your load vertically.

I'm happy to expand upon this and also explain how the loadcell works if this is either useful or interesting to you, just let me know.
Posts: 126
Joined: Thu Dec 29, 2011 2:18 pm
by Clemens » Sun Nov 10, 2013 12:32 am
I have this load cell a

Bosche H30A
- http://uk.bosche.eu/product.php?prodid=805
- Rated Output / Sensitivity 2,0 mV/V

and thought it is a good idea to use a

ADS1115 as ADC (16bit)
- http://learn.adafruit.com/adafruit-4-ch ... s/overview

I thought the internal gain amplifier of the ADS1115 would be enough. But after reading this posting http://forums.adafruit.com/viewtopic.php?f=25&t=42455 I doubt that this is sufficient and I need an additional OpAmp (e.g. INA125P)?

There is also example code for the RasPi https://github.com/adafruit/Adafruit-Ra ... ython-Code
Posts: 1
Joined: Sun Nov 10, 2013 12:21 am
by SteveDee » Sun Nov 10, 2013 5:44 pm
Clemens wrote:...I doubt that this is sufficient and I need an additional OpAmp (e.g. INA125P)? ...


Yes the INA125 looks like a good choice.

Its quite easy to work out the system gain that you require. Here is an example:-
Lets say you have a 15kg loadcell rated at 2mV/V, and you drive it with 10V.
The fullscale output is 10V x 2mV=20mV (that is 20mV when you fully load the cell to 15kg).

But lets assume you only want to weigh items up to 5kg, and your weigh platform (the bits that you rest your load on) weighs 1kg.
The maximum output from your loadcell will now be 20mV x 6kg/15kg=8mV.

Now, if your A to D converter maximum allowable input voltage was (say) 5V, the gain required from your preamp to produce 5V would be:-
5V/0.008V=625

However, you might want to allow a small margin for overloads (loads a bit above your 5kg maximum) so maybe reduce the gain to (say) 600. For 5kg + platform (1kg) this will give an output of:-
8mV x 600 = 4.8Volts

If you run your system with a much lower gain it will still work, but to get the best resolution from your A to D converter you need to use as much of the A-D input range as possible.

Hope this helps.
Posts: 126
Joined: Thu Dec 29, 2011 2:18 pm
by GPA » Mon Nov 11, 2013 6:44 pm
Hi,

I have implemented several load cells on a Pi
I am using a MCP2434 for the analog to digital part

This chip is perfectly suited for such application
- I2C interface with Pi
- build in amplifier
- differential inputs
- 4 channels
- few $ only !

I just connect the MCP2434 to the Pi (5V supply + I2C) and the weight sensor(s) to the MCP2434 : extremely simple HW !

Then a few python lines of code and that's it !!

GPA
Posts: 1
Joined: Mon Nov 11, 2013 6:34 pm
by dartfrogdk » Thu Nov 21, 2013 3:28 pm
Hello GPA, could you expand a little on how you implemented the load sensors, and the code, plz PM me
Posts: 1
Joined: Thu Nov 21, 2013 3:25 pm
by billstewart61 » Sun Dec 01, 2013 11:56 pm
Hi GPA,

Can you send me details of your load sensor setup? I trying to do this and would like to understand hardware connections and python code samples. Thank you.
Posts: 1
Joined: Sun Dec 01, 2013 11:53 pm
by jackoc » Tue Dec 10, 2013 9:32 pm
Hello, I am extremely interested in connecting a load cell to any existing Debian based desktop OS. Jack H.
Posts: 1
Joined: Tue Dec 10, 2013 9:25 pm