Range of Pulsout command

Dermotx

Member
Hi,

I will be using a PICAXE-14M2 at 4Mz to pulse out 16 different pulses to to eight PIC-08 chips. Each PIC-08 will receive two of these pulses turning a latching solenoid ON and OFF. So when the 14-M2 pulses out for say 80ms the first of the PIC-08s will turn ON solenoid no.1 and when the 14M2 pulses out a 90ms pulse the first PIC-08 will turn OFF solenoid no.1.

Similarly when the 14M2 pulses out a 140ms pulse it will turn solenoid no.2 ON and when it pulses out a 150ms pulse it will turn solenoid no.4 OFF. etc, etc.

As far as I understand the range of the pulsout command goes from 75ms to 225ms at 4Mh. Is this correct?

If I instruct the pulsout command to deliver say a 150ms pulse to one of the 08 chips to turn a solenoid ON do I have to allow for "hysterisis"
and tell the pulsin command in the 08 chip to turn ON the solenoid if it receives a signal between 145 and 155ms. i.e.

if w1>145 and if w1<155 then solenoid ON

Is 5ms either side of the desired value sufficient or excessive? I won't have enough range for eight valves if I have to have a range of 5ms either side of a desired value.

Thanks for any help.

Regards

Dermot
 

hippy

Ex-Staff (retired)
As far as I understand the range of the pulsout command goes from 75ms to 225ms at 4Mh. Is this correct?
No; I think you are confusing PULSOUT with SERVO.

PULSOUT can deliver a pulse of between 0 and 65535 units, each unit being 10us at 4MHz, thus the pulse can be between 0us and 655350us, 0ms to just over 655ms.
 

Dermotx

Member
Thanks hippy and eclectic. You are quite right. I was getting mixed up between the pulse and servo commands.

As for the serout command I don't think I need to get that complicated as I don't need to send information as such. I just need the receiver to recognise a particular pulse width.

Any ideas on what kind of receiver and transmitter I should use? FM or AM? The range I need is about 70 feet through 3 or 4 concrete walls. The solenoids I want to control are in my detatched garage.

Regards

Dermot

P.S. Any ideas on my original question concerning the tolerance on a particular pulse width?
 

hippy

Ex-Staff (retired)
On tolerance, an extremely bad case of out-of-kilter would be 10% ( 5% each end combined ) and most likely less. So +/- 10 would seem reasonable at around 100ms

40 .. 60 => 50
61 .. 80 => 70
81 .. 100 => 90

and so on.
 

Dippy

Moderator
Ah, more info.
RF.

I wouldn't use that method if using RF.

Use a slow/medium Serial.

There are numerous pitfalls sending slow pulses.
Some RF receivers won't like it.
Also the response time of receivers varies. This means the duration will be imprecise.
Interference or glitches could really muck it up.
I assume you'll be leaning towards the cheapest RF on the planet?

With serial you can at least check the data quality to reduce operational mistakes.
I think you will regret using your proposed method over RF.

Serial is easy; aside from any preamble just send the device ID byte and a command byte. You may wish to add check byte/s for error-testing. Or you may send the ID and command several times and test the received data like that.
Each 08M node then just tests:- IF <device ID Byte> = me then do the command.
 
Last edited:

westaust55

Moderator
To expand upon eclectics suggestion, one output pin for SEROUT on the master with all 08M's connected to that pin.
Then use a qualifier in the SEROUT and SERIN commands so each 08M only responds to the data it needs to.
 

william47316

New Member
heres some of the code i used in a wireless pair i made for my 8 digit display which allows some of my projects to send data to the display wirelessly. you can modify it to use more or less bytes and different checksum algorithms etc, my one sends out 50% duty data bits as a qualifier and uses the average value of the data as a checksum so it knows if the data is bad enough to warrant an error

below is the transmitter, receiver code will be down further
Code:
symbol checksum = b9
let dirs = 00010011
let pins = 00000000
pause 250
setfreq m8

let pins = 00010010
TXloop:

serin 3,n2400, b1,b2,b3,b4,b5,b6,b7,b8

'calculate a crude checksum
w5 = b1 + b2 +b3 +b4+b5+b6+b7+b8
checksum = w5 / 8 'set a byte variable to the average value of the data input for checksum

serout 0,n2400, (170,170,170,170,170,85,170,b1,b2,b3,b4,b5,b6,b7,b8,checksum) 'broadcast a quailifier to prep the receiver and burp the bytes out
pulsout 4,5000 'pulse out a confirmation LED to say its finished

goto txloop
in the receiver the received data is checked against the calculated value in the chip and the received check value if they match you can get it to do something if not sound a beeper or do nothing, on my 8 digit display if it received bad data it will display "BAD DATA and beep, i have found this actually quite reliable and have had very few errors with it, this is just using plain 433MHz RF modules and a few 08M's
Code:
setfreq m8
symbol checksum = b9
symbol loccheck = b12
high 4
mainloop:

serin 3,n2400, (170,85,170),b1,b2,b3,b4,b5,b6,b7,b8,checksum
w5 = b1 + b2 +b3 +b4+b5+b6+b7+b8
loccheck = w5 / 8 'set a byte variable to the average value of the data input for checksum
if loccheck = checksum then
serout 0,n2400, (b1,b2,b3,b4,b5,b6,b7,b8)
pulsout 4,5000
end if
if loccheck <> checksum then
serout 0,n2400, ("BAD",7,"DATA")
end if
goto mainloop
 

Dippy

Moderator
Westy, he chucked in the radio variable in post#4.

Perhaps Dermot could tell us where he is in the project and if any of the suggestions have been helpful.

Once again, it would be so helpful if people described in post #1 the exact question including a sketch of the system.
We are not clairvoyant sadly and most of us have limited time (except Westy :) )
Please let us know ... don't drip feed us ...;)
Tell us your skill level.
Tell us your budget.
Is this a school project?
 

hippy

Ex-Staff (retired)
I missed the radio part as well and that does complicate things as noted.

I think it would be hard to get 16 different pulse widths over RF and discriminate between them reliably but one could send fewer, check they are particular widths and add some checksumming to avoid errors, send as a sequence of pulses, but pretty soon you've actually re-invented serial over RF, just not as good!

With the relase of the NKM2401 at a pretty reasonable price I'd opt for that, with bit-banged serial RF if really pushed on budget.
 

Dermotx

Member
Thanks for all the inputs. I'm going to purchase the PICAXE RF Connect Kit (AXE213) and I will experiment with that. It seems to be exactly what I need.
The help I have received above will get me on my way. When the project is finished I'll let you know how I got on and will post code and schematics.

Thenks again.

Regards
Dermot
 
Top