Power supply control ?

Hi all the experts, i am looking at building a unit to control/regulate a power supply with a output of 0-12vdc and would appreciate any help suggestions as to how to achieve this. I need to make something similar to the power supplies used by tattoo artists that allow them to make adjustments to the frequency/duty cycle etc something similar to what this item will do http://www.ebay.co.uk/itm/New-White-Pro-Digital-Dual-Hurricane-HP2-Tattoo-LCD-Power-Supply-SS-Pedal-/370957110943?pt=LH_DefaultDomain_0&hash=item565ec44e9f I wish to know if something like this is possible using the picaxe processors and some clues etc of how to go about it if anyone can help
 

BeanieBots

Moderator
You will need to supply a lot more information to get any meaningful help on this.
I had a quick look at the link but could see no information about even the basics such as current and frequency.

In my day, the supply was constant (eg car battery) and the 'pen' did the regulating by use of adjustable tension springs and variable contact gap similar to an old-style door-bell. It now looks like the 'pen' is little more than a diaphram driven by pulses. However, we would need very detailed information on how the 'diaphram' needs to be driven.

It is certainly possible with PICAXE and probably very easy but that would depend on if simple on/off drive is acceptable or if there needs to be any type of profile.
 
Thanks for the reply, what i am trying to do is something similar to the link i want to be able to preset all the power supply settings like the duty cycle / frequency etc with some type of controller. I addition also include the clock and timer into it to measure how long the supply has been running. I have looked at some of these types of units available for tattooists that will allow them to fine tune their power supply for better tattoo gun operation and this is the type of thing i want to make for another purpose
 

rossko57

Senior Member
So, do you want variable voltage? Any shape to the waveform, or just square? Duty cycle, frequency, run time measuring are all possible with Picaxe
 
Just been reading through the specs on one such controller offered here http://www.infinity-tattoo.com/ that does what i want to achieve i.e. You can adjust the duty cycle and frequency INDEPENDENTLY without having to adjust the VOLTAGE. I want to do the same by placing some type of controller between the variable power supply and the equipment setup different settings which could be saved if possible as the unit above will
 

BeanieBots

Moderator
PICAXE can do all of that, including saving for recall later.
Let's ask again. What do you want it to do IN DETAIL.

Your question is a bit like going to a car show room and asking "can your cars get me from position A to position B"?
The answer is most likely to be yes, however, if A is across the water from B you might need some other means of transport.
 
Ok i will try to explain what i want to do in a bit more detail. I need to build a variable DC power supply that can either be included with the controller or separate ( this i have no problem with) then i wish to make a controller of some kind that will be part of the power supply or seperate. If the unit is seperate then the output of the power supply will be used as the input of the controller and the output of the controller will be used as my control supply. With the controller i would like to be able to do the following.
1 adjust the duty cycle of the input
2 adjust the frequency of the input
3 if the power supply is built into the same unit then control the voltage level between 0-12
4 use a lcd display to show the current settings
5 have the ability to save the settings
6 include a realtime clock and timer function
this is basically what i want to start with before deciding how i can improve the design to do more.
I am still not sure if this is what needs to be known in order to get some more info on how to start but from what i see it is basically doing the same as the links i provided and wondered if they where simply using a mini processor
 

rossko57

Senior Member
We can't tell how the commercial product is made. We can guess it probably does have a microprocessor or two inside.

You probably want to think about your specifications a bit more e.g. adjust the frequency - sure, but from what to where? etc.

For "where to start". see the Picaxe manuals. Look into Picaxe PWM
http://www.picaxe.com/BASIC-Commands/Digital-InputOutput/pwmout/
and EEPROM usage
http://www.picaxe.com/BASIC-Commands/Variables/write/
and some of the displays
http://www.picaxe.com/Hardware/Add-on-Modules/

You will need extra circuitry to switch the power output, depends on the voltages and currents involved
 

BeanieBots

Moderator
Ok i will try to explain what i want to do in a bit more detail. I need to build a variable DC power supply that can either be included with the controller or separate ( this i have no problem with) then i wish to make a controller of some kind that will be part of the power supply or seperate. If the unit is seperate then the output of the power supply will be used as the input of the controller and the output of the controller will be used as my control supply. With the controller i would like to be able to do the following.
1 adjust the duty cycle of the input
2 adjust the frequency of the input
3 if the power supply is built into the same unit then control the voltage level between 0-12
4 use a lcd display to show the current settings
5 have the ability to save the settings
6 include a realtime clock and timer function
this is basically what i want to start with before deciding how i can improve the design to do more.
I am still not sure if this is what needs to be known in order to get some more info on how to start but from what i see it is basically doing the same as the links i provided and wondered if they where simply using a mini processor
A PICAXE should have no problem doing all of that at all.
All we need are the DETAILS and we can start helping you to produce some code.
When you give DETAILS about the hardware we can also start to help with the drive/power supply design.
 

Roman505

Member
Here is some of the detail you could fill in, to help people to help you.
1 adjust the duty cycle of the input
From what to what? To what end?
2 adjust the frequency of the input
From what to what? To what end?
3 if the power supply is built into the same unit then control the voltage level between 0-12
You mean linearly, I take it, rather than by PWM.
4 use a lcd display to show the current settings
Which current settings? Voltage? PWM? Frequency? Two or three of these? Simultaneously or alternatively? Progressively in a cycle?
5 have the ability to save the settings
All settings, I take it? If they have been saved, is this simply to restore prior state after power cycling (non-volatile) or might you vary state and then return to saved settings?
6 include a realtime clock and timer function
Does the RTC have a function other than timing? Count up or down or elapsed? What of these will be displayed?

HTH. There is nothing like improving your specification to help with improving design. :)
 
Ok sounds like i better think about my project a little deeper and then post some better details for help, thanks for the replies everyone:confused:
 
Ok after doing lots of searching the internet and this forum for ideas i think my best approach would be to attempt to build my project in blocks before attempting to combine it all, this way i think i will be able to learn more about what each function is doing and how it is controlled via the picaxe.
My first block needs to be the power supply and for this i want to utilize a redundant switch mode laptop power supply with a output of 18vdc at 3.5amp, i want to be able to regulate this output from 0-15vdc and if possible be able to adjust the current limit from 1-3amp. I would prefer that the adjustments are made digitally and not using potentiometers. So if someone can give me some pointers or examples of how to achieve this block it would be my start.
My second block would need to take the output from the first block and control the duty cycle 0-100% and the frequency 50-160hz again this would preferably be made digitally.
My third block would display the outputs on a lcd screen so that i can see the voltage / duty & frequency settings.
I think these are the three things that i need to start on first before getting to deep with it and allowing me to build and learn what each section is doing.
I hope someone can now give me starting point so i can get on with the learning curve.
Also a recomendation as to the picaxe that would be required to do all this (do i go for the biggest available first to allow for expansion of the project ?)
 
Hi "bfgstew" thanks for the reply, i have taken a look at the link and there is some very useful information regarding his variable power supply and current limiting however this is analog controlled psu with pots and i would really like a example of a fully digital controlled psu using the switch mode supply i already have and not need to make the complete supply but simply vary the output of the one i have as these are relativly cheap to obtain and more economical that building one from scratch.
 
With reference to my earlier post with the details of the variable power supply i want to build i forgot to add the increments that i need to control the adjustments by.
The variable voltage 0-15vdc needs to have a setting that will allow the voltage increment to be adjusted by either 0.1 volt, 0.5 volt or 1 volt , the frequency should be adjusted in 1 hz increments and the duty in 1% increments.
 

inglewoodpete

Senior Member
It is unlikely that any forum member has made a power supply similar to what you want. The idea is very specialised but quite do-able if you have the skills to develop and test the hardware and software required. However, you will have to do 99% of the work yourself, since it is essentially your project.

Having said that, you can modify an existing design, like the one posted by bgfstew. Since that design uses analogue controls, you could start by using digital potentiometers (Eg Microchip's MCP4xxx) or a DAC (Eg TI's TLC5620). I have used both to interface between PICAXEs and analogue equipment.

The question you have to ask is "Are my skills at a suitable level to start a project like this and take it through to completion?"
 

BeanieBots

Moderator
The question you have to ask is "Are my skills at a suitable level to start a project like this and take it through to completion?"
My thoughts too:-
What you are seeking to do is no small task and will require a good understanding of electronics to get right. People here will be more than willing to help but I doubt many will do it for you.

Take your 0-15v with 1 - 3A current limit power supply for example. (which is probably the best starting point).
15v @ 3A done analogue will dissipate around 50W which is not desirable so a switcher design would be preferred.
From scratch, that would require an in-depth switcher design knowledge.
Taking a ready-made supply such as an old laptop PSU is a good idea but it would involve reverse engineering the feedback section to add in your own control. That could be a simple I2C pot or (better) adding a summing amplifier which would enable both current and voltage control. (How good is your op-amp theory?).
You could put a linear front-end on but again op-amps would be the best control and again you'd need to get rid of the best part of 50W at low voltage high current settings.

So, if you can take on the power control electronics, it should not be beyond this forum to help with generating demand signals to feed into it.
 
Thanks for the replies, although not a professional my knowledge of electronics i would say is above average and with bits of input i can usually figure most out with the use of books or the net. I think i should be able to vary the output voltage from my power supply with the use of a op-amp and the pwm output of the picaxe via a LM317 and a 3055 or similar. To control the duty and frequency i found a little example using the TL494 and controlling the duty and frequency independently, unfortunately no schematic was shown in the example to look at, the link is here http://jumperone.com/2011/11/pwm-generator-part1/ has anybody used this ic for the this purpose and maybe know where there are any examples of something similar or any alternatives to this ic as it is rather old now (but still available). The example shows the duty and frequency controlled via pots and i will attempt to prototype this first to see if i can obtain the results i need before looking into converting the inputs to picaxe controlled
 

rossko57

Senior Member
Using a LM317 prompts that "you will need a big heatsink"

The TL494 project is nothing like your voltage and current specs. Generating PWM control signals from a Picaxe is quite easy ; you need to find an external driver circuit. Perhaps look at some motor controllers for ideas.
 
I dont think a big heatsink will be a problem at the start of my project. Although i have used the pwm control before for motor control i dont think it will really do what i want working with the frequency range i need 50hz=160hz approx, i have read through the pwm control programming but dont see a way to control this frequency range with a 0-100% duty cycle both of which need to be independent of each other and the amplitude.
 
After doing a lot more searching and reading can somebody tell me if the DAC output on the new M2 ics ( i dont have one to test yet ) will directly drive a op amp voltage follower with gain which will in turn directly control a 3 terminal voltage regulator like the lm317 or similar. If its possible i can go ahead and get some M2 chips ordered for testing before using up my stock of older versions
 

AllyCat

Senior Member
Hi,

There are several issues:
-The DAC output is the Serial Output pin on most M2s (but still can be used).
-The output impedance is high and variable (approximately 5k to 40k ohms), probably too high to be used directly as the reference for most regulators (so you would require an opamp as well).
-The D/A output has only 32 steps (fractions of the reference value).
-The internal reference (FVR) is not particularly accurate (datasheet says about +/-5%)

So a (filtered) PWM output might be a better solution.

Cheers, Alan.
 

Paix

Senior Member
I can't comment about the merits of controlling an LM317 regulator, but a voltage follower, with gain?

A voltage-follower/buffer followed by a gain stage, double op amp implementation. Trying to get the one op amp to do the job would start to compromise the high impedance buffering as you introduced gain components. There are many dual and quad op amp packages available. Indeed it may have been what you intended?

Not a professional quality answer, but an observation from the floor.
 

BeanieBots

Moderator
An ultra high input impedance non-inverting amplifier is very easy with a single op-amp and two resistors.
My concern would be the use of that faithful old dinosaur the 3055!
Its hfe is typically ~15 and a standard op-amp would not be able to drive it direct.
 

Paix

Senior Member
Thanks BB, I'm genuinely the wiser for that - clearly self trained here, skipping the difficult bits like op amp details and anything beyond the very basic transistor biasing requirements (conduct, no-conduct).

I hadn't read back beyond the beginning of the page and picked up the wider picture as post #21 appeared to be almost self contained.

I guess that the NE3055 is definitely not surface mount - the metal content of the package alone must make it an expensive device - if you can still buy them.
 

AllyCat

Senior Member
Hi,

The variable voltage 0-15vdc needs to have a setting that will allow the voltage increment to be adjusted by either 0.1 volt, 0.5 volt or 1 volt ....
Is that still your specification? You're unlikely to be able to achieve (all) those increments with the 5-bit (32 level) D-A converter in the PICaxe.

Cheers, Alan.
 
Yes everyone is correct and i would not achieve my specs from earlier by using the DAC output of the picaxe, however my specs have changed slightly and the adjustment by .5volts is no longer required. I am looking into the filtered pwm control or alternatively a DAC chip with 8 or 10 bit and control this with the picaxe, i have found some that are i2c control and maybe this would be a option as i think i can use my 4x4 keypad and lcd on the same bus or would this not be advisable.
 
Thanks for the link lbenson i missed that one when doing my searching, reading through it now and very interesting and educational for us novices.
 
Have been doing some reading and playing around with the example code in the digital potentiometer link above and was wondering if somebody can tell me how to convert the output from millivolts to volts with a decimal place. I have been trying different methods but cannot seem to figure it out, if i want the output to be say 4.92 volts instead of 4920 mV how would i achieve this ?
 

inglewoodpete

Senior Member
Code:
w3 = 4920
Bin2Ascii w3, b10, b11, b12, b13, b14
SerTxd (b10, b11, b12, b13, b14, " millivolts", CR, LF)
SerTxd (b10, b11, ".", b12, b13, b14, " Volts", CR, LF)
Leading and trailing zero blanking requires a more complicated piece of code but is still achievable.
 
Thanks inglewoodpete for the reply, i played around with bintoascii for a while using the same procedures but could not get the results i was looking for but this works perfect with a few changes to suit what i want
w3 = w1
Bin2Ascii w3, b10, b11, b12, b13, b14
SerTxd (b10, b11, b12, b13, b14, " millivolts", CR, LF)
SerTxd (b10, b11, ".", b12, b13, " Volts", CR, LF)
I will now play around with removing the leading zero when not required but this looks straightforward enough i hope.
 

AllyCat

Senior Member
Hi,

Note that BINTOASCII is a "macro" command which the PE converts to basic commands that can be quite wasteful of Program space and variables. If you don't use all of its facilites (e.g. all 5 digits), or need to do further formatting, then it can be better to "Do It (all) Yourself". This may even avoid the need for "magic" commands and give a better understanding of what the PICaxe is actually doing : ;)

To obtain (integer) Volts from millivolts divide by 1000, and for the part after the decimal point, calculate the remainder ( using // or %). If you only want two decimal places then divide by 10 afterwards. But be very careful that any important leading zeros do NOT get lost ! Note also that in this particular comparison example (below), it IS valid to use a byte variable, b11, because the calculation is performed with word variables and only "assigned" to a byte at the end.

Code:
w3 = 4025
version1:
BintoAscii w3, b10, b11, b12, b13, b14
SerTxd (b10, b11, ".", b12, b13, " Volts", CR, LF)
version2:
b10 = w3 / 1000    ; Integer Volts
b11 = w3 // 1000 / 10    ; "Centi-Volts"
SerTxd (#b10,".")
if b11 < 10 then
	SerTxd ("0")
endif
SerTxd (#b11," Volts",cr,lf)
The second version only uses 2 byte variables instead of 5 and the program code is about 20 bytes smaller. ;)

Cheers, Alan.
 
Having done more research and reading i have some parts of my power supply figured out and tested by using information from members and threads/tutorials in the forum and manuals. I recently tried and tested the digital potentiometer from westaust55 very good tutorial on the forum and would now like to prototype the dac tutorial by westaust55. However in his tutorial he has used the MCP4821 and i dont have any of these to play around with but i do have some DAC8512 can somebody please tell me if these will work using the same code as in the tutorial (Digital to Analog Converters 101 by westaust55) as the pinouts on my dacs have slightly different names. The two spec sheets are here. http://ww1.microchip.com/downloads/en/devicedoc/21953a.pdf and here http://www.analog.com/static/imported-files/data_sheets/DAC8512.pdf
 

hippy

Ex-Staff (retired)
You will need to modify the code and perhaps the hardware interface; the two are significantly different to each other.
 
Thanks for the reply hippy, as i am no expert in either the programming of the picaxe or the hardware interfacing and simply learning by trying examples from other contributors until i have some knowledge of how it has been done and hopefully learning along the way. I have looked at the two data sheets and see that the pinouts are more or less identical to each other apart from some name changes, the pins used in the example code from westaust55 would be the same as the pins on the dac8512 so would the code not do the same with this dac to give me a insight into how the operation has been acheived, i can then modify this to suit my needs as i want to control via a keypad. The hardware interface would simply be using the vout through a opamp to a regulator
 

hippy

Ex-Staff (retired)
From a quick glance at the datasheets the MCP4821 seems to expect a 16-bit data packet, the DAC8512 expects 12-bit. That leads me to believe some change needs to be made to the code.
 
Hi hippy am i missing something here, but both data sheets say 12 bit DAC operation so i am assuming they are both the same 4095 step resolution.
 

hippy

Ex-Staff (retired)
That is true; they are both 12-bit DAC, both have 4096 step resolution, but they way they are controlled and instructed to create the DAC output is different.

You can pass a note in English to an English speaking person and what it says will be understood, but pass the same note to someone who only reads Chinese and they will not be able to understand it.
 
Top