Author Topic: Dc voltage monitor - is Arduino a reasonable choice?  (Read 2230 times)

0 Members and 1 Guest are viewing this topic.

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Dc voltage monitor - is Arduino a reasonable choice?
« on: January 01, 2019, 08:51:40 am »
I have a requirement for a device that will monitor 5 different DC voltages and that will sound an alarm if any of them drift out of range. The voltages are all within the +15V to - 15V range, for example +15V, +10.6V, -6.5V, +8.5V and -15V. (Edit: and to display the voltages on a readout).

It’s time that I got into micro controllers and I think that this would be a good project to learn about programming with. I understand that I will need to scale the voltages down into something that falls within the voltage range that the microcontroller inputs or ADC can deal with, the electronics is no problem for me but my question is which micro family would suit this project.

Can anyone tell me if Arduino would be a suitable platform to design this project around or should I choose another platform or even something larger like Raspberry Pi?

Thanks!

« Last Edit: January 01, 2019, 09:36:28 am by Synthtech »
 

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #1 on: January 01, 2019, 09:07:38 am »
If by "sound an alarm" you mean something physical like a buzzer, then Arduino would be ideal. No doubt "pro" users will tell you Arduino is awful, but it remains far and away the easiest and most accessible platform for beginners to micro controllers.

Bob
"All you said is just a bunch of opinions."
 
The following users thanked this post: Synthtech

Offline fchk

  • Frequent Contributor
  • **
  • Posts: 305
  • Country: de
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #2 on: January 01, 2019, 09:09:29 am »
The most obvoius method would be a couple of LM339 comparators, which would do the job completely without any uC.

If you absolutely must use an uC, any will do.

 
The following users thanked this post: Synthtech

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #3 on: January 01, 2019, 09:34:26 am »
The most obvoius method would be a couple of LM339 comparators, which would do the job completely without any uC.

If you absolutely must use an uC, any will do.

Very true, I did want to use it as a microcontroller learning exercise so I probably should take it further and add some read-outs as well.  I will go back and edit my post and add that in.
 

Offline thieringpeti

  • Contributor
  • Posts: 18
  • Country: hu
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #4 on: January 01, 2019, 12:57:47 pm »
Hi!

Use voltage dividers for ADC inputs, and write a simple program which reads the ADC pins frequently, then use an Arduino sound library to play a tune or a beep. Only some resistors, and a small speaker or piezo buzzer is needed! For displaying the voltages, use any simple LCD module, e.g. a cheap 2x16 or 2x20 character module. Arduino libraries were available and well documentated for these.

A simple example can be found there: https://www.electroschematics.com/9351/arduino-digital-voltmeter/ (google: arduino voltmeter)

For the negative voltage, it's a bit more difficult, but with an op-amp can be handled and converted to positive with a simple inverting amplifier circuit. Note, that that op-amp needs a symmetrical power supply.
A bit complicated example for negative/positive voltages: https://electronics.stackexchange.com/questions/252431/measure-both-positive-and-negative-voltages-using-adc

Note, that all the input voltages must be converted to the range between 0V and VCCMCU (5V for Arduino). Also note, that the AVR's internal 10-bit ADC isn't very precise, but a reasonable readout can be get.

 
The following users thanked this post: Synthtech

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #5 on: January 01, 2019, 07:17:04 pm »
Thank you Thieringpeti, great information. I have no problem with the electronics to build the appropriate op-amp power supply and dividers and to invert the negative voltage values to positive to suit the Arduino inputs. It’s not a big issue that the Arduino converter resolution isn’t that great, the displayed voltage values need only to be basically accurate, the system only needs to trip if the voltage of any of the rails shifts by .5V or more.

Thanks for your reply, I will go with the Arduino platform then and get to work building the scaling/onverting board and power supply.
 
The following users thanked this post: djacobow

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9986
  • Country: us
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #6 on: January 02, 2019, 05:34:02 pm »
But...  You didn't specify what the "range" is.  Depending on how you use the ADC input span, you might not even be able to measure the "range" if it is small.  This needs more detail of the specifications.

Second, even if you use op amps, they will normally be powered by +- 15V and they don't work to the rails (usually) so you would need to divide the incoming voltages.   Of course, it would be better if you could use single supply 5V op amps.

There is a process for "offset and scale" using an op amp and 4 resistors to essentially move 15V down to the middle of the rail voltage (call it 0V for bipolar op amps, 2.5V for 5V single supply op amps) and then measure small variations.

See Chapter 4 of "Op Amps For Everyone".

http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf

Note that examples use single supply op amps which will be a lot more convenient when connecting to the Arduino.

I had this 24V battery bank for a DC powered small boat.  The battery voltage needed to be between 20V and 28V (I have forgotten the exact range).  I didn't care at all what the voltage was when it fell below 20V because I would be dead in the water.  Offset and scale allowed me to ignore the first 20V and  change the 20-28V range (8V) to something in the 0-5V range of the ADC.  A little arithmetic inside the uC allowed my to display the actual voltage.
 
The following users thanked this post: Synthtech

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #7 on: January 02, 2019, 09:19:43 pm »
But...  You didn't specify what the "range" is.  Depending on how you use the ADC input span, you might not even be able to measure the "range" if it is small.  This needs more detail of the specifications.

Second, even if you use op amps, they will normally be powered by +- 15V and they don't work to the rails (usually) so you would need to divide the incoming voltages.   Of course, it would be better if you could use single supply 5V op amps.

There is a process for "offset and scale" using an op amp and 4 resistors to essentially move 15V down to the middle of the rail voltage (call it 0V for bipolar op amps, 2.5V for 5V single supply op amps) and then measure small variations.

See Chapter 4 of "Op Amps For Everyone".

http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf

Note that examples use single supply op amps which will be a lot more convenient when connecting to the Arduino.

I had this 24V battery bank for a DC powered small boat.  The battery voltage needed to be between 20V and 28V (I have forgotten the exact range).  I didn't care at all what the voltage was when it fell below 20V because I would be dead in the water.  Offset and scale allowed me to ignore the first 20V and  change the 20-28V range (8V) to something in the 0-5V range of the ADC.  A little arithmetic inside the uC allowed my to display the actual voltage.

What an elegant idea. So, if I am understanding you correctly, I would use op-amps and resistor dividers to shift the monitored voltages to the mid-point of their respective op-amp’s voltage range at the op-amp’s output and then use the Arduino to monitor variations from this voltage. So if for example I was using a dual rail op-amp I would scale the voltage under test using this method to read zero volts at the op-amp’s output when the input voltage is exactly in spec. So in the case of the input voltage drifting in a fault situation the op-amp’s output would deviate from zero and the Arduino would note the variation and output an appropriate result. I would decide how much variation was tolerable and use arithmetic in the Arduino program to scale the amount of variation from zero volts to equal the desired maximum variation in the voltage under test.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2288
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #8 on: January 02, 2019, 10:19:45 pm »
I have a requirement for a device that will monitor 5 different DC voltages and that will sound an alarm if any of them drift out of range. The voltages are all within the +15V to - 15V range, for example +15V, +10.6V, -6.5V, +8.5V and -15V. (Edit: and to display the voltages on a readout).

It’s time that I got into micro controllers and I think that this would be a good project to learn about programming with. I understand that I will need to scale the voltages down into something that falls within the voltage range that the microcontroller inputs or ADC can deal with, the electronics is no problem for me but my question is which micro family would suit this project.

Can anyone tell me if Arduino would be a suitable platform to design this project around or should I choose another platform or even something larger like Raspberry Pi?

That depends on how fancy you want that "display the voltages on a readout" ! :)
IIRC RaspPi has no native DC ADCs , but you could connect parts like INA199 i2c voltage/current monitor devices.

It also depends on how accurate you need this to be. What is your out of bounds limit, and what % precision do you need to have ?
Ardunio uses the power supply as voltage reference, and the mega328 has 10b ADCs, and 1% resistors are easy to get and cheap....
- but a calibrate step could be enough to push you to under one percent overall error.

What an elegant idea. So, if I am understanding you correctly, I would use op-amps and resistor dividers to shift the monitored voltages to the mid-point of their respective op-amp’s voltage range at the op-amp’s output and then use the Arduino to monitor variations from this voltage. So if for example I was using a dual rail op-amp I would scale the voltage under test using this method to read zero volts at the op-amp’s output when the input voltage is exactly in spec. So in the case of the input voltage drifting in a fault situation the op-amp’s output would deviate from zero and the Arduino would note the variation and output an appropriate result. I would decide how much variation was tolerable and use arithmetic in the Arduino program to scale the amount of variation from zero volts to equal the desired maximum variation in the voltage under test.

Close, but you would target mid-supply on the Ardunio ADCs not zero volts, as the ADCs cannot read below 0V
Simplest is just resistor dividers to GND for the +ve sense, and you can divide to VCC for the -ve rails. (target 50% Ardunio supply as the ideal good point)


If you want a low cost board with display already fitted, and 12b ADCs there is this N76E003 one at $2.70
https://www.electrodragon.com/product/intermittent-switching-relay-module-n76e003-mcu/

 
The following users thanked this post: Synthtech

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #9 on: January 03, 2019, 07:32:10 am »
I have a requirement for a device that will monitor 5 different DC voltages and that will sound an alarm if any of them drift out of range. The voltages are all within the +15V to - 15V range, for example +15V, +10.6V, -6.5V, +8.5V and -15V. (Edit: and to display the voltages on a readout).

It’s time that I got into micro controllers and I think that this would be a good project to learn about programming with. I understand that I will need to scale the voltages down into something that falls within the voltage range that the microcontroller inputs or ADC can deal with, the electronics is no problem for me but my question is which micro family would suit this project.

Can anyone tell me if Arduino would be a suitable platform to design this project around or should I choose another platform or even something larger like Raspberry Pi?

That depends on how fancy you want that "display the voltages on a readout" ! :)
IIRC RaspPi has no native DC ADCs , but you could connect parts like INA199 i2c voltage/current monitor devices.

It also depends on how accurate you need this to be. What is your out of bounds limit, and what % precision do you need to have ?
Ardunio uses the power supply as voltage reference, and the mega328 has 10b ADCs, and 1% resistors are easy to get and cheap....
- but a calibrate step could be enough to push you to under one percent overall error.

What an elegant idea. So, if I am understanding you correctly, I would use op-amps and resistor dividers to shift the monitored voltages to the mid-point of their respective op-amp’s voltage range at the op-amp’s output and then use the Arduino to monitor variations from this voltage. So if for example I was using a dual rail op-amp I would scale the voltage under test using this method to read zero volts at the op-amp’s output when the input voltage is exactly in spec. So in the case of the input voltage drifting in a fault situation the op-amp’s output would deviate from zero and the Arduino would note the variation and output an appropriate result. I would decide how much variation was tolerable and use arithmetic in the Arduino program to scale the amount of variation from zero volts to equal the desired maximum variation in the voltage under test.

Close, but you would target mid-supply on the Ardunio ADCs not zero volts, as the ADCs cannot read below 0V
Simplest is just resistor dividers to GND for the +ve sense, and you can divide to VCC for the -ve rails. (target 50% Ardunio supply as the ideal good point)


If you want a low cost board with display already fitted, and 12b ADCs there is this N76E003 one at $2.70
https://www.electrodragon.com/product/intermittent-switching-relay-module-n76e003-mcu/

Aah, thank you, that makes sense - set the correct target voltage to match the Arduino ADC’s mid point voltage so that it can swing either way. Then scale in software to set limits. I will go take a look at the link that you posted,  thanks!
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1968
  • Country: us
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #10 on: January 03, 2019, 08:38:56 pm »
I use the NANO for all these small jobs. Spend $3 and you are done. One thing to warn you of.  I use a USB cable with the +5V line cut.  You can use back to back diodes if that makes you nervous. This assumes you use the 5V as the reference voltage.  The micro will run off whatever 5V source is higher. That can leave you with a perfectly calibrated system being way off when hooked up stand alone. Do all your calibration with the final power supply in place.
 
The following users thanked this post: Synthtech

Offline SynthtechTopic starter

  • Regular Contributor
  • *
  • Posts: 222
  • Country: au
Re: Dc voltage monitor - is Arduino a reasonable choice?
« Reply #11 on: January 04, 2019, 12:18:28 am »
I use the NANO for all these small jobs. Spend $3 and you are done. One thing to warn you of.  I use a USB cable with the +5V line cut.  You can use back to back diodes if that makes you nervous. This assumes you use the 5V as the reference voltage.  The micro will run off whatever 5V source is higher. That can leave you with a perfectly calibrated system being way off when hooked up stand alone. Do all your calibration with the final power supply in place.

Good advice, thank you.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf