Belated thanks to Wolfgang

slimplynth

Senior Member
Now the simple solution (simple after I stumbled across while daydreaming and sweating for an hour on the treadmill :) :

- do the preamble as usual, which gets the receiver conditioned

- then, SEND NOTHING for a little more than one data byte (1 start bit, 8 data bits, 1 stop bit, i.e. 10 bits in total or e.g. 4.2ms at 2400 baud). This will make sure that wherever the receiver was at the end of the preamble, it is now idle and eagerly waiting for the next start bit. Just don't wait much longer than one byte, otherwise the receiver will lose lock again.

- now send qualifier and data

End result: just sent over 10000 data packets across the room without losing a single one.

In Picaxe language, sender side:

serout 0, T2400_4, (0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,)
pause 5
serout 0, T2400_4, ("data", b0)


In Picaxe language, receiver side:

serin 0, T2400_4, ("data"), b0

Wolfgang
After many hours bashin' my head, i found your thread from above. Exactly the same problem but it was more like 9 out of 10 lost packets !!!

Using the cheap 433Mhz Rx/Tx from sparkfun.

now 100% gettin through , thanks again..
 
Last edited:

womai

Senior Member
Well, I'm very glad to hear my post helped! That way the time writing it is well spent. If I ever find time I should probably put together a nice document and/or little webpage that walks through all steps of setting up a realiable 433 MHz link. I'm sure others on this forum (Dr Acula comes to mind) could contribute some knowledge as well (e.g. antenna designs).

Wolfgang
 

slimplynth

Senior Member
Well, I'm very glad to hear my post helped! That way the time writing it is well spent. If I ever find time I should probably put together a nice document and/or little webpage that walks through all steps of setting up a realiable 433 MHz link. I'm sure others on this forum (Dr Acula comes to mind) could contribute some knowledge as well (e.g. antenna designs).

Wolfgang
That would be a great idea. I've used hippy's site for quite a few things. IR immediately springs to mind.

The forum and it's archives are a fountain of knowledge but the search engine can sometimes seem a bit random (even with *'s)... a sticky or FAQ section could be a winner.

After remeasuring antenna lengths, changing baud rates and qualifiers I did seriously think about posting a new thread :eek: Hold on!.. thats just what I've done :D but it seemed nicer to thank someone rather than post "It doesn't work... anyone got some Rev-ed tarrot cards at hand?"

Anyway, here is my code - a first for me, i think... I'm running the Rx on an 08M and the Tx on a 20M. Nothing ground breaking but if anyone has any suggestions to make it better and/or smaller in size, would be much appreciated.

I only had 20M and 08M spare, using the 20M for its larger number of I/O's hence the mizerely use of 08M for the LCD. (I should have posted the code using the userdefined messages in the axe033, just trying to save some precious bytes but left them in for illustration purposes)

Code:
	' Tx on 20M
main:

readtemp 5,b1
pause 250		'got pause happy
readadc 1,b2
pause 250		'got pause happy
serout 1,N2400,(0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55) ' preamble to lock link the tx/rx
pause 5
serout 1,N2400,("data",b1,b2)
sound 0,(90,50)
goto main
Code:
		'08M with AXE033 LCD and sparkfun Rx

init:
pause 500 	'pause, as advised for the initialisation of AXE033 LCD
let b1=0  	' just to display something
gosub disp	 'blank screens panic me :0)
pause 5000 	'used this to give me time to switch apps and start the Eltima - data logging program
		' freeware RS232 data logger - http://www.eltima.com/products/rs232-data-logger/
symbol flash = 50
symbol lo_led = 0
symbol ok_led = 1
goto mark	'to put the column headers at the top of the txt file, saves tippy tappying in excel/OO

main:
serin 2,N2400,("data"),b1,b2  ' collect RF data
if b2<180 then li_low         ' included this to see how quickly or if at all the update to the LCD is with an LDR
gosub ser_out			' have used Gosubs because program length was innitally too big for an 08M
high ok_led				' just to indicate that program hasn't gone into a hang at serin
gosub disp
serout 4,N2400,("OK  ")		' if light level is above some figure then append the output to LCD screen
low ok_led				
pause flash
goto main 

li_low:
gosub ser_out
high lo_led				' put a red LED in there so i could put some distance between the units, cover the LDR 
					' an hope that the red light flashes sooner rather than later - thanks womai ;0)
gosub disp
serout 4,N2400,("Low!")		' as above, if light level is below my arbitary 180 figure attach "Low!" to the end of 
					' the LCDs second line of text
low lo_led
pause flash
goto main

mark:
sertxd("Temp.°C:     Light%:",13,10) 'used at line 9, for column headers, included as a gosub in case i want to repeat
			           ' the headers, rather than have a long list of dizzying numbers
goto main

ser_out:
sertxd(#b1,"   :   ",#b2,"  :",13,10) 'include some white space and colons to make splitting text into columns easier in excel/OO
return

disp:
serout 4,N2400,(254,128) 		' point LCD to the 1st character of the 1st line
serout 4,N2400,("Temp. ", #b1, "oC") ' display temperature.
serout 4,N2400,(254,192)
serout 4,N2400,("Light Level ")
return
 
Last edited:

SilentScreamer

Senior Member
The forum and it's archives are a fountain of knowledge but the search engine can sometimes seem a bit random (even with *'s)... a sticky or FAQ section could be a winner.
I second that, perhaps have it so that only mods/admins can post in there and have a sub forum (or something similar) which people can request that their tutorials can go in. Should help keep it so that there ins't countless similar topics or unfinished/inaccurate threads.

I doubt it will ever happen though...
 

eclectic

Moderator
@Slim

Draft 1
Code:
		'08M with AXE033 LCD and sparkfun Rx
		
		
#picaxe 08M
symbol flash = 250
symbol lo_led = 0
symbol ok_led = 2 ; ********* Moved from Pin1

init:
serout 4,n2400,(254,1)
pause flash

gosub disp	 
pause 5000 	

mark:
sertxd("Temp.°C:     Light%:",13,10) 

main:
	serin 1,N600,("TTT"),b1  ' collect RF data
	serin 1,N600,("LLL"),b2
	;You use 
	;serin 2,N2400,("data"),b1,b2
	
	high ok_led	: pause flash  : low ok_led
     
	sertxd(#b1,"   :   ",#b2,"  :",13,10) 
	gosub disp 	

	if b2> 80 then  ; 80 for my threshold
	serout 4,N2400,("OK")
	else 

	high lo_led	
	serout 4,N2400,("Low!")	
	pause flash
	low lo_led
	endif 

goto main

disp:
serout 4,N2400,(254,128, "Temp. ", #b1, "'C") 
serout 4,N2400,(254,192,"Light Level ")
return
e
 

eclectic

Moderator
Amended with a few thoughts.
Could you swap the 08M and 20M?
You need more outputs for the receiver.

Program.
Your original program works.

I've just made some petty changes.

I've already got a TX/RX setup running, for a greenhouse monitor,
so I just changed the receiver.
(See the n600 / >80 light values)

I added another OK LED to pin2 (Just for extra confirmation)
I connected the Pin1 / Rx junction to another LED/res

I would also suggest changing the LCD output, to something like this

Code:
high lo_led	
	serout 4,N2400,("Low! ",#b2)	
	pause flash
	low lo_led
	endif 

goto main

disp:
serout 4,N2400,(254,128, "Temp. ", #b1, "'C") 
serout 4,N2400,(254,192,"Light ")
return
As in, you know it's low, but, how low?

Finally, for the moment, do you want the
LOW alarm to be on permanently, or just flash every few seconds?

e (and OE)
 
Last edited:

slimplynth

Senior Member
Hello e

much appreciated, I've kept
Code:
serin 2,N2400,("data"),b1,b2
as this takes off another 7 bytes, saving 21 in total.

Left it running for two hours last night and didn't lose any values. I can see the point of using separate qualifiers to guarentee the right value is passed to the correct variable, will bear this in mind for the future. Need to look into putting a clock/time in there.

Yeah, my first instinct was to swap the chips around, when the program was originally over size. It became more fun :eek: trying to make it smaller.
 
Last edited:

eclectic

Moderator
My mistake. :-(

The lines
;You use
;serin 2,N2400,("data"),b1,b2

were meant to be

;You should continue to use
;serin 2,N2400,("data"),b1,b2


And the Clock?
That's the Fun bit! :)

e
 
Last edited:
Top