In my quest to make a Raspberry Pi controlled bed monitoring device for bed bound patients, I’ve so far made a moisture sensor and a weighing mechanism that employs the use of a compression load cell. The load cell output needed converting into a digital input using an aAnalogue- to- digital converter (ADC) , which I covered in my previous post. Now, before I even convert the analogue signalit, I want to amplify it. Without amplification, the difference in voltage readouts when applying a range of pressures was tiny. Only a change of 0.042 v when I’d tightened the clamp as much as my pathetic upper body strength could manage.
This tiny voltage change per Kilo of pressure would make the resolution when it came to converting the voltage into a physical weight low, and therefore inaccurate. Meaning instead of being able to say, “The compression cell reading is X volts, so that means the patient weights X kilos”, I would only be able to say “The compression cell reading is X volts, so that means the patient weights between X and Y kilos”. If I can amplify the signal from the compression cell to get a greater range of output voltage values, I can be more accurate in converting that voltage to a weight. To amplify it all is need is an Instrumentation amplifier. Simple. Right? This is the part I thought I had in the bag —, I’d done entire modules on amplifiers as part of my HND —, and since I’d managed to make a moisture sensor from a single transistor, I’d never done anything to with load cells and I managed that. How wrong I was! but I learnt a valuable lesson, trust the data sheet not the Internet. She says, putting this in the internet. However, hopefully this will save you the hours of my life I can never get back.
The INA125P is a 16 pin instrumentation Amplifier with a single supply voltage of 2.6-36v, well suited to my Raspberry Pi 3.3v and 5v supplies. It has an operating temperature of -55 to 125 degrees Celsius, again excellent for what I need, and the use of one external resistor could set the gain from 4-10,000. An excellent choice, but now I had to build the circuit. Cue dramatic da da daaaaaaa!
This was the hair tearing out part. I had settled on using the INA125P and so I looked for inspiration on the Internet, at other people’s circuit diagrams and I found that nearly everyone was using the same configuration. Statistically, that was some good odds, so I gave it a go.
At first I thought my troubles were all down to the resistor values. I looked at the data sheet and checked the gain formula. It was given as Gain = 4+60kΩ/R. With a 10kΩ resistor I should have a gain of 4+60,000/10,000=6.0004, or with a 10Ω I should get a gain of, 6+60,000/10=6004. However, in practice, I was getting nothing but an amplification of my stress levels. I tried so many different valued resistors I had the Everest of resistor mounds piled up next to the circuit. I went back to the Internet and found that a lot of people using this circuit were having trouble with the INA125P, with one website I’d looked at previously having even scrapped it in favour for another and updated the tutorial based on the new amp. I didn’t want to abandon the little fella too, so I went back to basics. I read the data sheet to check I had the pin out correct, I checked the gain formula again and then I spied the diagram of a model circuit in the corner. Though it beared a resemblance to the one in front of me, it had a few small differences. The circuit from the data sheet can be seen below.
Pin 15 and 4 aren’t connected for a start, and there were a few other tweaks to make. Below you can see the Fritzing breadboard layout with the 10Ω resistor I found worked best. The red and black wires being the amp’s power source voltage and ground, and the yellow wire being the output form which I will get the voltage value to then convert into a weight.
And below is the physical circuit I built.
I used a bench top power supply set to 3.3v to mimic the power supply that will be sent from my Raspberry Pi to power the INA125P, I then attached a multimeter to my output to obtain a value and I read that off, a value of 0.05472v
I then tightened the clamp and crossed my fingers for an improvement on the puny 0.04v change I got without using an amplifier
2.54187v!! Once I’d finished doing my celebration dance, I worked out that this was a 2.48715v change, a lot more useful at helping me give an accurate weight read out.
Putting it all together
My plan is now to combine the circuits together: the compression cell voltage will be amplified by the INA125P, that will go into the MCP3008 ADC, with data that will then be sent into the Raspberry Pi, thus completing the weighing side of the device. I will do this in the next few posts, along with adding the moisture sensor to create a complete device that can then write the information gathered from both input sensors to a comma separated file and spreadsheet. I’m pleased with how it is all coming together, hopefully the coding side will be as rewarding and exciting as the circuit side.