Hi, Master
may be there's your idea here ...
Alain
Hi, Master
may be there's your idea here ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
mackrackit, I have a glass of water here that i was using to test the water sensor.
skimask, The problem with 50Hz or any oscillating input is that the PIC detects multiple inputs. Im sure its easy enough to program around that but ive not got that far yet
Acetronics, that looks just slightly complicated. I dont think ive got half the components in that diagram anyway
dhouston, Its a PIC16F877A. Doesnt really matter much about which pin. I guess it wouldnt hurt to add diodes in myself just to be sure. I did a search for "clamp" in the datasheet so thats why i didnt find anything. "clamp" wont find a diagram
Dave
Always wear safety glasses while programming.
That was a joke by the way! I probs should get a fire extinguisher though with some of the things i do.
My point with 50Hz is that the PIC thinks the smoke machine is ready then not ready 100 times a second. Ive been thinking about the code for that and it should be really easy. Just a variable that counts down to 0 from whatever value (i havnt worked that out yet). If it gets to 0 then there is no power, otherwise the input will turn on again before it reaches 0 and reset the variable to its start value
And safety glasses. I always wear them when I write code.
As skimask saidMy point with 50Hz is that the PIC thinks the smoke machine is ready then not ready 100 times a second. Ive been thinking about the code for that and it should be really easy. Just a variable that counts down to 0 from whatever value (i havnt worked that out yet). If it gets to 0 then there is no power, otherwise the input will turn on again before it reaches 0 and reset the variable to its start valueShould not be a problem.You'll probably have to put a diode inline with the PIC pin and maybe a small R/C network behind that to filter out the 50hz half-wave and get a decent reading at the PIC
Dave
Always wear safety glasses while programming.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
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