Maker Pro
Maker Pro

Building a circuit

JP79er

Jun 17, 2013
4
Joined
Jun 17, 2013
Messages
4
I have a project that i want to take to the next level and wonder if you cna help me with it.

I have build a magnetic stirrer which works fine, but intend to try it out for other uses and one of which is to power a power head in a marine reef tank using the magnetic stirrer method,
Now it all seem pretty straight forward until it hit the point of controlling the fan speed.

I wan' to introduce a circuit that runs of my 12v 1.5amp supply pack and provide and power output 5v for 15secs, then around 8v 30 sec, and then 12v for 3Minutes then back down to 8v then 5v and so on repeating the process of ramping up and down the speed of the fan

How on earth would i go about finding out what components i need to create this and if possible introduce a level of control over the output of voltage and duration?
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
What you want to do should be done using Pulse Width Modulation (PWM) generated and controlled by a microcontroller (uC) as it's heart. This would be a trivial job for an easy to learn Picaxe-08M2. This is not to say that it can't be done without a uC. In fact we have a member (Kris Blue) who relishes supplying discrete circuitry design. It will invariably be far more complex and costly though. ;)

Chris
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Chris, in many cases a discrete design (as opposed to a microcontroller-based design) is only more complex if you assume that the user already has microcontroller programming experience, and will only be more costly if you assume that the user already has the necessary programming setup.

I agree that PWM is the answer here; the issue would be how best to generate it. In this case I think a micro might be the best choice, because it seems likely that he will want to play around with the control behaviour. On the other hand, this could probably be done with a 556 - one half to generate the ramp (assuming a steady ramp-up is acceptable), and the other half to generate the PWM signal.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Ha Kris, I'm disappointed! When I said discrete it was meant literally. Absolutely no chips but a Darlington wouldn't be held against you! :D

Seriously though, from JP's description I think he needs steps not a ramp. ;)

As far as Picaxe is concerned there's no programming hardware, or software cost. Just about everyone has a USB/Serial dongle or an old PC with RS232. If not both are dirt cheap.

Chris
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Fair enough mate :) Yes it's true, I think fully discrete can be fun.

Yes, I saw the steps too. I just thought that a ramp might be better, since it's simpler to implement (if you don't have programmability).

Fair comment about zero hardware cost for a PIC programmer. But for someone who has never programmed before, the jump to microcontrollers could be a big one.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Kris, just so there will be no misunderstanding, I love your discrete work! ;) As for learning Picaxe Basic is concerned, the free PDFs have example code for every statement and command. They also maintain an active Picaxe forum. The PDF's are also loaded with sample schematics. Do you remember JPU (Justin the equine dentist) in Wales? I started him off with Picaxe and I wrote the initial code for him. Within two weeks he was writing his own. Admittedly he is very bright and has a can do attitude. Still, the Picaxe learning curve is about as painless as it gets. ;)

Chris
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
some one gave me a picaxe kit... must have a play with it one day
for me Kris's comment...
"the jump to microcontrollers IS be a big one."

change could to IS hahaha
As much as I would really like to play with PIC's etc, Im getting too old to learn new languages, I have enough trouble
with English, let alone Tagalog <-- my wife's national filipino language ;)


Dave
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
That's one of the beauties of the Picaxe system. You can play with the sample code in the programming editor. It includes a simulator mode. When I wrote DAC code for JPU it was all tested in the simulator. I never had a chip in front of me, just my laptop. The DAC option was new on the Picaxe, so I hadn't written DAC code before. I never left my screened patio and cold beer either. There was no surprise at all when it worked for him. Ya gotta do it Dave. Picaxe is painless.

Picaxe is designed for young students and old dogs!. ;)

Woof! Woof! :p

Chris
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Thanks Chris :) I know you like my designs. Regarding jumping into microcontrollers, I think it depends a lot on the person. Age is a big factor. If I hadn't got involved with micros at school, and carried it on, I would be daunted by the idea of embedded systems design now. Although in many ways it's easier now, what with the Arduino and other quick-start-type development systems.

What I worry about is this: Are the "young people of today" missing out on good stories to tell their grandchildren? Like having to type in a 256-byte boot loader in machine code or patching file system or memory management code to support some hardware hack. "I had to go to Google Play and download a plugin to make it work properly" doesn't have quite the same ring to it ;-)

I've asked about the choice between microcontroller (with simple hardware) vs. discrete design (complicated hardware) before. Both have advantages. It depends on the audience for the individual design.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Woof! Woof! :p

Sssssh!

Internet_dog.jpg
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Ha, Dogs! They're a funny topic.

Chris
 

JP79er

Jun 17, 2013
4
Joined
Jun 17, 2013
Messages
4
Right just trying to catch up as most of that make no sense to me at this moment in time...LOL


A ramp may be better for my uses as i assume it allows the speed to be more gradually increased rather then jumping from one voltage to the next with no inbetween.

The use for this is for use to control an aquarium pump and a more gentle increase up and down speed would create a more gentle increase and decrease in flow for my corals.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Then Kris's ramp suggestion will be the cats meow for you. Understand that the motor will always be changing speed. It will start the cycle at a low RPM and ramp it up over a 225 second period. It will repeat this cycle continuously until shut off. Since Kris will probably be using 555's and picking off the RC ramp it presents another option for you. This would be having the motor ramp up and ramp down as well. What's your flavor?

Just so you understand, this ramp will not drive the motor directly. It will control another 555 who's PWM output to the motor follows the ramp of the first 555.

Chris

Edit: That last sentence would be better stated as... It will control another 555 who's PWM output to the motor is proportional to the ramp voltage of the first 555. ;)
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Chris, you know me so well :)

Yes, my suggestion is to use two 555s, or a 556. One oscillator generates the ramp-up and ramp-down, and the other generates the triangle/ramp wave to control the PWM.

Edit: Generation of the final PWM waveform requires some kind of voltage comparison between the two signals. I think a simple transistor will do the job. There's also the issue of a voltage offset, so that (a) the ramp starts from around 50% voltage and (b) the ramp stays at 100% voltage for a long time.

I've done a simulation and it looks good. Next step is to post a schematic and some waveform diagrams. I'll probably post again tomorrow, when I'm happy with the simulation results and I've written up a circuit description.
 
Last edited:

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Chris, you know me so well :)


Ha, I figured you were already designing it before I started typing that. Creepy huh!

I have your phones tapped too! :p


Edit: Generation of the final PWM waveform requires some kind of voltage comparison between the two signals. I think a simple transistor will do the job. There's also the issue of a voltage offset, so that (a) the ramp starts from around 50% voltage and (b) the ramp stays at 100% voltage for a long time.

I'm not sure I grasp the first two sentences but I'm confident that your circuit and sim will clear that up. RE holding a PWM duty cycle for a long time. That's going to complicate things a tad. Are you sure he needs that with a constantly ramping system?

Chris
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
PWM motor controller with slow ramp-up

OK, here's my design. I think it will do what you want.

It's not simple, and not really a beginner's project. It's up to you whether you want to tackle it. If not, don't worry that I've designed this for nothing... it will be useful as a reference for other similar projects, at least.

attachment.php


Here's a fairly detailed description of the design. I will use words like oscillator and transistor that are familiar to most users of this forum; if you need to, look them up on Wikipedia. I will only give detailed descriptions of the unusual aspects of the design.

The circuit uses two NE555 timer ICs (integrated circuits) configured as oscillators. The first oscillator produces the slow ramp-up and fast ramp-down that will control the average output voltage (and therefore, the stirrer speed) and the second produces a roughly triangular wave at a frequency of about 450 Hz (hertz), which is used in the PWM (pulse width modulation) signal generation.

The first oscillator produces a control voltage at the point marked RAMP. The voltage ramps up from 4V to 8V over a period of about four minutes, then ramps back down to 4V over a period of about 15 seconds, and the cycle repeats.

These times can be changed by adjusting R1 and/or R2. R2 determines the ramp-down time at the end of the cycle, and should be 14.3 kilohms multiplied by the desired ramp-down time in seconds. For example if you want a ramp-down time of 30 seconds, R2 should be 430 kilohms.

The ramp-up time is determined by the sum of R1 and R2, using the same formula: 14.3 kilohms multiplied by the desired time in seconds. So if you want a ramp-up time of 2.5 minutes (150 seconds), R1+R2 should be 2145 kilohms, or 2.145 megohms. If R2 is 430 kilohms, R1 needs to be 1715 kilohms, or 1.715 megohms; the closest standard value is 1.8M.

The ramp produced at the RAMP point is not linear; it is slightly curved. But it is a reasonable approximation.

This ramp is buffered by Q1 and Q2, which are connected as a Darlington transistor, used as an emitter follower stage. The voltage at Q2's emitter follows the ramp, with a positive offset of about 1.4V (due to the two base-emitter junctions). This voltage has a further 1.4V added by D1 and D2, which provide a roughly constant voltage drop of about 0.7V. R5 provides the emitter load for Q2 and pulls the voltage up towards +12V.

So the signal at the node marked SRAMP is a shifted-up version of the slow ramp that's generated by the first oscillator.

The second oscillator operates continuously and independently of the first. It runs at a frequency of about 450 Hz (set by C3, R4 and R3) and produces a roughly triangular wave at the TRI node; this is shown in the blue trace on the waveform graph. The top and bottom of this waveform are 8V and 4V respectively. This signal is buffered by Q3, another emitter follower. This time, the voltage offset is negative, so Q3's emitter is about 0.7V lower than the TRI node voltage.

The two signals are combined in Q4, which operates as a crude voltage comparator. Q4 will conduct when its base-emitter junction is forward-biased; this occurs when its base is brought more positive than its emitter by about 0.7V. The base-emitter voltages of Q3 and Q4 cancel out; the result is that Q4 will conduct when the SRAMP voltage is higher than the TRI voltage.

So Q4 compares the shifted slow ramp from the first oscillator against the 450 Hz triangular wave from the second oscillator, and conducts when the former is higher than the latter. These times correspond to the times when the load should be energised. If you don't know why that works, look up pulse width modulation on Wikipedia or Google.

This comparison generates a pulse-width-modulated control signal, which is buffered and cleaned up by Q5 and produces the GATE signal (shown in green on the graph), which drives Q6, which controls the current to the load.

The action of Q4 does actually cause some cross-interference between the two signals. Specifically, when TRI goes below SRAMP and Q4 conducts, the base-emitter diode in Q4 drags the SRAMP voltage down, so that it actually follows the TRI node for that part of the waveform. This is visible in the waveform view on the red trace, which shows the SRAMP voltage. This effect causes Q1 and Q2 to lose their operating current during those parts of the PWM cycle, but that isn't a problem.

During roughly the second half of the slow ramp, the up-shifted voltage is so high that Q4 remains ON constantly. This produces the period of continuous full speed operation.

Changes in the relationship between the ramp and the PWM can be made in various ways; increasing or reducing the number of diodes in the D1-D2 circuit is a simple one. If you want a change, describe exactly how the current circuit behaves, and exactly what you want instead.

Component suggestions

Resistors are all standard - 1/4 watt (or higher), 5% (or better) tolerance. Capacitors should be ceramic or multi-layer ceramic except C1 which should be an aluminium electrolytic, rated at 16V or 25V, from a good manufacturer (Nichicon, Rubycon, UCC or Panasonic) and C3, which should be a good quality capacitor (because it's a frequency-setting component) such as polyester film: http://www.digikey.com/product-detail/en/R82EC2470AA60J/399-5873-ND/2571308.

The BC557B transistors can be replaced with 2N3906, and the BC547B transistors can be replaced with 2N3904. All types are readily available but the 2N series is more widely used in America. (The BC series is of European origin.)

Although the schematic shows two separate 555s, you can use a single NE556, which contains two 555s in a single 14-pin IC. These are available in several different technologies and from several manufacturers, with different prefixes: LM556, NE556, SA556, NA556, TLC556, KA556, TS556 and ICM7556 are all suitable in this application. Get a DIP (aka DIL) package, with through-hole leads, not a surface-mount part. The 556 contains two independent 555s with commoned VCC and GND pins. You will need to match up the pin descriptions from the 555s shown on the schematic to the 556.

You will need data sheets for the 555 and 556, and the transistors (so you can tell which pin is which). The components and data sheets are all available through the Digikey web site http://www.digikey.com.

The output MOSFET, Q6, can be any N-channel MOSFET with suitable voltage and current ratings. The MTD3055 I've suggested is readily available but there are many alternatives.

D3 is needed if the load (the stirrer motor) is inductive; I assume that it is. I've specified a 1N5817 which is a Schottky diode, but a plain old 1N4001 would be fine at this relatively low frequency. I have assumed that your stirrer draws 1A of current at 12V. If it draws more current than that, D3 will need to be up-rated to a 1N5401 (3A rating) or more.

All of these components are available as through-hole components; that is, components with wire leads that you can mount onto a piece of stripboard. I have not designed a stripboard layout; you will have to do that. If you're not experienced with circuit assembly, perhaps you have a friend who can help? If you're the adventurous type, there are plenty of tutorials available on the web, and of course the folks here can answer any specific questions you may have.
 

Attachments

  • jp79er.gif
    jp79er.gif
    21.8 KB · Views: 158

Number

Jun 9, 2013
65
Joined
Jun 9, 2013
Messages
65
To make it easier couldn't you have just used the 556? What is the purpose of two back-to-back diodes on Q2? Can't you use a beefy diode to get the Vdrop you mentioned?

EDIT:
Sorry missed your ref. to the 556. ;)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
What is the purpose of two back-to-back diodes on Q2? Can't you use a beefy diode to get the Vdrop you mentioned?
You mean the two series diodes? If there is such a thing as a high-current diode that has a 1.4V forward voltage at a few milliamps, it will be huge and expensive.
 

CluQu

May 22, 2013
14
Joined
May 22, 2013
Messages
14
You mean the two series diodes? If there is such a thing as a high-current diode that has a 1.4V forward voltage at a few milliamps, it will be huge and expensive.

Correct. I'm curious if there exist a diode to satisfy the requirements of the two. My diode parts/products is not as robust as yours. I just pick parts that don't blow sh1t up. Seems to be working thus far. :rolleyes:
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Well, there's the BAV99: two signal diodes connected in series in a SOT-23 package. That's what I would use if I was designing a product for SMT manufacture.
 
Top