Thats not so bad then, Im not sure what the rest of it does.
BTW, i do have a brain but its not working today! I didnt get to bed till 7:30 this morning then my dad woke me up at 12:00 to figure out why all the text on someones PC was too small. Ive replaced the beer with coffee but its still not enough.
I forgot about using a cap/resistor. Im sure i can squeeze them in somewhere.
The best place to connect the inputs is on portb. Ive checked the datasheet and it says those pins have the diodes so that should be fine.
I have got some safety glasses but i usually only use those for woodwork![]()
Since an input pin is a high impedance input, it won't draw any current (well, very very little current), so, if you're dealing with 50Hz, half-wave, it's almost a simple matter of figuring out what R/C time constant you want depending on values of parts you have on hand, keeping in mind that generally 5 R/C time constants is considered a full 'charge' or 'discharge'...so...
1ohm @ 1f = 1 second, 1ohm @ 1uF = 1us, 100ohm @ 1uf = 100us...and so on and so on...
50hz = 20ms per pulse, 5x = 100ms, so...just thinking in general here...
Put the signal into your PIC, tie a 10uF capacitor into that line with a 10K resistor hanging off the other end of the capacitor going to ground.
10000ohm x 10uf = 100ms
IF my figuring is right, it should work like a champ and 'hold' your signal there for the PIC to see. The only 'problem' is that it'll take the cap (and therefore the PIC pin) about 100ms to bleed off completely and your PIC might think power is still on for a few ms after it's actually off.
Ive got some random capacitors hanging around somewhere and i thnk ive got some 10uf's in there.
Right now i have another problem. If i connect either of the AC wires from the smoke machine to GND on the breadboard the smoke machine light goes off. Im not sure why the light simply goes off. If it was a short i should be sat here in darkness by now. It works fine if i inplug the USB/Serial converter from my laptop :S
Im not sure this whole thing is going to work. I tested it earlier by using a plug with 2 wires connected to the circuit. It seemed to work fine. Now with the smoke machine its not working. Ive had a look at how the smoke machine is wired and it seems that the bulb and motor are shorted out by default and in series with the heater coil. When the coil reaches a set temperature it removes the short which allows the light and motor to be operated.
For some reason when the neutral wire of the smoke machine and the GND of my serial port are connected it shorts the bulb and motor out again. It doesnt seem to be affecting anything but since its 240V being shorted through my laptop im gonna stop here.
I think the best way to go is to use opto isolators. I might not bother doing that for halloween but ill try it out in the future. Another thing i could try is completely re-wiring the smoke machine and putting a PIC inside it. That would let me do some extra advanced stuff like keeping the coil warm (safely) so i never have to wait for it to reheat. I could use the same protocol as my lights.
Bookmarks