In over my head, complete noob in need of data logging advice.
2350 Views - Created 28/04/2016
Stoke on Trent
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 that 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 amplifier 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 manageable 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 calculate 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 that 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.
Stoke on Trent
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.