Posts

Showing posts from June, 2017

Improved current limiting, end

Image
Just need to update the software and do the calibration. The software is available  on gdrive It can be built using either the arduino ide or arduino-cmake . To do the calibration : 1- Uncomment the #ifdef DEBUG_MEASURE in power_screen.cpp 2- Put a power resistor (20w 10 Ohm for example) and put high voltage 3- Turn down the limiting pot to the values of interest (100 mA, 250 mA,...2500 mA) 4- For each value note down the value in the bottom left, that's the ADC measure 5- Comment again #ifdef DEBUG_MEASURE in power_screen.cpp Now that we have the calibration values (10 of them is nice), we'll fill the  extrapol[] array in the .ino file with them Left column is the current in mA Right column is the value measured by the ADC So for example {1500, 450} means that current was limited to 1500 mA  and the ADC value was 450 My values are, for reference   {100,2},   {250,40},   {500,100},   {750,163},   {1000,256},   {1250,350},   {1500,450},   {2000,630

improved current limiting (part2)

Image
Now we have the control points, time to inject it into our secondary board. Disclaimer : It is a proof of concept and can be made much better. In particular, it should be a low pass filter, and better impedance adaptation between the two stages. /Disclaimer : The control board  is based on a LM358, with two stages : Amplify : So that the output range is 0--4V more or less (i'm aiming at 3.5 A max) Differential amplifier : Amplify the difference between the previous stage and a reference . The pot is there so that you can adjust the gain of the first stage, to get to the desired range. The reference  (vRef) is just a voltage divider made by a potentiometer (so the range is 0...5v). The differential amplifier output is fed to VOSense through a  0.1 v schottky diode. So as soon as the current  makes ISENSE  * Stage1 gain go above  Vref, VOSENSE is driven higher than 0.8 v and the output voltage goes down. The Vref is injected also into the A

Improved current limiting with LTC3780 (part 1)

Image
The existing max current control on the board works as follow : Current is sensed through a 7 mOhm shunt and multiplied by a variable factor driven by the pot. The output is then connected to vSense via a diode. As soon as the output rises over 0.8v, the voltage goes back. It works, but you have to to it blindly, not easy to measure a gain (resistance) for display purpose. Let's have a look at the schematic (more detail at beyondlogic ) : Note that the - output of the DC/DC converter is not directly connected to the - of the input ! The idea here  is to modify as little as possible the existing board. Additionnaly, messing too much with VOSENSE will destroy the  circuit. Good news, we have a very good candidate : The diode On one side, we have a voltage proportional to the current, on the other side the control. So let's tune the current pot to have a max output of ~ 400 mV, remove the diode and pull two wires to a secondary board. The chip to remove

Speeding up Arduino compilation

You may already have noticed that as soon as you use a couple of libs, Arduino IDE takes forever to rebuild things, even with trivial changes (i.e. a comment). But, when using arduino-cmake, the same thing is happening. What's going on ? In both cases, the ino file is in fact two things : C++ source file, obviously Makefile generator Makefile generator ? Yes, the ino file is parsed to find out what libs you are using, adding the include paths and libs to link  A corresponding makefile is generated under the hood. It means that for every change, the makefile is regenerated and pretty much everything is recompiled, including the libs. How to fix that ? Split the project In the ino file, put  the headers for the libs you need and the minimum code The idea is that it will change as little as possible. Put most of the flesh in external cpp files That way, when you change one of the cpp files, only that file will be recompiled

Secure Battery Checker , done

Image
Finally got some P mosfet and completed the battery capacity checker. Now it charges the battery automatically after discharging it The display has been improved to be more readable Source code + schematic here Google drive Mandatory pic : (and yes, mA and mV are inverted :) ) There is still something wrong with the charging voltage control, but it's good enough for a first version.