This post is also available in: Türkçe (Turkish)
- What is Load Cell?
- Technical Materials Required for Load Cell
- INA122 Amplifier Integration
- AD586 +5V Reference Integration
- Load Cell Circuit
- Doing Calibration
- RESULT
- Experiment Video
- References
- In this lesson we will see how to use a load cell.
- In order to use load cell INA122 and AD586 integrations are required, therefore we will also show their use.
- For Load Cell, we will have requirement for technical materials and as we go I will explain their purposes.
- Our goal is to know what we are doing first and to give you a basis in this matter. From this base you can set up much more sophisticated systems to get precise results.
What is Load Cell ?
- Load Cell is the force sensor. It gauges force.
- It’s an analogue sensor.
- Can also be found in weighing devices
- In short, in can be used in every field related to force.
- In general, there are sensitive resistances on the top and bottom surfaces, which generate microvolts by stretching and shrinking.
- In order not to avoid damage to these areas, care must be taken to avoid any impact on these areas during epoxy coating.
- Processes such as scratching of this area will cause the sensor to break down and the wires there are too thin to be re-soldered, and even if soldered, this will seriously affect the performance of the work.
- It can be made from Aluminum or Stainless steel body. After sensitive resistors are placed in proper spot, the tops are covered with epoxy and protected
- There are 5 ends in Load Cells(NOTE: Since it can change according to each manufacturer, I did not define it as color here, you can learn it from the load cell manufacturer)
- +5 volt input
- GND
- Data(-)
- Data(+)
- Grounding (to isolate the metal part of the sensor)
- NOTE: If the load cell heats up, the connections above are wrong, turn off the energy immediately, otherwise the sensitive resistors in the sensor may be damaged.
- S type L type, there are many types according to usage purpose and measurement range.
- As I mentioned above, the load cell generates microvolts which are not detected by this PIC, so they have to be boosted. We will use INA122 for this.
Technical Materials Required for Load Cell
- We need some materials to be able to use the Load Cell. We will see them below.
- You do not have to use the same materials, but you can understand the logic of their use here and decide for yourself what is appropriate for your project.
Calibration Weight
- Calibration weight is to use for calibration as understood from the name.
- This is a standard weight used in scales.
- There is no specific reason to choose 5kg, the sensor is 20kg and 5kg is suitable for me to carry it.
- There are also stainless ones that can be found as drachma in the market but it does not have a meaning other than being costly
- Note: Do not forget to leave the weights to the ground once you have used them. Be careful as it can break your bones if fell on your hand or foot, it will cause serious fractures.
Base Plate
- As you can see, the load cell stands on a large metal plate.
- Metal plates must be used in order to avoid loosening and failures in the connection points during operation. (Preferably st37 can be an option, but aluminum cannot be used as it is soft and easy to be crushed)
- I used it in 8 mm wall thickness. I did not make any calculation for this but it would be very useful if it is not very thin because this plate is exposed to the load.
- The width and height dimensions are up to you. Sensor may vary depending on the application type.
- If you want, you can also assembly foot under the base plate, this helps stand to be more balanced and stay even.
- If you paint the metal surfaces, you can use it for a long time without problems.
- You can supply this plate from places which offer the laser cutting, they may have small pieces, and if you get it cut over the plasma, it will decrease the cost.
Lifting Piece
- The load cell must flex under load to be able to operate. If you put it on the table directly, there is no possibility of stretching.
- For this reason, the load cell must be lifted from one side. You do not need to lift too much, it is enough for 4-5 mm.
- As seen above, the load cell is fixed with a cable and the load is connected to the other side.
- Two screws are used to fix it but since the body of the load cell is made of aluminum, do not over tighten the screws or else it will cause the teeth to deteriorate.
INA122 Amplifier Integration
- INA122 is indeed a very high quality professional integration.
- It amplifies the microvolts coming to itself and pulls to the level that can be detected by MCU like PIC.
- It works very constantly and is so accurate that it is used in devices that record signals such as heart devices, brain functions, etc.
- INA122 requires a negative (-) voltage to operate the load cell.
- In order to be able to measure properly, the reference voltage must be very constant for this reason, so we will use the AD586 + 5V reference integration
INA122 Pin Functions
Pin | Name | Function |
1 | RG | Gain Resistor. Calculation will be explained later |
2 | Vın(-) | Input of the (-) the load cell |
3 | Vın(+) | Input of the (+) the load cell |
4 | V- | -5volt input is made (Note: it is not -5v GND.) |
5 | Ref | INA122 reference. Connected to GND |
6 | Vo | INA122 data output. Goes to PIC. |
7 | V+ | Feeder + 5volt connected |
8 | RG | The other leg of gain resistor is connected here |
AD586 +5V Reference Integration
- +5v reference integration
- Noise is very low in this integration.
- Output voltage can be adjusted if desired
- When connecting to the circuit, the SOIC ->DIP converter can be used as above
AD586 Pin Functions
Pin | Name | Function |
1 | TP | No connection to be made |
2 | Vın | Feeding input – Max +36V can be given |
3 | TP | No connection to be made |
4 | GND | Connects to GND |
5 | Trim | Sets Output- 10k trimpot to be connected(multi turn) |
6 | Vout | Referance voltage output |
7 | TP | No connection to be made |
8 | P.A. | Connects to GND with 1 uf |
Load Cell Circuit
- To grasp the main logic of circuit:
- The microvolts from the load cell are amplified in INA122 and sent to the PIC.
- However, we use the AD586 integration as a reference because we want to get proper results in both INA122 and PIC ADC
- The cables must be soldered, even for trial purposes.
- INA122 can be plugged into the socket against the possibility of distortion.
- Load Cells are heavily influenced by mobile phones, so keep your mobile phone away from circuit during operation.
- Work with anti-static material (ie with anti-static wrist strap and over pad) since INA122 and AD586 are sensitive to static electricity
- Remember that INA122 also requires (-5V). GND is not minus voltage.
- Operating the system with battery power and sms power supplies will give more accurate results.
- Load Cell is not suitable for dynamic loads, so try not to hit it with a hammer and measure its strength.
- The load cell lasts up to 150% of its production capacity. It is physically resistant to 300% of its capacity. It breaks later.
- Since the AD586 output is at very low amperage, read the operating manual for it as it can not be used alone as a power supply.
- AD586 should be fed at least + 9v so that it can output properly.
Load Cell Circuit Scheme
- The calculation of the RG esistor will be described. This is the INA122 gain resistor. (Resistor Gain)
- The AD586 output should be connected to the INA122 input. At the same time, the AD586 output will be connected to the PIC external reference pin.
- Can be powered between AD586 +9/+36 V preferably using battery-side smps.
- Ensure that the load terminals of the Load Cell are correctly connected to the supply terminals
- Note that you need a negative (-) voltage if the power supply is used
Necessary Materials
Sr. | Name | Quantity |
1 | Load Cell | 1 |
2 | INA122 Integration | 1 |
3 | AD586 Integration | 1 |
4 | +5v/GND/-5v Power Supply | 1 |
5 | 10k Multi Purpose Trimpot | 1 |
6 | Rg Resistance to be Calculated | 1 |
7 | 1uf Elektrolite Condensator | 1 |
8 | 0,1uf Elektrolite Condensator | 1 |
9 | Pertinax | 1 |
10 | 1k Resistance | 1 |
Making Circuit
- In this section we will see how the circuit is made and necessary calculations.
- After we have done the calibration of the dynamics, our project will be completed.
Calculation of INA122 Rg Resistor Calculator
- Rg resistor INA122 is a gain resistor, so it is very important that we can go on the right path.
- The Rg resistor enables us to equalize the gain of the load cell with the desired measurement range
- I told that I have 20 kg sensor. I want to measure up to 18 kg, I will do my calculations accordingly.
- The calculation here should be made for every load cell, even if it is the same brand and model.
- First I connect the load cell’s data terminals to the gauge and I set the gauge to the millivolt setting.
- I also have +5 volts and GND connections to the load cell
- I put the 5kg calibration weight on the load cell and read the value.
- As you can see, it reads a value like 1,4 mV which is my load cell gain.
- Now we can come to the calculation step
- INA122 gives us the formula G=5+200K/Rg in the user manual.
- I used 20 kg sensor however I want to do 18 kg measurement max, therefore;
- for 5 kg if 1,4mV -> for 18 kg how much mV with the ratio in proportion I find the necessary peak point. 5,04 mV
- Thus, for 18 kg load cell gain is 5,04mV.
- Since I will use load cell between 0-18 kg, that gain will be between 0-5,04mV. With this way, we calculated the peak point.
- As we work with 5 volt 5000/5,04= 992,063 this is my gain for 5 volt.
- So if we put it in the formula
- 992,063=5+200K/Rg
- I take the 5 and minus it ->987,063
- I leave Rg alone -> 200000(we converted 200k into ohm)/987,063 = 202 ohm
- Approximately 202 ohm is resistance we have to use for INA122. Of course this is load cell and max 18 kg measurement
- As you can see, the values change according to sensor and sensor range.
- The measurement made with the voltmeter is unfortunately not very precise, so this calculation is important for giving us a resistance range, so we can wear a 1K multi-turn trimpot instead of RG in INA122. Therefore we have a chance to fine-tune
- The above calculations are given to explain the logic and calculation of Rg because in many circuits on the internet there are those who put the constant resistance on the side and the ones who put the trimpot on the internet, but it does not take you a step further unless you understand the logic of what you do.
Images From Circuit Setup
- As seen above, I set up the circuit on pertinax for trial purpose.
- Transfer with cables will always affect the result. For this reason, it should be installed on the PCB after you make sure to turn it off.
- Labeling can be a good solution to avoid mixing the pins
- I would recommend you to use vertical trimpots for the convenience of the circuit because a little adjustment is required
- AD586 circuit can be seen.
- As integration is SOIC type I integrated it with the help of the converter
- The condenser was used to eliminate interference
- Again, 10 k multi-turn steep trimpot has been added for this output setting
- AD586 outputs were made as 2 outputs because one is connected to the INA122 and the other to the external reference input for the PIC ADC
- Using as few sockets as possible between these parts will give better results. Soldering is always a more guaranteed solution.
- Between 9v and 36v feeding can be made.
Doing Calibration
- We need to make all the connections to make the calibration.
- Before starting to work, measure the outputs of the AD586 with a gauge so that the trimpot on the trimpot outputs 5 volts then no further adjustments will be necessary.
- By inserting a screen into the PIC, we need to see the ADC values read on the screen. This value will be calibrated.
- Since I use my own GLCD library I have SAP1024 functions and you can write on screen as you like.
Doing Proper ADC Settings for PIC
- The setting to be made may vary with each PIC. I use 18f4620 I made the settings accordingly
- First, INA122 pin must be an analog input, ie an ADC
- Also, as I mentioned earlier, the PIC’s reference will be an external reference, not its own, so I need to set the ADCON1 register.
- Let’s do the necessary coding according to the table above
void main() { unsigned int veri=0; char txt[15]; TRISA.RA0=1;//analog giriş yapacağım pin giriş olarak ayarlandı TRISA.RA3=1;//Vref+ girişi ADCON0=0b00000100; ADCON1=0b00010000; ADCON2=0b10100011; CMCON=7;//komparatörler kapatılı SAP1024_INIT(240,128,6);//kendi GLCD kütüphanemi çağırdım while(1)//sonsuz döngü kurarak sürekli okuma yapacağım { ADON_bit=1; GO_DONE_bit=1; while(go_done_bit); veri=(ADRESH<<8)|adresl; delay_ms(100);//çok hızlı hareket olmaması için bekleme ekledim inttostr(veri,txt);//veriti stringe çevirdim - MikroC Kütüphanesi SAP1024_YAZI_YAZMA(10,10,txt);//Veriyi ekranda yazdırdım } }
- I made the necessary adjustments as shown above.
- I’m going to measure continuously by entering into an infinite loop
- Under normal conditions, there may not be a need to wait here I added this wait to read the values more clearly
- Now let’s run the circuit and see the result
Calculations of Calibration
- If you get a fixed zero value like above, your circuit is in very good condition. But most of the time it will be shifted. You can edit them programmatically when the operation is finished.
- If the fluctuations are too much, replace the power supply with a good quality SMPS on the battery side, because the fluctuations are parasites coming from the network.
- Now the load cell is idle and reading zero
- 18f4620 is in 10 byte resolution and has ADC .
- 10 byte means -> 210 = 1024
- So if we think of the whole thing as a cake, this cake will be divided into 1024 pieces.
- In this case we have a new evaluation.
- The larger the range we want to measure, the lower the precision of measurement.
- So as the cake grows, the pieces will grow accordingly. If wanted to measure 5 kg instead of 18,
- 5 kg/1024 but now it is 18kg/1024. We should consider this when design is made.
- Now, considering 18 kg, the peak point is 1024 (0-1023) then if 18 kg 1023 -> 5 kg
- 284 is the result. So after putting the 5 kg calibration weight on the load cell, I need to adjust the trimpot on the INA122 and bring it to the reading 284.
- I made the necessary adjustments. Do not forget the weight is now on the load cell.
- With this way INA122 iwe have adapted the desired measurement range to the PIC in the ADC system.
- We go step by step as you can see.
- We will evaluate how precise we can measure at the latest stage.
- If I press on load cell until the end, I can see no more than 1023 values.Let’s examine this as well.
Calculating Read Value As gr
- The peak point is 1023 as seen above.
- Now let’s read the values in grams on the screen by calculating values are read per gr
- I stated before, there is 1023 values in 18 kg
- 1023/18000 = 0,056 which is our coefficient
- When we call 284/5000 for proof, the result is 0,056 so the calculation is correct.
- Let’s add this as code
void main() { unsigned int veri=0; char txt[15]; TRISA.RA0=1;//analog giriş yapacağım pin giriş olarak ayarlandı TRISA.RA3=1;//Vref+ girişi ADCON0=0b00000100; ADCON1=0b00010000; ADCON2=0b10100011; CMCON=7;//komparatörler kapatılı SAP1024_INIT(240,128,6);//kendi GLCD kütüphanemi çağırdım while(1)//sonsuz döngü kurarak sürekli okuma yapacağım { ADON_bit=1; GO_DONE_bit=1; while(go_done_bit); veri=(ADRESH<<8)|adresl; delay_ms(100);//çok hızlı hareket olmaması için bekleme ekledim //bölme işlemi aşağıda yapıldı inttostr((veri/0.056),txt);//veriti stringe çevirdim - MikroC Kütüphanesi SAP1024_YAZI_YAZMA(10,10,txt);//Veriyi ekranda yazdırdım } }
- Above, I just wanted it to show the data divided into 0.056 in “inttostr” section. This is the only change.
- When I put a weight of 5kg I did a reading like above.
- As I have always said, feeding and reference are very important if they are of high quality, you can make very precise measurements.
- I pressed again to the load cell again as before and brought it to the end, and let’s see the result
- The result was a value of 18 kg as above. More precise results can be obtained if more precise and fractions are added to the account.
Gauge Sensitivity Measurement
- If we were to calculate the sensitivity
- We made our design to measure between 0-18 kg
- PIC was max 1024 as it is 10 byte
- Therefore it will be possible to measure 18000/1024 = 17 gr precision.
- This also explained the reason why sensitive scales sold in the market has reduced the range of measurement whereas they have increased sensitivity.
- So if we were measuring 1kg we could measure with 1000/1024 = 0.9 gr sensitivity
- As a result, if we want both the measurement range to be large and precise, then we must use external 24 bit ADC integrations.
- To give an example: 224 =16777216 we get this value. 18000/16777216=0,001 gr and we could measure with this sensitivity.
Experiment Video
RESULT
- We have seen how we need to do calculation and design a load cell system and how we should limit the PIC accordingly
- We learned to use a professional integration like INA122. This integration can be used for any measurement, including thermometer circuits. It will reveal the quality everywhere it is applied.
- AD586 provides the same high-accuracy reference and we have seen its application.
- The precision will vary depending on the power circuitry, as well as the installation scheme of the unit. of course, if it needs to be more precise, it requires more attention
- After you have done everything in a sufficient level, deviations that occur after the software can be removed according to the area of use. For example, you can let it wait idle and see how deviating it is, you may get it out first.
- The 1k resistor at “Vin (-)” is added to reduce the parasites which is seen in circuit. If you increase this value too much, the readout threshold will also increase, for example, to read as 10 gr, it may start to read as 100 gr, Because the greater the resistance, the higher the signal will go. Low resistance blocks the effects, such as parasites, without allowing them to pass. If there is no problem in your unit, you can use a smaller resistance.
- We came to the end of the lesson. You can ask questions that you have in mind under “Question and Answer Forum “.
References
This post is also available in: Türkçe (Turkish)