By using the
I build a variable power supply with a current limiter, amp meter and volt meter, on a single PCB.
I tested it with the input voltage at 24V, the output was from 0v - 21V with 256 steps. (0.82v step).
In the video I am using a 18v power supply from an old laptop, so I calibrate the output at 16v.
First state is the current limiter. I use a LM350 with a 0.47ohm resistor. That limits the current to approximately 2.8Amps.
On the second state I used a TIP41 transistor to make the variable voltage. In order to drive the transistor I use an opamp lm358. By using a trimmer I was able to change the amplification of the opamp. That way I can control the maximum voltage of my output, when I drive the opamp with the 5v from a PWM pin from the microcontoller.
On the third state I used an ACS712 5a current sensor. You can use any module you get with ACS712. I bought one, removed the chip and used it on my PCB. There is also a voltage divider so I can measure the voltage.
There is also a 7812 to drop the input voltage to 12v, so I can power the InvIoT U1.
Step 1: Building PCB
Building PCB? Why? You can also do it a prototype PCB board. It's a very simply schematic. For the amp meter you can use the ACS712 5a current sensor module, build the opamp circuit, and add the 2 resistors as a voltage divider. The LM350 and the TIP41 it's better to be on a bigger heat sink. The ones I used were doing the work for the demonstration. In a real application you have a lot of heat to sink.
Any way, I didn't build the circuit on a prototype board. I made my own PCB! Values of the components are written on the PCB. Remember that a larger heat sink is needed if you are going to drop a lot of voltage or if you are going to use high current.
I bought a ACS712 module and I removed the IC from the module.
Step 2: Connecting the PCB to the Board.
To connect the PCB to the InvIoT, you first need to connect the power pins.
from the PCB to InvIoT
Remember that you get the 24v from an external power supply and you drop it to 12v by using the 7812 on the PCB.
On the InvIoT U1 there is a 5v regulator that goes back to the PCB so that the ACS712 can run.
Then you have the input pins, Volt and Amp:
volt reader pin goes to A2
and the amp pin goes to A3
Finaly there is the PWM pin that drives the opamp. It has to be an arduino PWM pin. I used the D9.
You must power the PCB with a power supply over 14V and less than 24v.
Step 3: Uploading Sketch, Calibrating and Setting Up
After you install the InvIoT library, the sketch will be found on your arduino IDE at file/examples/InvIoT_U1/applications/powerSupply.
You upload the sketch, like you do with any arduino sketch.
Fist time you run the sketch, it will go to the calibration wizard.
Connect a volt meter at the output of the PCB.
Press rotary for next, and the PWM pin (D9) goes all the way up (5v). Adjust the trimmer to the maximum voltage that you would like to be your output. (about 2v less than the input voltage).
Press rotary to go to calibrate the volt meter of the voltage divider. Every resistors are different, so you calibrate the voltage divider with the volt meter.
Press rotary and remove volt meter, so there is no load at the end of the output.
The amp meter is getting a measure at 'zero point'.
Press rotary to save calibration to EEPROM.
Step 4: Test It and Set Up Menu.
If you got that far you know what to do!. Look at the video for the menu.