stamp controlling lamp, controlled by Macintosh via USB
Egon 4u
Posts: 13
I have a simple application:
A Macintosh G5 running OS X is performing some task. Periodically, it will send a control signal to a black box, telling it to turn on a lamp for X amount of seconds.
The black box will have a Stamp at its core, which will use one of its I/O pins to turn the lamp on/off (lamp runs on three AAA batteries).
Basic questions:
1) What's a safe circuit to use between the Stamp and the Lamp? I know I need a resistor, followed by a transistor (1N4001?) followed by a relay. Can someone with experience in this kind of thing suggest values for the resistor, and relay?
2) The MAC's USB port is going to be adapted into an RS232, which I can easily interface to from the Stamp side. Does anybody know an off-the-shelf solution for adapting a USB to RS232 on a Mac?
I look forward to reading replies to my first posting! It's a great forum.
Egon
A Macintosh G5 running OS X is performing some task. Periodically, it will send a control signal to a black box, telling it to turn on a lamp for X amount of seconds.
The black box will have a Stamp at its core, which will use one of its I/O pins to turn the lamp on/off (lamp runs on three AAA batteries).
Basic questions:
1) What's a safe circuit to use between the Stamp and the Lamp? I know I need a resistor, followed by a transistor (1N4001?) followed by a relay. Can someone with experience in this kind of thing suggest values for the resistor, and relay?
2) The MAC's USB port is going to be adapted into an RS232, which I can easily interface to from the Stamp side. Does anybody know an off-the-shelf solution for adapting a USB to RS232 on a Mac?
I look forward to reading replies to my first posting! It's a great forum.
Egon
Comments
http://forums.parallax.com/forums/default.aspx?f=5&m=219658
I am not sure about the signals between your Mac and the stamp, but I'm someone will! [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
Maybe I should have waited to do that......
The lamp runs on DC (4 AAA batteries).
I should also mention that I have committed already to a stamp BS2, so I'm looking for some circuitry that will complement that chip, and not replace it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
I should be more specific about the "lamp". It's a siren type of lamp, which rotates and shines quite bright. You can hear the motor whirring when it's active. So it's really a lamp and a motor.
I don't have any specs on the current draw, but it must be more than the specified BS2 limit of 40 mA.
I put a meter on the motor and turned the thing on. The meter said 4.5 A and the motor did not go on! I removed the meter and the motor instantly went on.
I'm obviously not really sure how to measure the current draw of my siren. I found no specs on the web. Can a device draw so much current from 3 AA batteries?
I've also been following the discussion in "pwm power transistor" (http://forums.parallax.com/forums/default.aspx?f=5&m=218027). Very useful links and schematics. Perhaps I don't need a relay at all, and instead can use transistors with sufficient hfe?
OK, the current draw of the alarm/lamp is measured to be 300 mA (makes more sense).
So what if I used an I/O pin, to a resistor R, to the base of a 2n3904 (hfe=30). emitter to Vss, collector directly to (-) of alarm/lamp. The (+) of the alarm/lamp would be connected to Vdd, and to the cathode of a diode (anode connected to ground). Diode is 1N4001.
R is 3.8V / (10mA * 2) = 190 (say 220 Ohms).
The *2 is to ensure saturation overhead; 20 mA is within the 25 mA that an I/O pin can sink. The 10 mA in the denominator is 300 mA / 30 hfe.
Thanks for noticing that mistake. Diode will be connected across the siren.
I was just ordering the parts. I noticed that 2n3904 transistor is rated with a maximum Ic of 200 mA. I was measuring the alarm taking 300 mA, so now I am questioning the use of this part. Should I be using a high-power transistor instead? The hfe is also listed as 100/300. I was expecting hfe to be 30, based on a diagram I saw in the "pwm power transistor" thread. Am I missing something here? That application was talking about over 2 Amps of current!
For the Mac, you can use just about any USB to Serial adapter for a data link. However, if you want to use the Mac to program the Stamp, the only ones known to work well are the FTDI adapter and the Keyspan PDA adapter. Are you aware of MacBS2 for the Mac?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com