Has anyone created a project with these load cell amplifier modules? Easy to use

Blazemaguire

Senior Member
Hi,

http://www.ebay.co.uk/itm/Weighing-Sensor-AD-Module-Dual-channel-24-bit-A-D-Conversion-HX711-Shieding-UK-/301751495614?hash=item4641ca6bbe:g:xpgAAOSwRLZT4jjm

Just wandering if anybody has used the above with a PICAXE. (I've ordered one, but it will be a while before I find time to play).

It appears to read a load cell, presumably as part of a wheatstone bridge configuration, amplifier the resistance / voltage change and output a value.

As usual with ebay stuff, datasheet is hard to come by, but sparkfun seem to do a similar module with more info https://www.sparkfun.com/products/13230

Just wandering if anybody has successfully created a project based around this using a PICAXE? I have an A-Level systems student wishing to use one in the near future & just want to wrap my head around it first so I can assist when he inevitably gets stuck. He want's to create a coin weighing/sorting system.

Any feedback greatly received.
 

SAborn

Senior Member
Yes I have used the HX711 boards from China with load cells and they are simple to use and work rather well.

The easy way to use them with picaxe is to read in the 24 bits of data in 3 bytes then select 2 of the bytes to use as a word for the weight, this gives a good range and works well enough for most weight applications.
 

binary1248

Senior Member
If it comes with the load cell, where is the specs on the load cell, like maximum pressure. Or did I miss something ?
 

Blazemaguire

Senior Member
It doesn't come with the load cell. That little metal square is an RF shield that fits over the pcb. I know because my student has his already and we both thought the metal part was a matched load cell! Thanks Saborn. Glad to hear it sounds straight forward.
 

SAborn

Senior Member
To give a bit more information on how i used the HX711 and various other 24 bit chips with load cells.

To use the full 24 bits with a picaxe is somewhat a pain and not always required, so if we break the 24 bits into 3 bytes, a low byte, a mid byte and a high byte, then we can select to use any of the bytes each side of the mid byte, Eg: low and mid byte to make a word, or mid and high byte to make a word.

The reason is all dependant on the load cell in use, for example a 5Kg cell will give a lot of jitter in the readings if the low and mid byte is used, but very stable if the mid and high byte is used.
Then a 500Kg cell will require the low and mid byte to be used to get a reasonable scale reading.

Its all about what you want to read and the resolution of the readings, then how much jitter in the readings you will except.
I hate a display ranging between numbers so choose to except the lower resolution reading to get a stable display, even then it is still able to read to less than a gram on a 20Kg load cell.

As a foot note, almost all full bridge load cells i have worked with, operate between 0-20mA full scale of the rated capacity, meaning a 5Kg cell will work between 0-20mA for the full range, and a 500kg cell will also work between 0-20mA full scale, this is why the resolution changes between different applications and different cells used.

Its been a while since i used the HX711 and i have a "HX711 test " code in my files, although i dont remember if it is fully functional, but it should give you be basics of how to read data from the chip.
The data out was intended for a VB program so hence the qualifiers used in sertxd.

At the very least it will show you how to clock the 24 bits from the HX711chip in 3 byte blocks.

Code:
#picaxe 08m2

setfreq m8

symbol low_byte =		b3
symbol mid_byte =		b0
symbol high_byte =	b1

symbol Y =			b10
symbol X = 			b11
symbol bitCount=		b12
symbol z = 			b13

Symbol DIN_PIN = 		pinC.3
Symbol CLK = 		C.2

symbol value_1 =		w0
symbol value_2 =		w1

main:
	
Read_weight:
	
	for z = 0 to 3
	
start:
	
	if DIN_PIN =1 then start   '
	
	low_byte=0
	mid_byte=0
	high_byte=0


	For bitCount = 0 To 7
  	PulsOut CLK, 1
  	high_byte = high_byte * 2 | DIN_PIN
	Next


	For bitCount = 0 To 7
  	PulsOut CLK, 1
  	mid_byte= mid_byte * 2 | DIN_PIN
	Next


	For bitCount = 0 To 7
  	PulsOut CLK, 1
  	low_byte = low_byte * 2 | DIN_PIN
	Next

	PulsOut CLK, 1
 	
	next z

	b2 = b0

 Screen:


sertxd ("<W1>", #value_1,   "</W1>", cr,lf) 
sertxd ("<W2>", #value_2,   "</W2>", cr,lf) 


	goto main
 

binary1248

Senior Member
It doesn't come with the load cell. That little metal square is an RF shield that fits over the pcb. I know because my student has his already and we both thought the metal part was a matched load cell!
.
Maybe your student can buy one of these and strip it apart for the load cell. Don't know what the load cell is in this but I am tempted to buy a couple just to take it apart.:p
.
. Just ordered two, one to use, and one to take apart.
.
http://www.ebay.com/itm/0-01g-200g-Gram-Mini-Digital-LCD-Balance-Weight-Pocket-Jewelry-Diamond-Scale-/140977917179?hash=item20d2f04cfb:g:IqoAAMXQ-3NRlZa~
 

Blazemaguire

Senior Member
Thanks saborn, that will really help with starting the process. I'm still not a master in picaxe programming, but I can pick apart and adapt existing structures so appreciate you taking the time to share your findings and code. @binary. That scale looks ideal for the purpose my student has in mind (weighing coins) hadn't thought about hacking a current scale, but I guess it's the same principle inside and probably works out cheaper as well.
 

binary1248

Senior Member
Well Blaze, mine arrived today and it is really nice unit. Are you still interested in this unit for your student. I will start to take it apart and post pictures and descriptions.
IMG_0105.JPG

Here it is with a U.S. dime.
IMG_0106.JPG
The two screws in the back release the load cell itself and the attached platform.
 
Last edited:

binary1248

Senior Member
IMG_0107.JPG

The two screws in the back release the load cell itself.
IMG_0108.JPG
.
The load cell has 4 wires attached, black, red, blue and white.
This appears to be some sort of strain gauge set up.
One end of the beam is attached to the scale platform, the other end (the two screws that released the assybly) is firmly attached to the case.
There is a sensor glued to the top and one glued to the bottom, one to stretch, the other to compress, which make for a great bridge type sensor setup (differential). Also explains the 4 wires, two for each strain gauge.
The glue is a white flexible like rtv, but that may be just a protective covering.

Hope you find this interesting, I will further disassemble later.
 
Last edited:

binary1248

Senior Member
Well, I went ahead with disassembly. Since it is a single chip under a blob of epoxy, not much can be learned from the circuits. Several surface mount resistors, but that's all we can measure.
IMG_0112.JPG .
The white thing is the led backlight assy, the brown thing is the LCD which connects to the board by a z strip, still attached to the LCD glass in the picture.
.
.
WARNING: Reassembling with the back light and LCD is a real challenge, I started breaking those tiny wires trying to get the Z strip and board to work correctly. Still don't have it back together. Good thing I bought two.
.
.
Blaze, if you want this unit I will send it to you, as is, disassembled and broken, and you can use the load cell.
 
Last edited:

SAborn

Senior Member
I am unsure why you would want to go to all the trouble and cost, when you can buy a load cell from China to suit your weight requirements for very little.
Every cell I purchased from china has worked as expected.
 

binary1248

Senior Member
Pkg is on it's way.. Tell us a little about this student project. Is it your child or are you a science teacher ?
.
.
EDIT:
The unit is sent some what disassembled as described above. For the project I would leave the platform attached to the beam, the other end of the beam has two loose screws, this would attach to the fixed base of whatever your student is building. So then the four wires (two for upper strain gauge, two for lower) need to go to some sort of bridge and on to signal conditioning such as a differential op amp.
Paul
 
Last edited:

Blazemaguire

Senior Member
I'm a design and technology teacher. Engineering, Electronics and systems and control at A Level. I guess in the states the equivalent is called 'shop'. Not a science teacher. I have students who like to do pretty ambitious projects and I don't like to repress their ambition. I've got a whole bunch of projects they're doing this year at A Level. Sun tracking solar panel,' blind football' assist, electronic gear shifter for downhill mtb, two hexapod robotd, a line following package delivery system, automatic dog food dispenser, automatic dog ball thrower, electronic bubble making machine with custom speed, electronic safe with RFID key fob entry... I've had quad copters and animatronic faces in previous projects.

I love the teaching, and the subjects going from strength to strength. Apart from the exam boards/government have now killed off my electronics GCSE and my A Level subjects so unsure of the future!
 

Blazemaguire

Senior Member
Sorry... I should add, this student is not my child! Mine is two next week, so I'm still doing basic circuit theory with him at the moment.... Ohms law, resistor colour codes.. ; )
 

grim_reaper

Senior Member
I love seeing the look on people's faces when I casually drop ".. so I had to go back online and get an orange-orange-yellow resistor.." and my 9 year old daughter chimes in with "You mean a 330K daddy; you don't say the colours!"

(I do it just to test her, I'm not weird... lol)
 

Jeremy Harris

Senior Member
I read the post by SAborn with interest, as I've just acquired a few of these HX711 boards (the cheap Chinese ones), together with some equally cheap 0.4 bar max MEMS pressure sensors. In getting these to work well, I found that using the "B" inputs on the HX711 boards gave better results, because of the lower gain (32, versus the programmable 64 or 128 for inputs "A").

This is my adaptation of the code, with lines that can be commented out to select which inputs to use and what internal gain to set.

Code:
read_pressure_sensor:
	
	for loop_count = 0 to 3
	
start:
	
		if data_pin = 1 then start					;data pin is low when ready to send data, high when not ready, so loop back if not ready
		
		low_byte=0								;ensure data bytes are all zero
		mid_byte=0
		high_byte=0


		for bit_count = 0 To 7						;clock in the 8 bits of the high byte
  			pulsout clock_pin, 1					;send a 10µs clock pulse to the HX711
  			high_byte = high_byte * 2 | data_pin		;add the data from the HX711 to the byte, shifting bits by multiplying by 2 and OR'ing
		next									;note that the "|" instruction is a bit-wise OR

	
		for bit_count = 0 To 7						;clock in the 8 bits of the mid byte
  			pulsout clock_pin, 1
  			mid_byte= mid_byte * 2 | data_pin
		next

	
		for bit_count = 0 To 7						;clock in the 8 bits of the low byte
  			pulsout clock_pin, 1
  			low_byte = low_byte * 2 | data_pin
		next

			pulsout clock_pin, 1					;send 25th clock pulse (stop here would set input A gain= 128)
 			pulsout clock_pin, 1					;send 26th clock pulse (stop here would set input B, gain = 32)
 			;pulsout clock_pin, 1					;send 27th clock pulse (stop here would set input A, gain = 64)
 	 		 
 	next loop_count

;at this point the 24 data bits from the pressure sensor A/D are stored as three bytes, high, mid and low bytes respectively
In the above case I've stopped at the 26th clock pulse, which switches the board to use inputs "B" at a gain of 32.

It's also worth noting that the output is 2's complement, so the most significant bit is the sign bit. There are plenty of examples already posted here about handling 2's complement numbers, so I won't add to them, but it's important to note that if you are using a pressure transducer or strain gauge bridge the chances are you may well have a fixed offset from the tolerance of the bridge, and this could be negative or positive, so any zero'ing method has to take account of the sign bit.

As mentioned above, it's not likely that all 24 bits would be needed. In my case I've found that the MPS20N0040D-D pressure sensor I'm using seems fine with just the most significant byte and the middle byte, with the gain set at 32 using inputs B. I'm getting at most +/- 2 digits of variation on a 16 bit word, with no pressure variation. I only want to display pressure to a resolution of 0.01 bar, so am reducing a full scale reading of somewhere around 30,000 down to the max reading of 0.40 bar, so there is no apparent "noise" on the processed output at all.

These boards are overkill for an application like mine, but they are so cheap and easy to use with a Picaxe that they are easier than messing around with using a differential amplifier and an analogue input.
 

SAborn

Senior Member
the chances are you may well have a fixed offset from the tolerance of the bridge, and this could be negative or positive, so any zero'ing method has to take account of the sign bit.
Or you could reverse the power supply to the load cell (swap + / - around to the cell) and make a negative offset become a positive offset from the cell.
Its often easier than programming for both offsets.

They are a great little interface board and offer many uses to high gain data input to a picaxe.
 

Jeremy Harris

Senior Member
Or you could reverse the power supply to the load cell (swap + / - around to the cell) and make a negative offset become a positive offset from the cell.
Its often easier than programming for both offsets.

They are a great little interface board and offer many uses to high gain data input to a picaxe.
I could do, except I'm making a batch of four of these, so have made up a PCB, with the pressure sensor fitted to the board. I've dodged the offset issue by simply detecting the sign bit and flipping the bits accordingly if it's present, adding 32768 if the sign bit isn't present. That way I have zero at a nominal 32768 (in practice it can be +/- about 4000 from this due to the tolerance of the MEMS sensor) and full scale positive pressure at a nominal 65535. In practice, the sensor runs out of headroom before this. I'm only interested in positive pressure (the application is for a remote alarm for a sewage treatment plant aeration pump), so I can just calibrate the offset using a removable link on a spare Picaxe pin. If the unit powers up with the link present, it goes to calibration mode and measures and stores the zero offset value (typically between 28000 and 36000) in EEPROM. In normal operating mode, with the link out, the code reads the EEPROM stored offset at power up and uses that for the nominal zero point (it just subtracts that value from the reading to leave the positive pressure reading).

I can see these boards have a number of other uses too, as they seem to have really good performance, are dead easy to interface to a Picaxe and offer a 24 bit A/D converter that could easily be used for applications other than with a load cell or pressure sensor bridge. Definitely a good find.
 
Last edited:

hippy

Technical Support
Staff member
I have the same question as yours
It's not clear what that "same question" is. If it is "has anyone used these?" then the answer appears to be "yes". If it is something else then stating it explicitly will best help people respond.
 
Top