Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

Arduino Project - Voltage and Current Sensor


daz

Recommended Posts

 

Hi all

I have an idea for a little fun project that I hope will get me a good inroad into Arduino and electronics - but need a starting hand!

So, what I'm thinking is to build a portable power box that houses the USB ports, power switches for the mount and camera, etc, but also has a 2-line LCD display showing a variety of different measurements from the system - Voltage, Current, Temperature, Dew Point, LST, and eventually reading the mount for DEC and RA position. Possibly!!

The power box has a 7-port 12v USB hub, 1 USB input, 2 x 12v inputs each one supplying 3 outputs. There will be a button to cycle through the different sets of readings. One of the USB ports will be used for the Arduino, the others will be mount, camera, guide camera, focuser and SQM Reader. One of the 12v supplies will feed the mount and camera, the other will be for the dew controller and any other 'dirty' outputs needed. Power supplies will be a 13.8v Maplin bench supply (5amp, 7amp burst) - for the mount and camera side, and then another 12v 5amp for the 2nd inputs (don't have this yet...).

 

So, first step is get the Arduino to read the voltage and current from the two circuits. So, from digging around, I think an ACS712 is what I need to measure the current. Now the questions...

1) Are the eBay ACS712's OK to use?

2) For the voltage measurement, will a voltage divider be sufficient, or should I look for a dedicated module? Absolute accuracy is not vital I guess...

3) Other than fuses on all the lines, is there anything else I should look at for current protection for the Arduino?

 

I don't have a shopping list yet as I still have lots to think about, of course, so any recommendations on the LCD (HD44780 based one?), or anything else, feel free to shout!

Thx

 

 

Link to comment
Share on other sites

Yes the ACS712 will work, as would the MAX471, both of which can be purchased as simple cheap modules. A simple voltage divider would also work fine for voltage messurement and there are plenty of example Aduino sketches for reading the analogue inputs.

Ive done the same as your suggesting and monitor the voltage and current draw to my systems, and with a relay also automatically shut-down the supply if the current draw gets too high.

 

  Cheers, Mark.

Link to comment
Share on other sites

This is what I am building atm using a Nano interfaced to a 4D Systems LCD displaying Voltages, temperatures, humidity, RTC etc.  The only limit is the size of memory on the Nano so I'm thinking of have another as a slave to take care of the LCD and Windows coms whilst the master takes care of the inputs.  Still needs debugging (DHT21 keeps dropping off!) but is usable.  It's all going into a Peli case with PS and 2 4 port USB hubs.  I decided against having one hub as to me it would share the load with imaging having two

 

A normal voltage divider will do for the volt readings.  Ensure that the max possible  input on the Analog pin is 5V.  Beware that some Arduino's also only accept max 3.3V

image006.jpg

--

Mark

 

 

Link to comment
Share on other sites

  • 2 weeks later...

So... an update!

After much digging around and pestering the good folks on the Arduino forums, I have a circuit for measuring the voltage on my two supplies. This turned out to be not quite so straiht forward as I thought, as a) I don't know enough about electronics and b) I don't know enough about electronics!!

Anyway, I found a bunch of tutorials that showed how to use the Arduino reference voltage functionality to measure the analog input voltage as a % of the reference, and from that the real voltage. This means that it will work for being connected to a regulated mains supply or a battery pack in the field.

I've built this on a breadboard and testing is going well - I have the measurement of the primary circuit (i.e. the one that the Arduino is also powered from) and now need to find another source of power to check and test the secondary circuit. I also need to update the sketch to read both inputs and must remember to scale the output for 12v and not 5!

I attach my schematic if anyone fancies pulling it apart! The resistor values I settled on were 120K and 68K, as these ensured that no more than 5v hits the Arduino regardless if a bench supply or battery.

When I finish this part and the testing, I'll post the sketch and breadboard diagram as well...

 

Off to figure out my 16x2 LCD display!

 

 

My Voltae Divider_schem.png

Link to comment
Share on other sites

Good progress!

As above I2C LCD's are nice & easy, however they will require pins A4 & A5 so you might want to pick another pin for the voltage measurement. Also, and I'm sure you have this covered, Gnd of the power supply your measuring should be connected to Gnd on your circuit.

 

  Cheers, Mark.

Link to comment
Share on other sites

  • 4 weeks later...

If the battery is connected then the power is likely to vary from 15V downwards... 

It may be better to setup to 0-15V range instead.

I'm no help on the resistors or capacitors etc.. but I have just implemented a voltage read using the stepper sense resistors to understand the current being applied to each coil.

The analogRead() results in 0-1023 range so 0V is 0 and 5V (AREF sets the analogue reference - the max value) is 1023 for the UNO board (same as mine). So 1V is (1023.0f/5.0f) and then that gives you the capability just to say sensor value / (1023.0f/5.0f) if my brain is working right that this time of night.  The AREF can be set to internal (which it is by default) and the maximum value for the ADC is 5V (or whatever the internal operating voltage is).

So the external circuit you develop must provide a scale 0-15V and then rescale that measured value to 0-5V max (0=0 and 5V presented to the ADC=15V measured). The in the software rescale back up - you'll loose some precision. So 0 value 0V and 1023 (5V into the analog pin) would mean 15V in the real word and the software can scale and display that accordingly.

I wouldn't know how todo that scaling 0-15->0-5V in hardware.. :/

 

Link to comment
Share on other sites

9 hours ago, NickK said:

If the battery is connected then the power is likely to vary from 15V downwards... 

It may be better to setup to 0-15V range instead.

I'm no help on the resistors or capacitors etc.. but I have just implemented a voltage read using the stepper sense resistors to understand the current being applied to each coil.

The analogRead() results in 0-1023 range so 0V is 0 and 5V (AREF sets the analogue reference - the max value) is 1023 for the UNO board (same as mine). So 1V is (1023.0f/5.0f) and then that gives you the capability just to say sensor value / (1023.0f/5.0f) if my brain is working right that this time of night.  The AREF can be set to internal (which it is by default) and the maximum value for the ADC is 5V (or whatever the internal operating voltage is).

So the external circuit you develop must provide a scale 0-15V and then rescale that measured value to 0-5V max (0=0 and 5V presented to the ADC=15V measured). The in the software rescale back up - you'll loose some precision. So 0 value 0V and 1023 (5V into the analog pin) would mean 15V in the real word and the software can scale and display that accordingly.

I wouldn't know how todo that scaling 0-15->0-5V in hardware.. :/

 

 

Just need a voltage divider

Vout = Vin . R2 / (R1 + R2)

Choose R1 to be 10Kohm would be typical so R2 would need to be 5kohm

voltage-divider.gif

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.