Power MonitorIn our case, Power Monitor means "monitoring
HardwareBecause Arduino Analog has 10bit converter (0 - 1023) on 5V. The voltage can be changed by analogReference() but must be <= 5V.
Arduino (Micro) has recommended Input Voltage 7 - 12V and limit 6 - 20V (but not recommended to go over 12V). We will consider our maximum voltage to be 20 which is 4-times bigger then voltage of analog converter (~0.02 precision) which means that we need Voltage Divider.
On image above, you can see our resistors. The green number (bottom half of resistors) means how many same resistors we need to use in order to get our needed result (get 5V from 20V).
Our R2 (5V) will be 10kΩ so R (R1 + R2) is 40kΩ. This means R1 is 30kΩ.
For the fursuit, I will use 7.4V Li-Ion battery (for Radio-controlled models) for Arduino (and 5V for Servo).
I was also thinking about getting 11V (11.1V / 11.4V) battery for Stepper Motors (wings) but first I want to test them with 7.4V (which should be enough).
SynchronousAs I wrote above,
analogRead()has range of value from 0 to 1023 (10 bits, 1024 values).
From that, we can calculate values for voltage:
- 1023 is 20V
- 1535 is 15V
- 513 is 10V
- 383 is 7.5V
- 378 is 7.4V
- 255 is 5V
- 127 is 2.5V
float voltage = (analogRead(PIN) / 1024.0f) * 20;
AsynchronousTo run analog input asynchronous, we need to start the conversion and continue our code until we get an interrupt about end of conversion.
Honestly, I have never done this in Arduino so I was searching for it and found this nice article.
Above you can see complete scheme of Power Preprocessor for 2+2 batteries (yes, there is still missing 7.4V to 5V for Servo).
You can you any amount of batteries but I recommend you to use maximum of 6 batteries (for monitoring because Arduino Micro has maximum of 6 Analog Inputs).
On the image above I also switched polarity of last battery to show you how the polarity check works.
It is done by MOSFET (I will probably use IRFZ44N or IRF3710).
You can also see 4 diodes (3 of them active). They are there to separate Voltage Dividers (otherwise they would share same value).
5V Voltage RegulatorYou just need to buy and use DC to 5V DC Buck Converter. I was looking around to find how many amperes I need. I consider 3A to be enough because I found
0.25A to 0.5A should be enough for worst servoswhich makes it 2.25A to 4.5A for all servos running at same time (at maximum speed) in worst case.