Variable Power Supply, Current limiter, Amp Meter, Volt Meter
By using the InvIoT U1 I build a variable power supply with a current limiter, amp meter and volt meter, on a single PCB.
I test 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 ouput 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 use 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 use 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. Its 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 its better to be on a bigger heat sink. The ones I use are doing the work for the demonstration, in a real application you got 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 larger heat sink 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 remove the IC from the module.
Connecting the PCB to the board.
To connect the PCB to the InvIoT, you first need to connect the power pins.
PCB to InvIoT
Remember that you get the 24v from an external power supply you drop it to 12v by using the 7812 on the PCB.
On the InvIoT there is a 5v regulator that goes back to the PCB so the ACS712 can run.
Then you got the input pins, Volt and Amp:
volt reader pin goes to A2
and the amp pin goes to A3
Finaly is the PWM pin that drives the opamp. It has to be an arduino PWM pin. I use D9.
You must power the PCB with a power supply over 14V and less than 24v.
Step 2: 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'.