3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Build a 500 metre radio data link for under $40.

Step 6Receiver circuit and picaxe code

Receiver circuit and picaxe code
The receiver module is connected to a picaxe as shown in the schematic. The antenna is a 23.8cm piece of wire, and to make a dipole and increase the sensitivity another length of 23.8cm wire is soldered to the earth of the module.

The transmitter code is as follows:

main:serout 1,N2400,("UUUUUUUUUUUUUTW",b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)
' T and W = ascii &H54 and &H57 = 0100 and 0111 = equal 1s and 0s
'b0=random number
'b1=random number
'b2=to device
'b3=reverse
'b4=messagetype
'b5=reverse
'b6/b7 = data 1 and reverse
'b8,b9 = data 2
'b10,b11 = data 3
'b12,b13 = data 4
random w0 ' random number used to identify messages when using multiple repeaters
b2=5' to device number...
b3=255-b2
b4=126' random number for testing
b5=255-b4
b6=0' random number for testing
b7=255-b6
b8=1' random number for testing
b9=255-b8
b10=2' random number for testing
b11=255-b10
b12=3' checksum - any value
b13=255-b12
pause 60000' transmit once per minute
goto main

And the receiver code:

main: serin 4,N2400,("TW"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
b13=255-b13' inverse again only need to really test one
if b12=b13 then
for b12=0 to 55
high 2
pause 100' flash led once a second for a minute
low 2
pause 900
next
endif
goto main

The transmitter sends a packet once per minute - once debugged this ought to be decreased to every 15 mins or 30mins to avoid interference to neighbours. The "œUUUU" at the beginning of the packet is binary for 01010101 which balances the Rx unit. The protocol uses a form of Manchester coding where the number of 1's and 0's is kept as equal as possible, and this is done by sending the inverse of each byte after the byte is sent. Without this the packets sometimes don't get through if they are sending lots of binary zeros. A checksum at the end must be valid before the data is processed. The receiver flashes a led for 55 seconds when a packet is received and once debugged, this could be changed to some other acknowledgement.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
16
Followers
4
Author:James Moxham
Dr James Moxham is a general medical practitioner in Adelaide, Australia. His interests include general family medicine, medical politics, microcontrollers and tending a rose garden. He lives on a pro...
more »