08 pic acting as rc switch

barneydog

Member
Hi,

what im trying to achieve is an rc switch.. simple on off operation nothing else.

i have been doing some research and have figured out my best option is the pulsein command. I have set this up and come to the conclusion... that the 1 - 255 act as ms... example 150 = 1.5ms is this correct ?

now my main problem is i have written the program and tried and tested many things; to no joy it just sits there pulsing the led randomly... im now at a loss..

heres the code i have.. very new to pics so using logicator for now till i get better idea...

Code:
'BASIC converted from Logicator for PICAXE flowsheet:
'C:\Documents and Settings\James\My Documents\Flowsheet3.plf
'Converted on 21/12/2010 at 22:37:09

symbol varA = b0
symbol varB = b1
symbol varC = b2
symbol varD = b3
symbol varE = b4
symbol varF = b5
symbol varG = b6
symbol varH = b7


let dirs = %00010111


main:
label_2:	pulsin 3,1,varA
		if varA > 150 then label_8	'Compare command
		goto label_2

label_8:	let pins = 4	' %00000100
		pause 3000	'Wait command
		let pins = 0	' %00000000
		goto label_2
thanks for any help :)
 

barneydog

Member
forgot to say... its not responding to the controller in the slightest...no matter which receiver channel lever or switch... just does the same repeatidly
 

SAborn

Senior Member
Why use pulsein, i dont follow there.

Whats the controller??

Basically how are you signalling the picaxe on pin3.

Do you have a schematic of your circuit.
 

barneydog

Member
they arnt using a common ground....i will try that.. Didnt want to use the receivers + as its sitting on 8v majority of the time.

The signal cable from the receiver is plugged into pin 3, giving the signal

used pulsein as it works on pulses, and the pic has the pulse coming to it.

the controller is Radiolink T6EAP 2.4GHZ FHSS

have no schematic at present....

pin 1 - +5v
pin 2 - NC
pin 3 - NC
pin 4 - input 3 Receiver input
pin 5 - output 2 led output
pin 6 - NC
pin 7 - NC
pin 8 - -v
 

knight

Member
I think what the OP is doing here, at least from my reading, is using this as an RC switch in a model plane/boat/car etc.

SAborn, if i'm right i think the answer to your question is that as its standard RC its recieving and passing onto the other devices on the plane or boat PPM (Pulse Position Modulation).
(EDIT: Beaten to the punch by the OP)

To the OP if this is the case, I wonder if its possibly noise causing your extra pulsing.
What you might be able to do is treat the switch like a fail safe, when it recieves the pulse in matching the required pulse, it doesn't activate the switch until the next two pulses are also over the required threshold.
That would significantly reduce the number of false positives.
 

goom

Senior Member
This should be quite simple. The Picaxe pulsin function is perfect for this. I have used it for many applications related to hobby RC.
I assume that you have the grounds of the RC receiver and Picaxe power supplies connected together.
Here is some code which does work. It may be more than you need, but can be simplified to suit your requirements.
Code:
'Radio control 2 channel switch using PICAXE-08 or 08M
'Either channel can operate in latched or unlatched operation.
'For latched operation tie pin3 (leg4) and/or pin4 (leg3) to +5V for channel A and B respectively.
'OutputA (pin0) will then go high the first time the receiver pulse exceeds the threshold, and low the next time.
'OutputB (pin1) will then go high the first time the receiver pulse goes below the threshold, and low the next time.
'For unlatched operation,OutputA is high when the receiver pulse exceeds the threshold and vice-versa.
'For unlatched operation,OutputB is high when the receiver pulse goes below the threshold and vice-versa.
'Change the values of ThresholdA and ThresholdB as desired to change the switching points.   
'When program first runs it assumes the transmitter "stick" is in the neutral position and calibrates accordingly.
'PICAXE-08 connections are:
' Leg 1 +5V
' Leg 2 Only connected when downloading program
' Leg 3 Channel B latching option
' Leg 4 Channel A latching option
' Leg 5 Pulse input from radio receiver
' Leg 6 Channel B output
' Leg 7 Channel A output (must disconnect the programming cable when running program)
' Leg 8 Ground
symbol OutA=0      'Name channel A output pin (leg7)
symbol OutB=1      'Name channel B output pin (leg6)
symbol LatchedA=pin3     'Name channel A latch option pin (leg4)
symbol LatchedB=pin4     'Name channel B latch option pin (leg3)
symbol Pulse_Width=w0     'Name measured input pulse width
symbol Prev_Pulse_Width=w1    'Name previous measured input pulse width
symbol ThresholdA=w2     'Name channel A switching threshold
symbol ThresholdB=w3     'Name channel B switching threshold
symbol Offset=w4      'Name the neutral offset
symbol Pulse_In=2      'Name pulse input pin (leg5)
'Initialise
   ThresholdA=180      'Set channel A threshold to 1.80 ms
   ThresholdB=120      'Set channel B threshold to 1.20 ms
   Prev_Pulse_width=0     'Set previous input pulse width 0 initially
Restart:
   low OutA       'Set channel A output low initially
   low OutB       'Set channel B output low initially
Pause 500       'Wait for 1/2 second initially
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Offset=Pulse_Width-150    'Record the neutral position offset
Start:
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Pulse_Width=Pulse_Width-Offset   'Adjust for the neutral position offset
        'Channel A
   if LatchedA=1 then LatchA    'Check whether channel A is latched operation
         'Unlatched operation
   if Pulse_Width>ThresholdA then Out_OnA       'Check whether pulse is longer than threshold
   low OutA          'Turn off output if pulse<threshold
   goto ChannelB         'Jump to check channel B
Out_OnA:
   high OutA          'Turn on output if pulse>threshold
   goto ChannelB         'Jump to check channel B
LatchA:        'Latched Operation
   if Prev_Pulse_Width<ThresholdA then TholdA    'Check whether previous pulse was above threshold
   goto ChannelB         'Jump to check channel B if previous pulse above threshold
TholdA:           'Previous pulse below threshold
   If Pulse_Width<ThresholdA then ChannelB   'Check whether pulse is longer than threshold
   toggle OutA        'Toggle output if pulse is longer than threshold
ChannelB:       'Channel B
   if LatchedB=1 then LatchB    'Check whether channel B is latched operation
         'Unlatched operation
   if Pulse_Width<ThresholdB then Out_OnB      'Check whether pulse is longer than threshold
   low OutB          'Turn off output if pulse<threshold
   goto Reset_PPW         'Jump to reset previous pulse width
Out_OnB:
   high OutB          'Turn on output if pulse>threshold
   goto Reset_PPW         'Jump to reset previous pulse width
LatchB:        'Latched Operation
   if Prev_Pulse_Width>ThresholdB then TholdB    'Check whether previous pulse was above threshold
   goto Reset_PPW         'Jump to reset previous pulse if previous pulse above threshold
TholdB:           'Previous pulse below threshold
   If Pulse_Width>ThresholdB then Reset_PPW   'Check whether pulse is longer than threshold
   toggle OutB        'Toggle output if pulse is longer than threshold
Reset_PPW:
   Prev_Pulse_Width=Pulse_Width   'Reset previous pulse width to current pulse width
goto Start       'Go back to measure input pulse again
 

hippy

Technical Support
Staff member
RESTART has become a reserved word so cannot be used as a label within programs. It's part of the multi-tasking commands for the M2's.

Your original code should work with 0V lines connected assuming the input signal to pin 3 is of suitable voltage.
 

barneydog

Member
cool... i litteraly changed the Restart as you must have posted...to Restarts and updated the code


and now it works perfectly....

I just tried the pic with my program on... and all it was is the 0v from the receiver... now i feel a bit silly not trying that before...

In the fully working version that will be installed into truck, i have a voltage regulator to keep a steady 5v and would be using the receivers feed...

Thank you to everyone whos helped...i can now build the smoke generators for the truck :cool:
 

dbarry722

Member
This should be quite simple. The Picaxe pulsin function is perfect for this. I have used it for many applications related to hobby RC.
I assume that you have the grounds of the RC receiver and Picaxe power supplies connected together.
Here is some code which does work. It may be more than you need, but can be simplified to suit your requirements.
Code:
'Radio control 2 channel switch using PICAXE-08 or 08M
'Either channel can operate in latched or unlatched operation.
'For latched operation tie pin3 (leg4) and/or pin4 (leg3) to +5V for channel A and B respectively.
'OutputA (pin0) will then go high the first time the receiver pulse exceeds the threshold, and low the next time.
'OutputB (pin1) will then go high the first time the receiver pulse goes below the threshold, and low the next time.
'For unlatched operation,OutputA is high when the receiver pulse exceeds the threshold and vice-versa.
'For unlatched operation,OutputB is high when the receiver pulse goes below the threshold and vice-versa.
'Change the values of ThresholdA and ThresholdB as desired to change the switching points.   
'When program first runs it assumes the transmitter "stick" is in the neutral position and calibrates accordingly.
'PICAXE-08 connections are:
' Leg 1 +5V
' Leg 2 Only connected when downloading program
' Leg 3 Channel B latching option
' Leg 4 Channel A latching option
' Leg 5 Pulse input from radio receiver
' Leg 6 Channel B output
' Leg 7 Channel A output (must disconnect the programming cable when running program)
' Leg 8 Ground
symbol OutA=0      'Name channel A output pin (leg7)
symbol OutB=1      'Name channel B output pin (leg6)
symbol LatchedA=pin3     'Name channel A latch option pin (leg4)
symbol LatchedB=pin4     'Name channel B latch option pin (leg3)
symbol Pulse_Width=w0     'Name measured input pulse width
symbol Prev_Pulse_Width=w1    'Name previous measured input pulse width
symbol ThresholdA=w2     'Name channel A switching threshold
symbol ThresholdB=w3     'Name channel B switching threshold
symbol Offset=w4      'Name the neutral offset
symbol Pulse_In=2      'Name pulse input pin (leg5)
'Initialise
   ThresholdA=180      'Set channel A threshold to 1.80 ms
   ThresholdB=120      'Set channel B threshold to 1.20 ms
   Prev_Pulse_width=0     'Set previous input pulse width 0 initially
Restart:
   low OutA       'Set channel A output low initially
   low OutB       'Set channel B output low initially
Pause 500       'Wait for 1/2 second initially
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Offset=Pulse_Width-150    'Record the neutral position offset
Start:
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Pulse_Width=Pulse_Width-Offset   'Adjust for the neutral position offset
        'Channel A
   if LatchedA=1 then LatchA    'Check whether channel A is latched operation
         'Unlatched operation
   if Pulse_Width>ThresholdA then Out_OnA       'Check whether pulse is longer than threshold
   low OutA          'Turn off output if pulse<threshold
   goto ChannelB         'Jump to check channel B
Out_OnA:
   high OutA          'Turn on output if pulse>threshold
   goto ChannelB         'Jump to check channel B
LatchA:        'Latched Operation
   if Prev_Pulse_Width<ThresholdA then TholdA    'Check whether previous pulse was above threshold
   goto ChannelB         'Jump to check channel B if previous pulse above threshold
TholdA:           'Previous pulse below threshold
   If Pulse_Width<ThresholdA then ChannelB   'Check whether pulse is longer than threshold
   toggle OutA        'Toggle output if pulse is longer than threshold
ChannelB:       'Channel B
   if LatchedB=1 then LatchB    'Check whether channel B is latched operation
         'Unlatched operation
   if Pulse_Width<ThresholdB then Out_OnB      'Check whether pulse is longer than threshold
   low OutB          'Turn off output if pulse<threshold
   goto Reset_PPW         'Jump to reset previous pulse width
Out_OnB:
   high OutB          'Turn on output if pulse>threshold
   goto Reset_PPW         'Jump to reset previous pulse width
LatchB:        'Latched Operation
   if Prev_Pulse_Width>ThresholdB then TholdB    'Check whether previous pulse was above threshold
   goto Reset_PPW         'Jump to reset previous pulse if previous pulse above threshold
TholdB:           'Previous pulse below threshold
   If Pulse_Width>ThresholdB then Reset_PPW   'Check whether pulse is longer than threshold
   toggle OutB        'Toggle output if pulse is longer than threshold
Reset_PPW:
   Prev_Pulse_Width=Pulse_Width   'Reset previous pulse width to current pulse width
goto Start       'Go back to measure input pulse again
Hi There..

Just getting into PIC programming and starting with hopefully a simple 'Lost Model Alarm'

Just one query though. Is the circuit PPM or PCM independent. I currently use a mixture of JR PCM receivers with Failsafe and Futaba PPM receivers so it should be easy enough to set the system to the failsafe setting on the Gear Channel but what happens on a PPM receiver if the system loses signal

Declan
 

srnet

Senior Member
Just one query though. Is the circuit PPM or PCM independent
The PIC is measuring the servo pulses, which are the same regardless of the transmitter mode. The receiver outputs a pulse of 1-2ms in width with a repitition rate of around 50hz, this is what the PICAXE is measuring.

However, what happens on signal being lost, rather depends on the reciever, you will have to check. Recievers can do several things on signal loss;

1. Go nuts and produce random pulses.
2. Keep sending out the last valid pulse received (hold mode)
3. Go into failsafe and send out a pre-configured pulse that you program in.
4. Stop sending pulses alltogether.

For a LMA, No 1 is the easiest to detect.

The gear channel is not a good choice for 2,3,4, since its unlikley to change between normal flight and lost.

I use the cheap eBay LMAs in most of my planes, I put them on the rudder channel, if you dont move the rudder for a couple of minutes it goes off. useful reminder that you have left the model powered on too.
 

dbarry722

Member
The PIC is measuring the servo pulses, which are the same regardless of the transmitter mode. The receiver outputs a pulse of 1-2ms in width with a repitition rate of around 50hz, this is what the PICAXE is measuring.

However, what happens on signal being lost, rather depends on the reciever, you will have to check. Recievers can do several things on signal loss;

1. Go nuts and produce random pulses.
2. Keep sending out the last valid pulse received (hold mode)
3. Go into failsafe and send out a pre-configured pulse that you program in.
4. Stop sending pulses alltogether.

For a LMA, No 1 is the easiest to detect.

The gear channel is not a good choice for 2,3,4, since its unlikley to change between normal flight and lost.

I use the cheap eBay LMAs in most of my planes, I put them on the rudder channel, if you dont move the rudder for a couple of minutes it goes off. useful reminder that you have left the model powered on too.
Hi Srnet.

If signal is lost on PCM and system goes to failsafe could I not program a setting to the PIC so that once it detects this (or if gear switch is activate), it initiates whatever sequence I have for raising merry hell via a buzzer.

I've seen LMA's where they say it works on both PPM and PCM. I have a PPM LMA that I built using a 555 timer but this is my first dip into PIC's. I've picked up few program snippets on the forum here that I'm in the process of trying out. Just made a commando raid into the Technology Department and liberated a couple of items to make up a testing board :D

Declan
 

srnet

Senior Member
I would forget comparisions between PPM and PCM, most modern PPM recievers behave like PCM ones of old anyway.

Its like I said earlier, its down to what happens to the servo pulses on your setup when the TX is turned off.

For those that go into hold or failsafe you have to monitor the pulses over a period, 2 minutes say, and work out if they have moved in that period more than say 10%, if they have assume the plane is in normal control.

So if the LMA is to be universal you need to (and matching the list above)

1. Check if there are pulses longer than 2.5ms or shorter than 0.75ms (approx)
2. Check if the pulse (which is valid) is static (within a few percent) over a period, say 2 minutes
3. Same as 2 really.
4. Check for pulse measurement timeout, can be part of 1.
5. Make sure it resets when pulses return to normal.
 

dbarry722

Member
I would forget comparisions between PPM and PCM, most modern PPM recievers behave like PCM ones of old anyway.

Its like I said earlier, its down to what happens to the servo pulses on your setup when the TX is turned off.

For those that go into hold or failsafe you have to monitor the pulses over a period, 2 minutes say, and work out if they have moved in that period more than say 10%, if they have assume the plane is in normal control.

So if the LMA is to be universal you need to (and matching the list above)

1. Check if there are pulses longer than 2.5ms or shorter than 0.75ms (approx)
2. Check if the pulse (which is valid) is static (within a few percent) over a period, say 2 minutes
3. Same as 2 really.
4. Check for pulse measurement timeout, can be part of 1.
5. Make sure it resets when pulses return to normal.
Cheers Srnet.

Will give it a try and see what happens.

Declan
 

dbarry722

Member
This should be quite simple. The Picaxe pulsin function is perfect for this. I have used it for many applications related to hobby RC.
I assume that you have the grounds of the RC receiver and Picaxe power supplies connected together.
Here is some code which does work. It may be more than you need, but can be simplified to suit your requirements.
Code:
'Radio control 2 channel switch using PICAXE-08 or 08M
'Either channel can operate in latched or unlatched operation.
'For latched operation tie pin3 (leg4) and/or pin4 (leg3) to +5V for channel A and B respectively.
'OutputA (pin0) will then go high the first time the receiver pulse exceeds the threshold, and low the next time.
'OutputB (pin1) will then go high the first time the receiver pulse goes below the threshold, and low the next time.
'For unlatched operation,OutputA is high when the receiver pulse exceeds the threshold and vice-versa.
'For unlatched operation,OutputB is high when the receiver pulse goes below the threshold and vice-versa.
'Change the values of ThresholdA and ThresholdB as desired to change the switching points.   
'When program first runs it assumes the transmitter "stick" is in the neutral position and calibrates accordingly.
'PICAXE-08 connections are:
' Leg 1 +5V
' Leg 2 Only connected when downloading program
' Leg 3 Channel B latching option
' Leg 4 Channel A latching option
' Leg 5 Pulse input from radio receiver
' Leg 6 Channel B output
' Leg 7 Channel A output (must disconnect the programming cable when running program)
' Leg 8 Ground
symbol OutA=0      'Name channel A output pin (leg7)
symbol OutB=1      'Name channel B output pin (leg6)
symbol LatchedA=pin3     'Name channel A latch option pin (leg4)
symbol LatchedB=pin4     'Name channel B latch option pin (leg3)
symbol Pulse_Width=w0     'Name measured input pulse width
symbol Prev_Pulse_Width=w1    'Name previous measured input pulse width
symbol ThresholdA=w2     'Name channel A switching threshold
symbol ThresholdB=w3     'Name channel B switching threshold
symbol Offset=w4      'Name the neutral offset
symbol Pulse_In=2      'Name pulse input pin (leg5)
'Initialise
   ThresholdA=180      'Set channel A threshold to 1.80 ms
   ThresholdB=120      'Set channel B threshold to 1.20 ms
   Prev_Pulse_width=0     'Set previous input pulse width 0 initially
Restart:
   low OutA       'Set channel A output low initially
   low OutB       'Set channel B output low initially
Pause 500       'Wait for 1/2 second initially
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Offset=Pulse_Width-150    'Record the neutral position offset
Start:
   pulsin Pulse_In,1,Pulse_Width   'Measure and store input pulse
   if Pulse_Width<50 or Pulse_Width>250 then Restart 'Go back if no valid pulse detected
   Pulse_Width=Pulse_Width-Offset   'Adjust for the neutral position offset
        'Channel A
   if LatchedA=1 then LatchA    'Check whether channel A is latched operation
         'Unlatched operation
   if Pulse_Width>ThresholdA then Out_OnA       'Check whether pulse is longer than threshold
   low OutA          'Turn off output if pulse<threshold
   goto ChannelB         'Jump to check channel B
Out_OnA:
   high OutA          'Turn on output if pulse>threshold
   goto ChannelB         'Jump to check channel B
LatchA:        'Latched Operation
   if Prev_Pulse_Width<ThresholdA then TholdA    'Check whether previous pulse was above threshold
   goto ChannelB         'Jump to check channel B if previous pulse above threshold
TholdA:           'Previous pulse below threshold
   If Pulse_Width<ThresholdA then ChannelB   'Check whether pulse is longer than threshold
   toggle OutA        'Toggle output if pulse is longer than threshold
ChannelB:       'Channel B
   if LatchedB=1 then LatchB    'Check whether channel B is latched operation
         'Unlatched operation
   if Pulse_Width<ThresholdB then Out_OnB      'Check whether pulse is longer than threshold
   low OutB          'Turn off output if pulse<threshold
   goto Reset_PPW         'Jump to reset previous pulse width
Out_OnB:
   high OutB          'Turn on output if pulse>threshold
   goto Reset_PPW         'Jump to reset previous pulse width
LatchB:        'Latched Operation
   if Prev_Pulse_Width>ThresholdB then TholdB    'Check whether previous pulse was above threshold
   goto Reset_PPW         'Jump to reset previous pulse if previous pulse above threshold
TholdB:           'Previous pulse below threshold
   If Pulse_Width>ThresholdB then Reset_PPW   'Check whether pulse is longer than threshold
   toggle OutB        'Toggle output if pulse is longer than threshold
Reset_PPW:
   Prev_Pulse_Width=Pulse_Width   'Reset previous pulse width to current pulse width
goto Start       'Go back to measure input pulse again
Hi Goom..

I've been working on a project for what is basically an Optoglow for my model aircraft. I've just simulated your code so that I could understand what it was doing and I can see where I can use it to modify an original electronic circuit but would be grateful for a bit of assistance.

In your code you can set the threshold at which switching occurs but what I would like to do is for a user to have the ability to manually set the threshold on the circuitboard. What way would I place a variable resistor into the circuit in order that when the input from the pulsein equals the variable resistor, the switch activates.

Many thanks

Declan
 

BeanieBots

Moderator
I don't want to answer on behalf of Goom but what you want to do is quite simple.
Most RC signals range from about to 75 to 220 when read using pulsin.
If you connect a POT and use ReasADC it will be in the range 0 to 255.
Simply scale the 0 to 255 to become 75 to 220 and use it to replace your threshhold.
Read the POT into a word variable to help the maths

ReadADC pin,w0
w0=w0*4/7+75
Now just use w0 in place of your threshold.
 

dbarry722

Member
I don't want to answer on behalf of Goom but what you want to do is quite simple.
Most RC signals range from about to 75 to 220 when read using pulsin.
If you connect a POT and use ReasADC it will be in the range 0 to 255.
Simply scale the 0 to 255 to become 75 to 220 and use it to replace your threshhold.
Read the POT into a word variable to help the maths

ReadADC pin,w0
w0=w0*4/7+75
Now just use w0 in place of your threshold.
Hi BeanieBots..

Seems like i was reading too much into the link between comparing pulsein values and readadc. Could you explain the scaling a bit more so that I can understand what is happening.


Declan
 
Last edited:

goom

Senior Member
No problem responding on my behalf BeanieBots. Great minds think alike (or is it that fools seldom differ). My proposed solution would have been just the same as the one you described.
Returning the favour:
The scaling formula (w0=w0*4/7+75) basically takes the ADC input from the potentiometer wiper (a value of 0 to 255) and converts it to a number from 75 to 220. You can then use this value as your threshold on which to base your switching point.
So, if the pot. is at it's mid point, (ADC value of 127), then the threshold for switching will be (127 x 4 / 7) + 75 = 148. This will be around the trantmitter stick middle point.
Similarly, at 25% pot travel, threshold is (255 x .25 x 4 / 7) + 75 = 111, i.e. somewhere around stick end point.
 

goom

Senior Member
Just out of interest, you can make an RC switch using a 4013 dual D Flip-Flop or a 4001 quad NOR gate (I did that back in my pre-PICAXE days). I have circuit diagrams if anyone is interested. However, the PICAXE solution is really much more elegant, and certainly far more appropriate for this forum.
 

BeanieBots

Moderator
Hi Goom,
I'd be interested in your circuit if you have it to hand.
I used to use hand picked op-amps (often 741's) that could get close enough to rails configured as a comparitor with a little hysterisis that looked at the pulses after an RC. The reference voltage being derived from a red LED.
 

dbarry722

Member
Hi Folks.

I've attached the original project that I'm looking to 'convert' to picaxe to give people a better overview of what I'm trying to achieve. The main schematic is on Page 10. Looking at it simplistically, I'm trying to convert the circuit to the left of IC2 to picaxe. In doing so, it opens up potentials to program that system to add in safety aspects so that the glow plug only starts glowing within a specific pulse band.

Declan
 

Attachments

Last edited:

BeanieBots

Moderator
Thanks for posting those Goom.
I was familiar with your first method but the second I'd not seen before. An interesting solution.

The Optoglow circuit should be simple enough to replicate with an 08M and include added features such as no-pulse recognition.
I'd be a little wary of the current rating for IC2 though. I've not checked its datasheet but typical glow plugs can draw several amps and not many opto-isolators can sink several amps. Possibly OK but I think I'd go for a simple FET and not worry about isolation.
 

dbarry722

Member
Hi BeanieBots

That's what I liked about the PVN012. It can handle 4.5A and up to 9A if a second PVN012 is added. Most glow plug should operate in the range of 2-3A. Anything after that you reduce the life of the glowplug.

I'm working on a circuit designed by Alan Bond. Alan has kindly sent me a schematic which uses the 08M2 chips and are available at http://www.technobotsonline.com/rc-switch.html

Unfortunately, the actual code isn't in the public domain so for me, its a learning curve of coding an making the PCB but I'm up for it. (with the help of the forum :eek:)

Declan
 
Last edited:

goom

Senior Member
My previously posted code is probably quite simiar to that written by Alan Bond. He has even used the same technique of jumpers to select latching or non-latching operation. My design differs mainly in being 2 channel, not using an input pulse buffer and having the thresholds set in code rather than from an external potentiometer.
My circuit diagram and PCB board layout follows. I'm not sure that the MOSFET is the best one since I do not think that it is a logic level type.

RC Switch -08M.jpg
 

dbarry722

Member
My previously posted code is probably quite simiar to that written by Alan Bond. He has even used the same technique of jumpers to select latching or non-latching operation. My design differs mainly in being 2 channel, not using an input pulse buffer and having the thresholds set in code rather than from an external potentiometer.
My circuit diagram and PCB board layout follows. I'm not sure that the MOSFET is the best one since I do not think that it is a logic level type.

View attachment 13301
Cheers Goom.

Will check out the mosfet. Your circuit gives me a lot of information to work with. Incidentally, the datasheet for the PVN012 Mosfet which is used in the original circuit can be found here http://photo-ek.ru/workshop/images/pvn012.pdf

Declan
 
Last edited:

bluejets

Senior Member
Used the PVN012 previously in on-board ignition systems for glow and they work very well.
The original was because the mosfet required a good 10 to 12 volts to turn on hard and the system used just 4.8V.
Now there are logic level mosfets so perhaps a cheaper alternative as the PVN012 was rather expensive.
They did however, enclose a led and solar array (so to speak) so quite a complex device internally.
 

dbarry722

Member
Used the PVN012 previously in on-board ignition systems for glow and they work very well.
The original was because the mosfet required a good 10 to 12 volts to turn on hard and the system used just 4.8V.
Now there are logic level mosfets so perhaps a cheaper alternative as the PVN012 was rather expensive.
They did however, enclose a led and solar array (so to speak) so quite a complex device internally.
Ohh Err Matron!! :eek:

Got a dose of the wobbles there. As a mere novice at this, I've a lot to learn about gate voltages, logic levels etc and working out advantages over logic Levels vs 'Normal' Mosfets .. all using a 4.8v RX battery (plus a 1.2v battery to supply the glow plug on the other side of the mosfet)

Declan
 

afacuarius

New Member
cool... i litteraly changed the Restart as you must have posted...to Restarts and updated the code


and now it works perfectly....

I just tried the pic with my program on... and all it was is the 0v from the receiver... now i feel a bit silly not trying that before...

In the fully working version that will be installed into truck, i have a voltage regulator to keep a steady 5v and would be using the receivers feed...

Thank you to everyone whos helped...i can now build the smoke generators for the truck :cool:
Hola, he tratado de cargar este programa, pero no entiendo la parte de "Restart" al querer cargarlo en el picaxe me sale un error
debo de cambiar "restart" ?? entiendo que restart es una palabra reservada, pero como lo modifico ??

Hello, I tried to load this program, but do not understand the part of "Restart" to want to upload it to the picaxe I get an error
I need to change "restart"?? I understand that restart is a reserved word, but as I modified it??

Regards
 

afacuarius

New Member
Hello

I think I get it, when the picaxe command restart one, just change the word and it works in the simulator, the circuit will do now and tell them,
thanks

Hola
creo ya entendi, al ser restart un comando del picaxe, solo cambie la palabra y ya funciona en el simulador, ahora hare el circuito y ya les comento,
Gracias
 

afacuarius

New Member
Hello

I used the code of Goom and works perfectly in the simulator.

I just finished assembling the circuit and works great, this is what I wanted exactly

Thank you Goom


Hola

He usado el codigo de Goom y funciona perfectamente en el simulador.

Acabo de terminar de armar el circuito y funciona de maravilla, esto es lo que buscaba exactamente

Gracias Goom
 
Top