or

# In over my head, complete noob in need of data logging advice.

1270 Views - Created 28/04/2016

28/04/2016

Posted by:
chrisshone

Location:
Stoke on Trent

Hi

I work at a college that Is helping out a local school in a project theyre involved in. (theyre sending a capsule up on a weather balloon)

Ive been given the task of recording the voltages and amps off two items with a Pi 2 Model B

"The solar motor is 2V with 50mA Amp max, the solar panel is 5V and Max Amps is about 500mA" The solar motor has a fan and is driven by the wind during the balloons acent.

Now im completley new to both hardware and software other than kits i used to build as a kid and as far as programming goes the last code i wrote was for a ZX81 :) yep that long ago!

Ive spent the last twodays scratching around in the hope of finding an answer when I came across the ADC Pi Plus Im I right in thinking that this will provide me with the neccesary input?

Any advice for my feeble mind is very much appreciated.

cheers

chris

28/04/2016

Posted by:
andrew

Location:
United Kingdom

Hi Chris

The ADC Pi Plus would work for measuring the voltages and current but based on what you have described the ADC Differential Pi may be a better option.

With the solar motor do you need to measure the voltage and the current or just the current?  One thing you need to watch out for with motors is back emf which is a voltage spike in the reverse direction that occurs when the motor is running.  This voltage spike is often several times greater than the forward voltage and could break the ADC if the spike exceeds the maximum input voltage.  You can add a protection diode to the motor circuit to limit this problem.

With the solar panel is the 5V rating for when it is under load or open circuit?  Solar panels will run at a higher voltage when they don't have any load on them so you will need to measure this and use that as the basis for the maximum voltage on the ADC inputs.

The ADC Pi Plus uses voltage dividers on the inputs that allow the ADC to measure up to 5V on each channel.  As you need to measure 2V on one channel and possibly more than 5V on another channel the ADC Differential Pi may be a better option as it does not include any voltage dividers so you can add your own for the limits you need.

We have a voltage divider calculator that allows you to work out the correct resistor values for the inputs.  All you need to do is enter the input voltage you want to measure, set the first resistor at a value of 10000 and the output voltage at 2.048 which is the limit of the ADC Differential Pi input.  I would recommend giving yourself some safety margin for the input voltage so if the voltage does go too high it won't destroy the ADC chip.  A 20% margin should do it.

The ADC Differential Pi has two inputs for each channel + and -.  This allows you to measure the difference between the two input pins instead of just measuring relative to ground.  This is useful if you need to measure negative voltages as the input can be anywhere between -2.048 and + 2.048V but in your case you will be measuring positive voltages all of the time so it may be easier to measure relative to ground.  To do this you need to connect the - pin on the input to ground.  The ADC Differential Pi has a row of ground pins next to the - pins to make this easier.

For measuring the current I would recommend using a low value shunt resistor connected to a current shunt amplifier.  Using the amplifier will allow you to keep the resistance and therefore the voltage drop low which on a solar powered system will be essential.  There are quite a few different current shunt amplifiers available but one I have used before is the TS1100 from Touchstone.  I used the amplifer on a Raspberry Pi solar monitor which from what you described is similar to the system that you need to design.  The TS1100 comes with several different gain levels so you can choose one that suits your needs.  They only come in a SOT23-6 package which is fairly small but you can get adapter boards on ebay which allow you to convert the chip into a more managable DIP package.  They are not too difficult to solder if you have a steady hand and a pair of tweezers.   The output from the amplifier can be fed directly into the ADC input.

You will need to calulate the resistor value based on the current draw, the amplifier gain and the voltage you want to be sent to the ADC.  For the 50mA circuit if you use the TS1100-100 which has a gain of 100 then you will need to convert the 50mA into 0.02V which when multiplied by 100 in the amplifier will present 2.0V at the ADC.  Using our ohms law calculator 0.05A and 0.02V gives you a resistance of 0.4 ohms so that is the value you will need for the shunt resistor.  To measure 500mA you will need a 0.04 ohm resistor.

For the software side if you are new to programming in modern languages then python will be the easiest way forward.  We have a python library available for the ADC Differential Pi that will help you get started.  There are some demonstration python scripts included which show you how to read a voltage but it is fairly straight forward and once you have picked up the basics of python you shouldn't have any trouble getting it to work.

Hopefully I have covered everything above but if you need any more advice please let me know.

AB Electronics UK Tech Support

03/05/2016

Posted by:
chrisshone

Location:
Stoke on Trent

Thank you so much for your advice, it has helped no end, we have ordered 'hopefully' everything that we need now :D

We just need to bring it all together now, I may be back for more advice soon.

thanks again