Introduction: Arduino Dual Channel Voltage Sensor Module
Its been a few years since i have written an instructable, I was thinking that is time to come back. I have been wanting to build a voltage sensor so that I can connected to my bench power supply. I have a two channel variable power supply, it has no display so I have to use a voltmeter to set voltage. I am not an electrical engineer or programmer, I do this as a hobby. Having said that I am going to describe what we will be building here and it may not be the best design or best coding, but I will do my best.
Step 1: About the Project
First of all this is just a preliminary design of something more stable and reliable, some of the components will not end up in the final design. Most of the components have been selected only because of availability ( I had them in my house) and not because of their reliability. This design is for a 15V power supply but you can replace a few passive components and can make it work on any voltages or current. The Current sensors are available in 5A, 20A and 30A you can just choose the amperage and modify the code, the same thing with the voltage sensor you can change the value of the resistors and the code to measure higher voltages.
The PCB has no set values because you can replace passive components to meet the needs of you power supply. It has been design to be added to any power supply.
Step 2: Voltage Sensors
We will start with the voltage sensors and current sensors. I am using an Arduino Mega to test the circuits and the code, so some of the beginners like myself can make and test their own on the fly instead of having to build the whole module on a breadboard.
We can only measure 0-5 volts using Arduino's analog inputs. In order for us to be able to measure up to 15 volts we need to create a voltage divider, voltage dividers are very simple and can be created using only 2 resistors in this case we are using a 30k and a 7.5k that would give us a ratio of 5:1 so we can measure values of 0-25 volts.
Parts List For Voltage Sensor
R1, R3 30k Resistors
R2, R4 7.5k Resistors
Step 3: Current Sensors
For the current sensors I am going to be using the ACS712 made by Allegro. Now the first thing that I need to mention is that I know that this sensors are not very accurate but is what I had on hand when designing this module. The ACS712 is only available in a surface mount pakage and its one of the very few SMD components being use in this module.
Current Sensor Parts List
IC2, IC3 ASC712ELC-05A
C1, C3 1nF Capacitor
C2, C4 0.1uF Capacitor
Step 4: Temperature Sensor & Fan
I decided to add temperature control to the module because most power supply generate a good amount of heat and we need overheating protection. For the temperature sensor I am using an HDT11 and for the fan control we are going to use a 2N7000 N-Channel MOSFET to drive a 5V CPU fan. The Circuit is quite simple we need to apply voltage to the Drain of the transistor and we apply a positive voltage to the gate, in this case we are using the arduino's digital output to provide that voltage and the transistor turns ON allowing the fan to be energized.
The code is very simple we take a temperature reading from the DHT11 sensor if the temperature is greater than our set value it sets the output pin HIGH and the fan turns on. Once the temperature drops below out set temp the fan turns off. I build the circuit on my breadboard to test my code, I took some quick pictures with my cell, not very good sorry, but the schematic is easy to understand.
Temperature Sensor & Fan Parts List
J2 DHT11 Temp Sensor
R8 10K Resistor
J1 5V FAN
Q1 2N7000 MOSFET
D1 1N4004 Diode
R6 10K Resistor
R7 47K Resistor
Step 5: Power Circuit
The module runs on 5V so we need a stable power source. I am using an L7805 Voltage regulator to provide a constant 5V supply, not much to say about this circuit.
Power Circuit Parts List
1 L7805 Voltage Regulator
C8 0.33uF Capacitor
C9 0.1uF Capacitor
Step 6: LCD & Serial Outputs
I design the module to be used with an LCD in mind, but then decided to add serial output for debugging purposes. I am not going to go in to detail on how to set up an I2C LCD because I have already cover it in a previous instructable I2C LCD The easy way I added LEDS to the Tx & Rx lines to show activity. I use a usb to serial adapter that I connect to the module then I open up the serial monitor in the Arduino IDE and I can see all the values, make sure everything is working the way it should.
LCD & Serial Out Parts list
I2C 16x2 I2C LCD (20x4 Optional)
LED7,LED8 0603 SMD LED
R12,R21 1K R0603 SMD Resistor
Step 7: ISP Programming & ATMega328P
Like I mention in the beginning this module is design to be build for different configurations, we need to add a way to program the ATMega328 and upload our sketches. There are several ways to go about programming the module, one of them is to use an Arduino as an ISP Programmer like in one of my previous Instructable Bootloading ATMega with Arduino mega.
- You do not need the Capacitor to load the ISP sketch on the Arduino, you need it to burn the bootloader and to upload the voltage_sensor Sketch.
-On newer versions of the Arduino IDE you need to connect pin 10 to pin 1 RESET of the ATMega328.
ISP & ATMega328P Circuit Parts List
XTAL1 16MHz HC-49S Crsytal
C5,C6 22pf Capacitors
ISP1 6 Pin Header
R5 10K Resistor
Reset 3x4x2 Tact SMD Switch
Step 8: Notes & Files
This was just a way for me to put some ideas into a working device, like I mention before is just a small addition for my Dual Channel bench power supply. I have included everything you need to build your own module, all Eagle CAD files and schematics. I have included the Arduino sketch, is very simple and I have tried to make it easy to understand and modify. If you have any questions feel free to ask, I will try to answer them. This is an open project, suggestions are welcome. I try to put in as much information as I could but I found out about the Arduino contest late and wanted to submit this. I will be writing the rest pretty soon I have also remove the SMD Components (resistors, and LED) and replaced them with TH components, the only SMD Component is the current sensor because its only available in a SOIC pakage, the ZIP file contains the files with the TH components.
Participated in the
Arduino Contest 2020