Ar2uino Dummy Load – 4

As can be seen above I have really gone for compact with the Ar2uino Dummy Load built according to step 1. Controlled just with the potentiometer. Very easy! Just set the current with the potentiometer and measure the current going through or measure the voltage across the sense-resistor. Remember that 1mA current will give only 0.1mV across! So 1A will give 0.1V.

Above you can see the side with the micro USB connection for 5V power to the Dummy Load. Also you see the 25-turn potentiometer for setting the current load. To the far right as a blurry green square on the other side you can see the screw terminals for connecting the load! There is room the the right of the USB connector for another power connection in case you want to power it in another way. At the moment (step1) it draws very little power – just about a mA! In step 2 when we add the ESP8266 it will draw substantially more power 2-300mA and even more in short bursts. We will make sure to include a proper reservoir capacitor to handle the peaks. I am waiting for the 5V 50mm fan that will be mounted on top of the heatsink – the “U” shaped form at the top takes 3mm screws so mounting should be easy! Even if I will test it I will not be able to go to very high loads swithout the fan! NOTE: The above USB is just for power – not for programming or communication!

Here is the other side slightly from above. On the very left you can easily see the screw terminals for the load. This is where you connect whatever you want to test. Power Supplies, Power Banks, Batteries … etc. In the shade under the heat sink you can see the 0.1Ω sense-resistor. It is soldered hovering a few millimetres above the PCB and also a few millimetres below the heat sink. Practical tests will show if this is a feasible solution heat wise. The connection wires have been bent to allow easy access in case you want to monitor the current by measuring the voltage over the sense-resistor. You also can see the two heavy wires (red and black) that carry the current up to the Power MOSFET that is bolted to the heatsink. Not seen is the LM358 op-amp hiding in the middle under the heatsink.

Here it is “unfolded” so all of it can be seen. Not much really – but it is a very simple circuit! Placement of the components is not very sensitive – but try and keep wires as short as possible and go for heavy gauge wires where I have so indicated in the schematic! I went for compact and that has forced me to use longer wires than would have been necessary with a more “sensible” layout. Another throw in just to looks is the red and black wires that I let extend out a bit – looked cool I think! 😉 A little blurry you can see the IRL504 Logic Level Power MOSFET bolted to the heatsink with an isolating silicon pad. Gold 😉 spacers keep the hot heatsink away from the rest of the components. Heavy gauge wires lead the current up/down to the board. Closest is the white 0.1Ω 5W sense-resistor. Behind that is the 1uF capacitor and the LM358 op-amp and its standard 0.1uF decoupling capacitor. Along the further edge is the micro USB power connector, a 470kΩ resistor and the 25-turn 100kΩ potentiometer.  A 10uF Tantal SMD capacitor finishes of the components just in front of the potentiometer. Left is only the screw terminal for the load! That is all there is to it! 😉

I have left space on the board for the ESP8266 ESP-12F module and the 3.3V voltage regulator to be added in step 2. As you can see I have also made a cut-out for the ESP-12F antenna so that will have free transmission in most directions.

As mentioned earlier the layout of components is not very critical but make sure to save space so that the ESP8266 module can have free transmission in most directions. The closer to the heatsink the antenna is placed the more the heatsink will block or weaken the WiFi-signal. Because of my small and cool heatsink I opted for cool and compact – but see that just as a not so optimal layout and maybe also not such an optimal heatsink! There is also no need whatsoever to go with the very compact and folded design layout that I did! But cool it is … 😉

Well, next up is the testing of the Ar2duino Dummy Load!

See you soon!
/Sfenn

Ar2uino Dummy Load – 3

This is how the Ar2uino Dummy Load Step 1 electronics design looks at present! It is a very simple design and not complicated at all! This is a standard design of using an op-amp! I have included the logic level MOSFET IRL504 so that it will work well at 5V. As I said you can use practically any MOSFET as long as you can drive it and do not exceed the max specifications. NOTE: If you use a standard non-logic level MOSFET you might need a voltage step up module or power it with around 9V instead.

We are using the MOSFET transistor to ‘burn off’ a selected amount of current so a heatsink is necessary! How big and if you will need a fan depends on how many Watts you want to load it with! In the schematic above you can see how to change components for different load maximums. I have gone for the lowest using a 470kohm R4 giving a max (theoretical) current of 5.7A. As the table (of a few standard resistors) shows that will generate around 3.2W and the 5W resistor I have chosen as R1 can handle that! It will definitely get really hot at max load. If you decide to go higher in current be sure to swap the R1 for a higher wattage one! I feel that it is best to limit the current by a selected resistor this way – then you can not by mistake turn the current load too high! Be sure to have a good Watt margin on your sense resistor (R1). NOTE: The table above is calculated for the Step 2 version of the Ar2uino Dummy Load when R6 is fed a stabilized 3.3V. Either you live dangerously (like me) and make sure you do not overload the sense-resistor by going too high – OR you use 820kΩ as the R4 resistor – that will limit the current to 5.7A and 3.2W. You should definitely do this if you do not intend to continue with the ESP8266 in step 2!

Picking the sense resistor is a almost always a compromise. You want the voltage across it to be of a reasonable level for it to not be riddled with electrical noise from the surroundings and at the same time small enough that the heat generated in it will not be too big. If we look at my design as an example: I picked 0.1Ω so 1mA will generate 0.1mV across it. That is very small but is still handled well with the op-amp. 5.7A will generate 0.57V and that turns into 3.2W and that in its turn turns into HEAT! I could have picked 0.01Ω and that would have made all the difference in heat generated – BUT that resistance is so low that almost everything will affect it – the soldering, the wires, the contacts, etc. On top of that the voltage generated for 1mA is just 0.00001V (10uV) and here the noise starts to be (too much?) more noticeable! It is doable but puts (in my opinion too much) demand on the construction!

Just a few words about how wonderful op-amps are! 🙂 We want to have a certain amount of current going through our dummy load. We measure that by having a sense resistor (R1). Applying the standard equation volt=resistance*current we can calculate the voltage that a current will give over the resistor. In our case the resistor is 0.1ohm. We want max 5A so this is just 0.1*5 which gives us max 0.5V.
In this circuit we just tell the op-amp what voltage we want to have over R1 by setting that voltage on the non-inverting (+) input of the op-amp. It will then (“on its own”) adjust the output until the inverting (-) input is equal to the non-inverting (+) input. The wonderful part of it is: We do not need to know the exact level necessary as the op-amp will adjust that “automatically”! We do not need to know the exact voltage when the MOSFET will start to conduct or exact how much voltage to apply to the MOSFET gate to get it to conduct the right amount to let through the exact amount of current to get the voltage over the sense resistor to match the voltage we set! I do not even want to think of the work to do this precision work without an op-amp! It makes it sooo simple! (The IC is here placed on an apple!)
The op-amp will adjust this “automagically” for us! In short: op-amps are amazing! 😉
(We do need to design the circuit so all these things are “within reach” for the op-amp though!)

It is easy to change it from potentiometer controlled to an ESP8266 controlled later on – in step two. Until I return to this I will keep it connected to 5V and will have to use the potentiometer and a multimeter to set the load current! NOTE: That the table above is calculated for 3.3V! The potentiometer is not even wasted at all in step two – we will use it to calibrate the output from the ESP8266! We will just re-solder the R6 to 3.3V when we add the ESP8266!

Next step is to actually build the Ar2uino Dummy Load as in step 1 – with the potentiometer and no ESP8266.

See you soon!
/Sfenn

Ar2uino Dummy Load – 2

Building the Ar2uino Digital PSU has shown me that a variable electronic dummy load comes in very handy when designing prototypes for different projects. Every makers lab should have one! I have built two battery testers so far and as they really are just a form of specialized dummy loads I have decided that the new battery tester Arduino Battery Tester v3 should be more versatile so that it can both test batteries and also be used as a general dummy load – that makes it the all new Ar2uino Dummy Load! That is the reason why I have changed the title of this blog series! 🙂

Design

I am thinking of designing it along the lines of a load of max 25V and max 5A – but not both limits at the same time! That would handle the majority of situations I could think of. A fan would have to be included as there would probably be some heat that has to be ventilated away – and I do not want a massive chair-size heatsink! If I can avoid it! 😉

In case your requirements are totally different to the above it is easy to change the solution to handle these limits! First of all the Power MOSFET that I plan to use (I have a few IRFZ44N laying around!) will easily handle a continuous load of over 35A and up to 55V – as long as the total power dissipation is kept below 94W – AND the required cooling is available! So you could have for example 15A load at 5V or 1A load at 55V! BUT you would have to have a very good cooling to go so high! And then if that is still not enough you could also just swap “my” transistor for a beefier one … ! Use an IRL504 if you need higher voltage! It goes all the way up to 100V! As we are using this transistor as a sort of “variable resistor” almost any Power MOSFET will do! Or you cold have a few parallell transistors instead! The above is up to you but myself I will keep away from the extremes! 😉

How many Watts the Dummy Load will really be able to handle will depend a great deal on the level of cooling I will be willing to supply – and that I have not decided yet! I do not see that I will ever need a 94W load … but we will see how difficult it is to achieve this! I will probably use a small heatsink – and a fan to compensate for this! I am thinking “compact” for this device! I have an old CPU heatsink 50x50x35 mm (2″x2″x1.4″) that I plan to use.

As previously described the general idea is to employ an ESP8266 as the main microcontroller. It has one big advantage with the built-in wi-fi but also a big disadvantage with only ONE analog to digital converter ADC. 😦 The version 2 of the Ar2uino Battery Tester did very well with just one ADC due to the fixed load resistance – but to build a variable electronic load one should really use two ADC:s – one for measuring the voltage across the load and the other to measure what the actual load current is.

That can easily be fixed by using an Arduino for the measuring job and the ESP8266 mainly for presentation and wi-fi. A tempting idea! Another alternative is to add an extra ADC – for example the 4-channel ADS1115. Either solution is roughly the same price ADC or Arduino Pro Mini – just below 2€/$2. An advantage in using an extra separate ADC is that it is higher resolution – 16 bit vs 10 bit! An advantage of using an extra Arduino is it can offload work from the ESP8266. I do not feel I would need the extra resolution in this case!

The offloading with an extra Arduino is not such a bad idea considering that the ESP8266 has more things handled in software compared to the ATmega328 where it is handled in hardware. PWM is handled in software. So there will be more of a challenge to develop the code for the Dummy Load in such a way that it does not disturb the “firmware”.

It just irritates me that I would have to add an extra module to the ESP8266 … but it can be avoided IF the set current value is accepted as a correct value … which is a quite a bit of an assumption to make! I will naturally have test it to see if it is acceptable!

I have already tested the PWM stability of the Arduino (ATmega328) and found it to be very good – so I will not add any digital to analog converter (DAC) either but will instead use the ESP8266 PWM with a small RC filter for 1024 steps. This helps to keep the circuit simple. The ESP8266 will hopefully be as stable as the ATmega328! Testing will give the answer!

Those 1000 steps would translate to 5 mA steps in my max 5A design. And I might add one lower-load setting with 1 mA steps up to max 1000 mA for measuring smaller loads/batteries. Load can also be varied by pulsing the load.

I plan to power it from an ordinary 5V USB cable. That will make it very easy to power it from a mains USB adapter/charger or a USB Power Bank – depending on your needs. Or you can even power it from a USB port of your computer. When using it with a Power Bank I plan to have the ability to switch on/off the wi-fi updates to save battery power!

Using a low cost easily available Power MOSFET with a threshold gate-to-sink voltage VGS(TH) of 2-4V might require a higher voltage than 5V to drive it properly so I will add a voltage doubler or a step-up module if necessary – as we only need mostly voltage and very little current. A step-up module might bring it all the way up to 12V making an easier selection for fan! Wish I had gone for the logic-level IRLZ44N (VGS(TH) of only 1-2V) when I got the MOSFETs … then I would not have to handle this! Well, there is an electronics component shop in town … 😉

UPDATE: I actually paid the electronics shop a visit and got a few IRL540’s – so I will be using those! It simplifies the solution a little. 🙂

Components list:
  • ESP8266 ESP12-E/F
  • Power MOSFET IRF540N/IRL540/IRFZ44N/IRLZ44N
  • Heatsink with 5/12V fan
  • LM358 Op-Amp
  • 0.1 ohm 5W resistor
  • Misc capacitors, resistors and diodes
  • Optional step-up module
  • USB to Serial adapter – for programming!

Software

The software can be considered consisting of two parts: the presentation/settings part and the electrical part.
The presentation part will first of all create the webpage where it will handle the setting up of the Dummy Load – how many mA load should load the source with or any pulses to be used or any other settings. Here you will also decide if you want to use it as an automatic battery tester or a general dummy load. The electrical part will control the loading as by the setting. It will also measure voltage across the load and calculate the load in mAh/Wh. With these values the presentation part will create diagrams and tables of the measurements.

I assume that the software will be the real challenge in this project – as always! 😉

To be able to use the dummy load as quickly as possible for the testing of the Ar2uino Digital PSU I am going to make it in two steps:

1:st step is to make a simple version that is controlled with just a potentiometer. That will be good enough for the testing I need initially with the DPSU.

2:nd step I will return to this Ar2uino Dummy Load project as soon as I have finished the DPSU and continue to add the ESP8266 and support for Wi-Fi!

See you soon!
/Sfenn

Ar2uino Digital PSU – 10

This is a the DPSU measured with a 0.5% precision multimeter and the built-in 10 bit ADC in Arduino (ATmega328P). Every 0.5V was measured. When doing any kind of measurements one has to have a reference! I have decided (with some evidence to support this) to trust my multimeter. Therefor both curves above needed to be corrected to coincide with the multimeter readings!

First of all there is an offset error with the DAC. The multimeter readings shows that the output from the DAC is generally about 45mV too high. The multimeter curve above has been lowered 45mV all over the voltage range to illustrate this. One would have to accept that the MCP4725 DAC:s that we use have this type of deviation! Pretty decent I think with around +-30mV over the entire voltage range – except for +50mV at 11.00V – is quite alright. I will probably want to do something more advanced about it in software later on – but for now this simple correction will have to do!

Secondly I automatically measured (at the very same time as above) the output from the DAC with the Arduino 10 bit ADC. That measurement had a slight gain error that I corrected with a standard linear formula. It brought down the deviations to much the same as the multimeter readings – but with generally bigger swings between too high and too low values. Still it is easy to see that both the multimeter and the Arduino ADC have measured the same DAC voltages. So if we squint a little the curves above shows roughly the MCP4725 DAC deviations. Also here I will do something in the software late on.

It would not be very difficult to make adjustments in the software to get deviations down to below just a few mV for all the above measurements. Also it would be “easy” to adjust all settings to within +-10mV for each 0.1V setting – that is 400 voltage settings. But considering that the DAC has over 4000 possible voltage settings, every 10mV from 0V-40V puts up some challenges! To correct all those is not feasible with the small EEPROM memory of the Arduino – even if we use compression of data – we would have to add extra I2C serial bus memory for around $1. That in itself is no big deal but we also have the question of HOW we should accomplish this! Manually measuring 400 values is ok – if tedious! But 4000 …? It would have to be an automatic or semi-automatic calibration!

The difference between the DAC with 12 bits and the Arduino ADC with just 10 bits means that we will be able to set it much more precise (4 times) than we can measure! It is possible to even out this difference and improve the built-in 10 bit ADC of the Arduino by using oversampling. We do this by oversampling (measure) 16 times and sum the results, right shift 2 bits or divide the result with 4. We will then be left with 2 extra bits! 🙂 So 10 bits turns to 12 bits! A small amount of noise is necessary for this “trick” to work. Just out of curiosity I will test it out. As we are only using the ADC for display purposes the extra time it takes to measure 16 times does not really matter. We will not update the display more than around 2 times/second anyway! My explanation is just the basics – search for “oversampling” to know more!

Another, very tempting, and possibly better idea would be to add a much better ADC like the 16 bit ADS1115 and use that to improve the results! By also adding an extra EEPROM memory where to store the voltage corrections it would be possible for a simple automated calibration of EVERY single selectable  step from 0-40V. Note that I do not say every “10mV step” as these steps will be correct but probably not exactly 10mV each. They will be as correct as the new ADC will be! But as we only have a 12 bit DAC we have 4 extra “throw away” bits (that is 16 steps!) for accuracy! 🙂

Even if the above is possible it might be setting the goal too high with the components chosen! In case we want this kind of 10mV precision we should probably have got a more expensive and more precise DAC in the first place – and not have had to do so much “software-magic”! Setting the goal for 0.1V or 100mV steps is a better goal considering the components, I think. There is nothing that prohibits the drop in of both better DACs and an external and better ADCs for a higher spec DPSU – the solution will still be the same! If they are I2C controlled devices the swap is very simple! It depends mostly on your requirements and wishes! 🙂

See you soon!
/Sfenn

 

Arduino Reflow Oven – 20

 

This is a small update to the Ar2uino Reflow Oven! I have had some questions about a Reflow Profile Editor.
I wrote a small editor to edit reflow profiles – but as testing showed that my oven was not powerful enough (800 W in 8 litres) of following reflow curves that required a steeper profile – I have removed this editor! I should also add that I was so satisfied with the Lee’s Reflow Profile that I did not think I would experiment that much with other profiles. Removing the editor gave back a little over 1kB memory and lessened the risk of anything going wrong due to memory shortage! And will give a little space for other future improvements! 🙂

NOTE: Without the editor you can still add and edit the profiles but will have to do that through changing the predefined values in the code! Do that at line 1840 and onwards.

WARNING! I wrote this code a few years ago and I have not tried it since! I might have updated other parts of the code that might disturb this editor code. I do not know! I have added the code and recompiled it without any warnings 🙂 but I will not be able to test and verify that it works! I am sorry but I do not want to disturb my excellent reflow oven that works absolutely perfectly as it is!

Well, if you want to try and add the editor code I wrote a few years ago – this is roughly how to do it:

  • Find the lines below in the v1.2 version of the Ar2uino Reflow Oven code
  • At around line 313-320 uncomment the “editP();” line by removing the “//” first in the line
  • Download and add the new Reflow Editor code
  • After you have verified that it works – remove the “mode = GOTOMENUE” line.
  • Recompile and fix any errors that might appear
  • Scanning through the code I found a comment I wrote those years ago about a bug that you might have to toggle a restart after saving a new profile!

Please let me know if you get it to work! 🙂

As usual, clicking the button on the left will bring up a new window with a text only PDF.
Copy all of the code and then switch to your Arduino IDE and paste it in the extra code.
Compile and upload to the Arduino! Ready! Test and verify that it works!
This roundabout way via a PDF is because WordPress will not let me upload a text- or ino-file.

 

Good Luck!
/Sfenn

  /////////////////
  // Edit        //
  /////////////////
  else if (mode == 2) {
  //    editP();                 // 1430 bytes    Removed due to oven limitations making it of little use!
    mode = GOTOMENUE;      // Just returns to menue

  }

Ar2uino Digital PSU – 9

Here is the first (manual) measurements of unloaded output voltage on the Ar2uino Digital PSU. 🙂 I have used an input voltage of 19V. I have adjusted, with the trim potentiometer, the DAC setting of 1000 to give an output of 10V. Then I measured all the DAC settings from 0 – 1600, every 100 step. That should give output voltages of each whole volt from 0-16V. I have (just because it is sooo nice with a slanting “perfect” straight green line) shown the settings and the corresponding output voltage. 😉 Just to put things in perspective I included this line – with no visible deviations!

Not terribly interesting what you can actually see but if we calculate the difference from the ideal values and enlarges them 500 times we will see the small deviations from the ideal straight line as the dashed orange curve shows. NOTE: That orange dashed curve has its scale in mV on the right! The differences start out with not being exacly 0.000V but rather 0.009V or 9mV. Then the differences varies from -40mV to +60mV over the entire voltage range ut to 16V. Looking at the deviation in percent it starts out with 4.7% at 1V, dipping to 3% (2V) and 1% (3V). For the remaining voltages up to 16V it stays within 0.7% but stays mostly around 0.1-0.2%.

As we are controlling the DPSU with an Arduino Nano all these deviations can be corrected in the software – but I myself have no more accurate multimeter than a 0.5% one so I would not bother with any corrections except for the interval 0-3V to make sure it stays within 0.5% all the time! 🙂 I have calibrated the multimeter against a 5 decimal precision chemical voltage reference – a MUIRHEAD cell – for a voltage near 1V but I have no way of knowing how linear my multimeter is for other voltages! It is probably better than the guarantied 0.5% – but I have no way of knowing!

We must also remember that the origin of the settings are DACs so we can not expect values to behave in an analoge way with smooth curves! Each new digital value can behave in a unique way so it is rather cumbersome to manually correct these voltages. One could probably make some better estimation based on looking at the digital value from a bit perspective and with a bit (no pun intended!) of analysis might arrive at a way to compensate for bits that are a little high or a little low. I will do that just for fun! But maybe the best (at least easiest!) way is to accept the small deviations and correct some “important” voltages like 1.8V, 3.3V and maybe all even voltages 1-16V.

The Arduino Nano has built-in analog to digital converters (ADC) that we will use for showing the instantaneous voltage and current. That could easily be used to calibrate the DPSU automatically – but again for that to be useful we would have to know how precise that ADC is – especially how linear it is! To be useful it would anyhow have to be calibrated – according to the ATmega328 datasheet the voltage reference it uses has a huge +-10% variation! But development of that calibration is anyhow in the future …

These measurements also reveals that with a 19V input voltage the max voltage that can be output is 16.36V – that is -2.64V below the input voltage. That is perfectly OK for me! My ambition – though not very important – was to have som sort of future expansion and have at least 15V output voltage – accomplished! 🙂 Just by changing the input voltage I can go up to around 30V with no changes to the DPSU! That is future proof! 🙂

Using a constant current sink of 20mA I will now measure the same voltages as above and see how well the DPSU regulates the voltage under a (very) light load. I do realize that I will need a variable electronic load to do this properly! The measurements that involves higher loads will have to wait until i have (built) one! 😉

As can be seen loaded or not loaded the DPSU gives the same output voltage up to about 12V where the 20mA loaded voltages are slightly higher topping out at +40mV. This surprised me as I thought that the output voltage would go down under load – not the reverse. The max output voltage with 20mA load is a little bit lower though at 15.63V. Will it dip even more with heavier loads? Will I not get my 15V output voltage? But reality is what it is – reality! I will try to clobber up  something soon so we can see how the DPSU performs at higher loads!

See you soon!
/Sfenn

Ar2uino Digital PSU – 8

Above is a typical oscilloscope response from the current limiting in action. The voltage is set at 4V and the current limit is set at 10mA. The load is a 10ohm resistor. No adjustments have been made yet! As soon as the load is applied the voltage is brought down to 80 mV (should be 100mV). I assume that the slope is due to the discharging of the 220uF output capacitor taking 5-10mS to discharge. According to the normal discharge calculation it should take around 8mS so it seems to fit. Using a 100ohm load this discharge time is longer (See below!) – sort of proving it to be the capacitor and the load in conjunction that determines how quickly that slope will reach the correct voltage.

Here the load is 100ohm and the voltage set for 6.6V. Current limit is again set for 10mA. The sequence of events we see here is first of all the voltage from the DAC (also the input to CA3140) is brought down very quickly when the current limiter is activated. That is the cyan curve that starts out at around 800mV. The reaction is very quick and the output voltage (yellow curve) immediately begins to fall – but will be slower this time as we only have a 100ohm load to discharge the output capacitor. During the 60mS that we can see the voltage has not time to reach its intended voltage of around 100mV.

As the DPSU can only supply a voltage and has no means to force down the voltage that is kept up by the output capacitor I might include a MOSFET that can short out the output capacitor and thereby make the output voltage go down quicker! I will do some tests on this. It might be controlled in parallell with the first MOSFET via a capacitor for a very brief discharge. I will test this idea out and be back if it works well! 😉 But it might be too coarse as I have no means to limit the discharge to a proper level … I also do not want to introduce any “ringing” … Well we will see! Everything is a compromise!

At these very small voltages there is some non-linear response and I plan to handle that in two ways: By adding a constant current source at the output I will avoid the very lowest voltages. At 1mA the sense voltage is just 0.1mV over the 0.1ohm sense resistor. Having 20-40mA constant load will ease this a little bit. Every step will still be just 1mA=0.1mV but al least we have left the GND proximity. The rest will be handled in the Arduino software. For example: Having a constant current of 20mA and wanting the output current to be limited to 5mA means I will have to set it for 25mA! I hope that is clear? Although the sense voltage is amplified around 12.5 times still the voltages will be very low and the LM358 Op-amp does not work very well so close to GND.

Now it the time for more varied measurements and more testing with more varied loads: capacitors, motors, relays and naturally with more voltages!

See you soon again!
/Sfenn

 

Ar2uino Digital PSU – 7

Above is the main board with most of the components in place. Missing is the 2.4″ TFT display – as that would obscure most of the view. As I now will do the very first testing of the analog design I will try and keep the testing as simple as possible and test as small pieces as I possibly can! I will use another lab power supply as the power supply for this Arduino Digital PSU so that I can vary the voltage and limit the current under test! That way hopefully I will be able to keep any damages to a minimum … Let me say that this careful testing of every step is absolutely necessary for ME as I have not tested the whole design yet – this is the first time! It does not mean that the tests are complicated or that very advanced functions are tested – just that the different functionalities needs testing! I will naturally correct any bugs as soon as I discover them! If you decide to build this DPSU you should also (as always) do proper testing as there could be some sort of building error! Or maybe you are not that type that makes mistakes? 😉

The voltage setting, current setting and the zero offset can all be trimmed but during these tests there is no idea to trim these properly – but we can at least have a try to see that trimming works!

Voltage Setting Test

We will use an even simpler piece of software then that we used to test the DACs with. It will just set the DAC to output the corresponding voltage to the “1000” level. It should be around 1.25V – if you power the DACs with 5V. That voltage will then be amplified by the CA3140. During this test we will only use the output from the CA3140  (Max 40 mA!) and not the power Darlington transistor yet so we can make sure that the voltage part is working properly before going on with the next step – current limit setting! This first test is really only testing to see that we get the proper amplification of the voltage from the voltage setting DAC! Therefore we will also not connect the current limiting part of the circuit – that means we will leave pin 8 (inhibit) open on the CA3140.

For this test we will need two voltages to power the DPSU – a stable 5V for the digital electronics and any voltage higher than 13V for the analog part. The 5V will (eventually) come from the 5V voltage regulator we soldered together in posting #5. So if that is easily available then use it! An even easier way to test this is to let the digital electronics be powered by the USB connection. That will probably not be as close to 5V as the proper voltage regulator – but it is ok for these tests!

Download Voltage Test Code!
As usual, click the button on the left to bring up a new window with a text only PDF.
Copy all of the code and then switch to your Arduino IDE and paste it in a new empty window.
Compile and upload to the Arduino! Ready!
(This roundabout way via a PDF is because WordPress will not allow text- or ino-files!)

Run the test code! If measured directly at the DAC output it should now be around 1.25V – or around 25% of the voltage that powers the DAC. Now adjust the trimmer for an output from CA3140 pin 6 of exactly 10.00V – that will set each step on the DAC to be 10mV. After this (simple) adjustment we should (at least theoretically) be able to output any reasonable value from 0 to 1000 and get a corresponding voltage 0-10V in 10 mV steps! Well, you should be able to go up to around 2V below your analog input voltage!

Test a few other voltages by changing the value for variable “v” in the code! Compile and upload! Measure! Expect a few mV differences to theoretically expected values. Remember that the smallest step possible is 10mV! If everything checks out then you are ready for the next test! 🙂 Otherwise I am sorry you will have to check all connections and correct the fault – and redo the test! 😦

I am happy to say that this first test went OK! 🙂 The voltage output from the DAC was correct at slightly over 1.25V and I managed easily to adjust the output voltage from the CA3140 pin 6 to 10.0V. Not a very complicated test but necessary non the less! The whole analog part of the PSU depends on this!

Now on to the next test!

Current Indicating Voltage Test

After testing the voltage output from the CA3140 we want to test that voltage from the LT6105 corresponds to the current! To do that we need to add the 0.1 ohm current sense resistor to the circuit and naturally the LT6105. Also we will need some sort of load over the output like a low ohm resistor, lamp or a few LEDs – or we could just connect our multimeter over the output “terminals”. I did that and managed immediately to blow my fuse! 😦 Better to connect a 10 ohm resistor as load!

We will not connect these parts together with the CA3140 yet! Instead we will let the current be supplied from our lab power supply! Doing it like this we can test and see that it gives the correct “current indicating” voltage output while minimizing the risk of damaging anything!. The output of the LT6105 should output a voltage that is around 12 times the voltage across the 0.1 ohm current sense resistor and it should be related to GND. If we let our extra lab PSU supply 100mA – we should have around 12mV.

This test was also OK! 🙂 Setting my old lab PSU for 100mA I got a voltage across the 10 ohm load resistor that is around 1V. Across the current sense resistor (0.1 ohm) I got around 10 mV. Just according to the calculations! Again an extremely simple test! 🙂 Measuring on the output (pin 5) of the LT6140 I get 125mV after adjustments. Remember that I have designed this for a maximum of 4A output and that 4A equals 400mV sense voltage, 5V from the LT6105 balanced against 5V from the DAC.
This is also what we expect! 🙂

Now on to the next test!

Current Limiting Mechanism Test

Then we can test the workings of the LM358 combined with the DAC that sets the current limit and the voltage from the LT6105 and see that it acts correctly as the current exceeds the set value. But note here that we have not yet started to use the pin 8 – meaning that we are just testing the mechanism for current limiting but we are not actually – yet – limiting the current! The LM358 should go high when we exceed the set current and kept low otherwise! NOTE: As we use the current from the old lab PSU we can set it to any value – as long as the load resistor will not get too hot! I settled for a target of 100mA. Hold on! Set it for a low value to start with! Like 1-5 mA!

Here we use the same software as with the Voltage Setting Test above – but we change the DAC_ADDR to 0x61 (for the current setting) and “v” to 100 – in this case meaning 100mA. Compile and upload and measure the voltage output from the DAC. It should be around 125mV. Then connect the voltmeter at the output of LM358. It should show a low voltage slightly (10-40mV) above the GND. Now increase the current on the lab PSU. At around 100mA the LM358 output should swing over to a high voltage instead – a few volts. Try setting the current at 100mA and use the trimmer to make it swing from low to high and vice versa! Adjust it for a midpoint. There is no idea to trim this output properly – but we can at least have a try to see that everything works!

Again the test worked as it should! 🙂 But the fact that there is a conversion factor of around 12 made me jump to the wrong conclusion first! It was possible to adjust it for the correct result! The trimmers has sufficient reach. This swinging between low and high of the LM358 is planned to be used together with the inhibit pin (8) on the CA3140 for current limiting. Now we know we have the potential to get it to work! How well is yet not known! But soon… 😉

 

Adding POWER to the test

Now there is no way to avoid testing the full PSU – including the power transistor! But I will start with low currents and work my way up! I will not be using the current limit through pin 8 (strobe/inhibit) of the CA3140 yet! For me doing these tests – testing also the design not just the build – I will use my other lab power supply with current limiting set low – to start with! 😉

Yes! 🙂 This test also went OK! The added Darlington Power Transistor gave exactly the same voltage as the voltage directly from the CA3140! So far all the tests have worked well! Now is the time for testing if the current limiting through pin 8  of the CA3140 will work! Scary…!

 

 

 

 

Current Limiting Test

The ability to limit the current to a pre-set value is crucial to our lab PSU! We have above seen that the mechanism with the LT6105 – the current sense amplifier – worked well with the LM358. It made it react when the current was exceeding the set limit! But now it is time to connect the LM358 output to the strobe/inhibit pin (8) of the CA3140!

I am sorry to say that it did not work as intended! 😦 This has been a uncertain point in the design as I could find very little information in the data sheets! Searching for this on the internet also did not give much info on how this pin really works! The Intersil data sheet stipulates that: “Terminal 8 is also used to strobe the output stage into quiescence. When terminal 8 is tied to the negative supply rail (Terminal 4) by mechanical or electrical means, the output Terminal 6 swings low, i.e., approximately to Terminal 4 potential.”  This led me (incorrectly) to assume that is was controlled by the potential (voltage) at pin 8. Proof for this was also seen (I thought) at an application example where a zener diode connected to the strobe pin could limit the voltage at the CA3140 output to the zener voltage minus two base-to-emitter voltage drops!

Well, how do I think that the CA3140 strobe pin actually works? I think that it works as a sink! If it has a potential that is lower than the output voltage it will limit the output voltage to that level as said about the zener above! The problem with my design was that when the LM358 swung high it swung to near the full input voltage – and affected the output voltage of the CA3140! This was NOT what I wanted! I did NOT suspect that the strobe pin would affect the output voltage if it was fed with a higher voltage – just that a lower voltage would eventually – if it was low enough pull the output low (ground)! If I had looked more closely at the inner design of the CA3140 I could possibly have seen this! But I am much better as using op-amps than I am at understanding exactly how they work! I need a description of the features so I can use them…!

UPDATE 2: Some of you might wonder why there has been no new posts in this series?
The reason is that I have had unforeseen problems of oscillation when I connected the current limiting circuits. I have now at last found the culprit and will continue with the postings!
🙂

Well, the blame for this is on me anyhow and I have redesigned that part of the circuit and will now try that new design! Not much changed but I swapped the inputs and added a MOSFET transistor to pull the strobe down toward ground.

YES! I have now retested the current limiting with the second new design and it has finally passed! 🙂 But this was a hard obstacle to overcome. My first redesign was using the strobe/inhibit pin 8 pulling it to ground with a MOSFET but this did not give a good enough response. It was not linear enough and also I had problems with oscillations. In my second redesign I just moved the MOSFET to the non-inverting input of the CA3140. Shorting out the voltage from the DAC – and limiting the output voltage in this way. This worked better and showed a good response when current limiting was activated! I am still confused and slightly irritated that I could not get the elegant pin 8 solution to work! It was like made for an application like this!
If any of you reading this has an explanation to why I could not get pin 8 of CA3140 to work properly – pleeeaase let me know!

As I write this as I go along building the Arduino Digital PSU lucky all of you that can read about my failure! Later when I have found the correct/best design I will probably rewrite some of these posts – as then this detour will not be of much use I guess!? I will also go back and add the final Eagle Schematic – making it much easier to follow along and understand what I am talking about! 😉

Finally time to go on with the next post…

See you soon!  🙂
/Sfenn

 

 

Ar2uino Digital PSU – 6

We have so far built and TESTED the digital part of the Ar2uino Digital PSU and we have verified that we can print to the TFT display and set the two DACs to voltages between 0-5V (or VCC). Combining an Arduino with a display like this is a very handy platform for a lot of different projects – by adding different input/output capabilities to this and a bit of software you can make almost anything! 🙂 And that is just what we are about to do – a Digital PSU! You can see most of the analog parts in the picture above. Only a few capacitors and the power components; a Darlington transistor and 5W 0.1 ohm resistor are mounted elsewhere! Does not look overly complex, eh? 🙂

The analog part

This is where we ‘slide over’ to the analog part of the Arduino Digital PSU. What we want to do here is to make a sort of the ‘voltage regulator’ or ‘amplifier’ to achieve the voltage and current output that we want. To do this we will be using an op-amp CA3140 for adjusting the output voltage to the one we have set with the DAC. We will also use this CA3140 to keep the current below a set threshold! To find out what the current current (Yes, it is correct!) is we use another op-amp, a LT6105 that is a special ‘current sense amplifier’, that will give us a voltage that is proportional to the used current. Lastly we use an ordinary op-amp LM358 to react when this ‘current voltage’ is higher then the set current limit and pull down the output voltage through a special strobe input on the CA3140. Check out the block diagram!

NOTE: As I write this blog in ‘sort of real time’, while I work my way towards the goal, the design has NOT been tested in full yet so I am quite excited to see if my design will work as I intended! When I have built the design and done any necessary modifications I will naturally update this blog of the changes as well! AND hopefully remember to remove this comment! 🙂

Well, we start by placing the active components CA3140, LT6105 and LM358 on the right hand area of the perf board as can be seen in the big picture on the top. I have rotated it a quarter turn anticlockwise just to show it better! We will need three trimmers. One for zero adjust of the CA3140, one for output voltage step trimming and one for current limit step trimming! They will have to be placed so they can be adjusted – either from the top (with the case lid off) or from the bottom (through holes). The latter is if you want to be able to adjust these and not have to remove the top part of the case! As we are using a digital setup for this we can also make some adjustments and trimming in software – if necessary! We will also need room for a few other components like resistors and capacitors!

Decisions

Before we go on with adding the resistors we will need to make some decisions! First of all is what the smallest voltage step should be when setting the output voltage. That will at the same time limit the maximum output voltage. I intend to use 10mV as the smallest step. That will allow me to set an output voltage up to a max of 40.95V – because of the 4096 steps that the 12 bit DAC can give! Remember  that the DAC gives around 5V at its maximum – that gives that we have to have just a little over eight (8) times amplification of those 5V to get 40.95V. We will use a trimmer as part of this voltage divider that we will use for the CA3140 so we can trim it for exactly (or as close as we can) to 10mV steps! Remember that the 40.95V is only the maximum that it can be set for! The input voltage (max 32V – depending on the LM358) will decide the max output voltage! This also means that you can easily supply it with different voltages and get different capabilities from the Arduino Digital PSU!

We need to make the same type of decision for the current. The smallest current step that I feel would be interesting is 1mA and that would give a maximum current of 4.095A which also can be expressed as 4095mA! Again this is just the limit of what can be set! The maximum input current will naturally limit our maximum output current! We are using a 0.1ohm current sense resistor that will generate a voltage of 409.5mV when 4.095A is passing through it! To balance that against the 5V we get from the DAC we need to amplify our 409.5mV a little over twelve (12) times! Again we will use a trimmer as part of the voltage divider for the LT6105 so that we can set the steps to be exactly 1mA steps!

The third decision is the actual maximum voltage and maximum current we want! How much of the available range we will use all depends on the input voltage and input current! In both cases it means that I will not be using the full range of the DACs with my 19V and 2.4A input! (See below!) But I think that the advantages of having “easy” smallest steps outweighs the advantage of even smaller steps – at least for me! It will also give us greater freedom when we pick the input voltage and current! Depending on the choices we make we can easily just supply a higher voltage or a higher current and the DPSU will handle it! We will probably not use 10mV or 1 mA very often as we normally will not set voltage or current that precise! We can also take the road to smallest possible steps and limit the max voltage to just below the supply voltage – and get albeit uneven but the smallest (and most precise) settings!

All the above reasoning and calculations can naturally be made for the other maximum voltages/currents and for other smallest steps! You might even make it switchable and have several settings! We will discuss the maximum current towards the end and what you can do if you need to increase it! It is not that easy to increase the maximum voltage so I will not go into that!

Another decision to make is what kind of input supply you will use! I have already mentioned my decision to go with an old portable computer supply – 19V and 2.4A. (See picture!) It is very handy to offload all the “conversion” from mains AC voltage to a suitable DC voltage to that small box! I can at any time swap this for a supply with higher voltage and current – as long as it is below 32V and 4A. Anything that delivers over 9V can be used – as long as it is sufficient for you! In case you are troubled by the radio noise from switch mode power supplies you can easily use a transformer, rectifiers and proper big capacitors instead! 🙂 Just remember that the maximum usable voltage depends on the components ability to handle the voltage. In our case the LT6105 and CA3140 will both go up to 36V but the LM358 will only handle 32V. In case you need those last volts – just swap the LM358 for another op-amp which can handle the voltage! (Like another CA3140!)

Placements

Having placed the active components on the perf-board and decided on the smallest steps for voltage and current according to above we have to fit in 8 of 1/4 W resistors, 3 small ceramic capacitors and the 3 trimmer on the board as well. There will be some other components added off-board! I have calculated the resistors to give a reasonable range of adjustment and at the same time give a reasonable precision with the trimmers. You can see how I placed them in the picture on top – note that I have turned the picture a quarter turn anti clockwise! I had an issue with space so one of the trimmers is a low profile multiturn trimmer so that it can fit under the edge of the display board. No other reason! You could have all as multiturn trimmers – especially if you want to have greater ranges to trim over and/or want more ease in precise adjusting – but it is not necessary I think! (We will see if I will have to change this when I start adjusting …) There will probably need to be a few more resistors for feedback adjustments – but we will see about that very soon …

According to above decisions the resistors picked were: 180k, 33k, 22k, 10k, 2.7k, 1k, 2 x 300 ohms. Trimmers: 100k, 2.5k and 5k. Capacitors: 0.1uF, 56pF.

Next time it is ANALOG TESTING TIME! Hurray! 🙂
But also a bit scary …

See you soon again!
/Sfenn

Ar2uino Digital PSU – 5

Next up is to test the two MCP4725 12 bit DACs! First of all you have to find the I2C addresses to be able to communicate with them. You can select one of two available addresses by pulling a special pin on the DAC low or high. If you set them like me by soldering over the Address bridge points – the left one to VCC and the right one to GND (See the picture above!) then their addresses will probably be 97 and 96. Or if you, for some reason, want them in hexadecimal: Hex=0x61 and 0x60. Easiest is to find the addresses by scanning the available I2C addresses. That is nothing like rocket science – just sweep the address within the range 1-127 and se when you get a response!

The I2C bus allows for addresses 0-127. According to I2C-BUS several addresses are used for special purposes so only 112 addresses are actually available! 0 is reserved for “broadcasts” to all devices on the bus at once. 1-7 and some other spread out addresses are also reserved so what remains are actually only 112 addresses within the 8-127 span. Code for scanning the I2C bus can be found here!

After having found the addresses to be used to access the DACs we should test to see that they work as we expect them to! Better to be safe then sorry! We do this by connecting a small load of around 100k and a voltmeter across the output of the DAC and GND and sending it commands to set the output voltage (Code below!). The MCP4725 DAC uses its VCC as a reference for maximum voltage. So in this case where we have an ideal VCC=5V the output will be in the range 0-5V or whatever voltage we use as VCC. In real life it could be 4.93V or 5.12V or anything near – depending on the tolerance of your sample of voltage regulator.

DACs Testing

The control of the DACs is through the “Wire” library and as the MCP4725 is such a simple component we do not really need any libs to control it – except for the “Wire” lib for the I2C communication. 😉 I have written a small testprogram that will output 20%, 40%, 60%, 80% and 100% of the supply voltage and wait 10 sec between changes so you will have time to measure the voltage at the output pin! Measure the voltages and compare to what it should be! Be sure to compare the output to the supply voltage – at the MCP4725 VCC pin! Then all you have to do is the percentages! Be sure to run it for both DACs by changing the “61” to “60” for the DAC_ADDR. Mine were very good – with a max of 12mV deviation from linearity!

NOTE: If you power this (while building and testing) through the USB cable then you will probably have a much lower supply voltage than from the 5V voltage regulator as seen below! This is due to losses in the USB cable. In my case the supply voltage from the USB cable was only 4.71V! Nothing to worry about during this testing! We will be testing it with the proper 5V regulators later.

Download MCP4725 Testcode!
As usual, clicking the button on the left to bring up a new window with a text only PDF.
Copy all of the code and then switch to your Arduino IDE and paste it in a new empty window.
Compile and upload to the Arduino! Ready!
(This roundabout way via a PDF is because WordPress will not allow text- or ino-files!)

Voltage regulators

As long as the supply voltage to the DACs is stable it does not matter that much what exact voltage it is! The MCP4725 can handle 2.7-5.5V. They are 12 bit DACs so they will offer 4096 steps (0-4095). That means that each step of output voltage will be 5/4095=0.001221V if we have exact 5V as our VCC. That is just a little over 1.22mV per step. Later in the project you will see that by designing the following output stages of our DPSU for having a maximum output setting of 40.95V* we will get a very neat step of exact 10mV. We will be using trimmers to set the exact ratio so do not worry about the exact voltages now!
* This is only the maximum setting that the DPSU will be able to set!

How high voltage the DPSU will actually be able to deliver depends on its input voltage! If you feed it with 25V it will be able to deliver a maximum of a few volts below 25V! And so on to the maximum input voltage of around 32V – that is the max voltage that the used ICs can handle! I myself intend to use a power supply from an old portable PC. If you know that you will always stay below 20V then you can actually have 5mV steps instead! More about this later!

To power the digital electronics with a stable voltage and to offer two fixed output voltages two voltage regulators with 3.3V and 5V output are fixed to the bottom of the case using it as a heatsink. In my case it is a L7805 5.0V regulator (to the right in the picture) and a LM317S variable voltage regulator set for 3.3V. You can use any voltage regulators that you have laying about as long as you can get 3.3V and 5V from them! Later tests will show if it is a good idea (stability wise) to allow the supply voltage used for the DACs to also be used as an external supply … with its variations in load!

A small perf board is used to hold the resistors that are used to set the output voltage and the in-out capacitors. I was given a number of surface mount LM317S from a friend (Thanks Erik!) and I made a small angled aluminium piece to hold it pressed against the bottom! (See picture above!) Maybe I am over-careful but I use a spring washer to absorb any thermal variations in size. They are just connected as in the datasheets with capacitors both at input and output! If I were to give you one piece of advice – except for wearing sun screen – it would be: Use a slightly bigger perf board than I did! 😉

The only unusual construction detail is that I bent the pins upwards and soldered the regulators from the bottom side – to give the perf board some distance to the bottom of the case. NOTE: Also remember to use silicon pads to isolate the regulators metal parts from the metal case!

This means that we are finished with the digital part of the Ar2uino Digital PSU! 🙂

Next time we will start with the analog section!

See you soon again!
/Sfenn