View Full Version : applying 18X 'standalone' with transistor and leds
TitusVerbeek
18-01-2006, 13:22
Dear people,
After finally managing to get the bc337 transistor to feed 24 leds using an 18X pwmout signal I would like to lift the 18X out of the programming circuit to get it to do the same thing as before but without the programming part.
Connecting only -0V, +5V, PWMout, and the desired input pin to the chip didn't seem to work properly. Does any of the resistances from the programming circuit need to be moved WITH the picaxe chip?
I use the programming circuit for reference here:
<A href='http://members.chello.nl/t.verbeek6/bestanden/picaxe18xoperatingcircuit.jpg' Target=_Blank>External Web Link</a>
Edited by - TitusVerbeek on 1/18/2006 12:24:39 PM
BeanieBots
18-01-2006, 13:46
Reset must be held high and program input must be held low. It is good practice to do it with a resistor (but not essential, hard wire is OK). For the sake of a second resistor and socket, you can have in-circuit programming.
You'll need to keep the 4K7 pull-up from Reset/MCLR, but the Reset Button can go. It <i>may </i> be possible to wire straight to +V but I recall that's no longer recommended and can cause in-rush current damage - You'd need to research that before wiring to +V or leaving unconnected.
The 22K/10K can go, but Serial In <b>must </b> be connected to 0V ( directly or via an R ) for proper operation.
TitusVerbeek
18-01-2006, 14:23
So then my circuit would look like this? (please double check, I seem to go wrong from time to time)
<A href='http://members.chello.nl/t.verbeek6/bestanden/picaxe+transistorcircuit.jpg' Target=_Blank>External Web Link</a>
Edited by - TitusVerbeek on 1/18/2006 1:24:14 PM
TitusVerbeek
18-01-2006, 15:04
And then: I would like to remove the 5V batterypack and use the 12V powersource also for the picaxe using a - I measured - 100 or 200-ish k resistor?
<A href='http://members.chello.nl/t.verbeek6/bestanden/18xcircuit+transistor+only12Vpower.jpg' Target=_Blank>External Web Link</a>
That's outside my hardware knowledge. A 4V7 or 5V1 Zener plus a suitable R would probably work. That 220K looks to be on the too large size to me. I'd have used a 7805 or an equivalent low-dropout regulator.
TitusVerbeek
18-01-2006, 16:14
What you're saying is outside my knowledge too.. :-) But what I guess is that a Zener can make 12V out of a 5-ish power source, and that voltage regulators might be able to make 5 volt from 12?
I chose the 220k resistor by measuring the voltage after the resistor (without anything connected) but I'm NOT sure if this is reliable. 100k or less would probably be fine but I am willing to start with 220k without being afraid of my picaxe chip... IF this kind of method looks appropriate to the experienced like you. (but I guess not)
Edited by - TitusVerbeek on 1/18/2006 3:18:37 PM
BeanieBots
18-01-2006, 16:54
No, totally wrong concept.
I cannot see your diagram at the moment and in a bit of a rush.
I'll get back to you with more detail in a few hours but do NOT do what you have described.
Yes, both zener and voltage regulators will give a usable 5V supply.
With the R to 12V through a meter to 0V you are effectively creating a potential divider, so if it's reading 5V you can calculate what the resistance of the meter is, and the current being drawn, but it doesn't tell you much else.
If the 200K is dropping 7V (12-5), the current through it can be determined (V=IR) and that gives 35uA, far less than a PICAXE needs. To handle 5mA, it should be 1K4, for 10mA it should be 700R. If there's a fixed R then as the current changes the voltage drop changes and the voltage to the PICAXE will change, potentially damaging it. The Zener clamps the voltage, but I'm sure there's more 'magic' to it that those who've done such things may understand better than me.
Edited by - hippy on 1/18/2006 4:04:51 PM
I checked out the diagram...I'm with beaniebots on this one. DO NOT DO THAT! You will release alot of magic smoke.
Youd be much better off with a 5 volt supply going through there. As it is now, your going to toast just about everything. Really. Blame that thevenin guy ;).
--Andy P
BeanieBots
18-01-2006, 18:25
I've just had a look at the diagram and as stated by andypro, "You WILL release alot of magic smoke".
It would be like trying to fix up a book shelf using a hinge at one end (the 0v line) and elastic bands from the ceiling at the other end (the 200k). After getting the elastic bands just right to get it level, what would happen when you added another book or took one off (turn the Leds on/off)?
Not sure how/why you arrived at 200k because my sums suggest that would not supply enough current to get a PICAXE up to 5v even when asleep let alone driving a 2k load. With the LEDs (trying) to be on, the supply would drop to around 0.1v (plus maybe an extra 0.6v because of the base bias voltage on the transistor). So, hopefully, if you have powered up, no damage will actually have happened.
I strongly suggest a 7805 type regulator and DON'T FORGET THE DECOUPLING CAPACITORS and at least some form of reservoir capacitor or you will not get reliable operation.
I know some people might suggest a zener form of regulation but you need to get the values right and take into consideration what affect the variations in load will have on the zener current and hence your supply voltage. If you don't want to (or cannot) do those calculations, then use a proper regulator.
BeanieBots
18-01-2006, 18:34
On another note, what colour are your LEDs?
I ask purely because there might be scope to reduce the overall current drain on your poor old transistor without loosing LED brightness. It would also reduce the amount of power your supply needs to deliver. Not essential but I have a thing about wasting electrical energy.
TitusVerbeek
19-01-2006, 11:31
Me too! (don't spend too much energy-thing) In the picaxe programm the PWMout for max. brightness is limited to 80% duty. (I could see no difference in brightness after 80%) But since getting the transistor to do its job was quite a hastle I'm no longer sure if the leds shine at full brightness. (seems less) I might lift that 80% back to 100% if needed.
About the powersupply: ****! This is getting out of hand. I'm thinking of dropping the whole project and buy me some standard dimmers. Too much burdens by now. (unless you say this 7805 regulator is really the only extra component I will need and it will defenately work at once without any experimenting and changing resistances)
By the way, the leds are yellow and white. (50-50)
Edited by - TitusVerbeek on 1/19/2006 10:32:02 AM
The power supply isn't as hard as you may think; yes, the 7805 will do all you need, and will work 'out the box'. It's a three pin device; volts in, 5V out and 0V. It is recommended to put 100nF caps between Vin and 0V and 5V and 0V close to the regulator.
And that's it.
Edited by - hippy on 1/19/2006 10:42:02 AM
TitusVerbeek
19-01-2006, 12:06
Ouff! (relief) Thanks!! It would be a shame if I dropped the project.. too much potential for me.
Thanks!!
BeanieBots
19-01-2006, 12:40
Yes, it really is that easy. You can get a 7805 for about 1GBP and it does all the hard work for you. The capacitors ARE important. The value of them is not critical. As suggested by Hippy, 100nF is a good value. I use 220nF because I have a lot to hand but anything between about 47nF and 470nF will be OK. You should get 3 of them. Two of them for the regulator fitted so that their connections are as close as possible to the regulator pins. One between regulator input and 0v, the other between regulator output and 0v. The third capacitor is for what is called "Decoupling". When a PICAXE 'does something', for a very small fraction of a second it pulls a large current from the power supply. The decoupling capacitor acts like a small reservoir of energy a bit like a ballast tank in a compressed air system. It should be fitted between 5v and 0v as close as possible to the PICAXE supply pins. With a simple circuit like yours, you can probably get away without one but for the sake of a few pence, fit one anyway. For bigger circuits with more chips and longer connections, they become ESSENTIAL.
TitusVerbeek
19-01-2006, 13:11
Great, Beaniebots, thanks for the clear explanation and (with that, the essential) encouragement. I know what to do (and will for more of these projects)!
Q : Is your 12V supply actually a battery as per the circuit diagram, or is it coming in from an external PSU ?
If using an external PSU you'll likely want a 'reservoir capacitor' on the feed to the 7805 as well as suggested earlier; 470uF/16V upwards will probably do.
TitusVerbeek
19-01-2006, 14:09
I adjusted the circuit accordingly. (but this might change - I have not looked at the regulator datasheet yet)
<A href='http://members.chello.nl/t.verbeek6/bestanden/18xcircuit+transistor+only12Vpower.jpg' Target=_Blank>External Web Link</a>
Edited by - TitusVerbeek on 1/19/2006 1:13:06 PM
TitusVerbeek
19-01-2006, 14:16
I use a transformator (is that proper enghlish? in Dutch we use this word: two spools with different number of windings in order to get the appropriate AC) and a diode bridge (with capacitors) from an old radio.
BeanieBots
19-01-2006, 14:31
The english word is transformer.
Please double check that you have the input and output pins for the 7805 the correct way round. Normally, with the device tab down and the legs towards you, the left pin is input, the middle is 0v and the right pin is 5v. Check the data sheet carefully.
You should show the complete circuit including ALL components used to make up the power supply so that we can give you the best advice.
TitusVerbeek
19-01-2006, 19:10
Right. I don't know how the sign for transformer is... two spools next to each other?
BeanieBots
19-01-2006, 19:41
The post by ylp88 in the following thread is close enough.
http://www.rev-ed.co.uk/picaxe/forum/topic.asp?topic_id=3818&forum_id=21
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.