first play with wireless and having some teething troubles>>>>>

tony_g

Senior Member
i have finally decided to start playing around with some wireless modules i have had for a while to pass some time until my other project parts arrive but already am having a few issues getting the recieved data i expect.

these are the modules i am using View attachment UM-LC-1000-V10-EN.pdf.

so far i am only trying to get uncorrupted data from one to the other and diplayed via sertxd using them in the simple "3 wire" mode but i am not getting any where with it.

i understand goeytex had a pair of these to play with and had to re pair them as the device local or link adress was not correct and so they would not communicate.

as far as i can tell my devices do seem to be paired as i am using the 3 board outputs (which indicate rf link status, ready to recieve data and ready to tx data)
to control some led's to show the device status and i have a solid rf link ok led on both as well as the tx ready led to indicate the devices are ready for data input.

when i attempt to send data from one device to the other i do see activity on the receivers "data recieved" output when it recieves something to pass along to my 08m2 which should sertxd back out to the terminal window but regardless of what ever i try whether an inverted or non inverted serial com setup to /from the chips i get pretty much garbage.

i know that from the sounds of it it is going to be a communication issue to do with baudrate or polarity and no doubt i have overlooked something simple so i could definately do with some more experienced eyes than mine seeing any problems.

i would like to use these devices in the 5 wire hardware flow control method but at the moment if i cant get valid data out to see whats going on then i assume i will have issues trying to setup things in the config registers and trying to get packets back to read on the terminal to see what the seetings ect are.

simple tx code:
Code:
#picaxe 08m2
setfreq m4

init:
pause 5000

data_tx:
do
for b0 =0 to 255
serout c.1,n4800_4,(b0)
pause 2000
next b0
loop
rx code:
Code:
#picaxe 08m2
#terminal 4800

init:
pause 1000

data_rx:
do
serin c.1,n4800_4,(b0)
sertxd (b0,cr,lf)
loop
this is my first time playing with wireless of any kind so i am a bit stumped
 

neiltechspec

Senior Member
I have considered getting a couple of these modules to play with.

I was under the impression the default baud rate is 9600. Have you tried at this rate to see what happens.

edit: looking at the datasheet for baud rate reset - this resets to 9600, which would indicate this is the default.

Neil.
 

Technical

Technical Support
Staff member
serin c.1,n4800_4,(b0)

is wrong - remove the brackets as they indicate a qualifier

also try 9600 as described above
 

neiltechspec

Senior Member
Those brackets often catch me out.

I would try this :-

Code:
#picaxe 08m2
#no_data

init:
	pause 5000
	setfreq m16

data_tx:
	do
	for b0 =0 to 255
	serout c.1,T9600_16,b0
	pause 2000
	next b0
	loop

------------------------------------


#picaxe 08m2
#terminal 9600
#no_data

init:
setfreq m16
pause 4000

data_rx:
do
serin c.1,T9600_16,b0
sertxd (b0,cr,lf)
loop
Neil
 

tony_g

Senior Member
after posting i did go back and see the mistake with the qualifier and removed it .

the baudrate is currently changed to 9600 amongst other speeds tried and now i am getting readable numbers on the terminal but they are completely random as opposed to seeing an incrementing 0 to 255 as the 08m2 on the tx end should be sending out, instead its more of a random 256,3,0,255,63,0,0,0,0,0,1 ect
 

tony_g

Senior Member
ahh to slow lol i posted just as you added you code neil,

ok i will give that a bash and see how it does, thanks neil.

tony
 

neiltechspec

Senior Member
I always use 16mhz clock for reliable serin & serout at 9600 baud.

You might have to increase some of your delays for the faster clock speed though.
 

tony_g

Senior Member
thankyou very much neil, it was initially spitting garbage out again but then i stuck the "#" in front of b0 for the sertxd and that with the help of running faster has got it counting up nicely.

i guess i avoided using a faster clock speed in case i missed some data but clearly it was the complete opposite of not speeding it up enough was losing data.

now to have a little play around with this in simple mode then dig out the higher leg count chips and use the other mode.

thanks neil and technical :D:D:D
 

Goeytex

Senior Member
The LC-1000 defaults to 9600 8n1 non inverted serial.

To communicate reliably with a Picaxe the Picaxe should be set to M16 OR M32 to avoid the 9600_8 baud rate problem and to give serin more processing time. I prefer using M32

Both serin and serout should be T9600_xx. There should be a 10K pullup on the Picaxe Pin used for serout, as the LC-1000 does not like a long duration low on its RX PIN at power up ( or at any other time)

TX Code
Code:
#picaxe 08m2
setfreq m32

init:
High c.1     '// Set pin b.1 high to prepare for use as serout idling high ( true)
pause 5000

data_tx:
do
      for b0 = 0 to 255
          serout c.1, T9600_32, (b0)
          pause 1000
      next b0
loop
Receive Test
Code:
#picaxe 08m2
#terminal 38400
setfreq m32

init:
pause 2000

data_rx:

do
     serin c.1,T9600_32,b0
     sertxd (#b0,cr,lf)
loop
Addendum:

The LC-1000 is an amazing little RF module for the money for those with a little patience. These will work at T9600 with no configuration at all all .... IF, IF,IF you read ( study) the somewhat confusing datasheet. The datasheet clearly states that the default baud rate is 9600. However it does not clearly indicate the polarity, (Idle High or True). Many of us are used to using Picaxe Inverted serial but this is more the exception than the rule. Most devices use True rather than Inverted. So serin and serout must be T9600_XX.

Since Picaxe serin is software based, it is crucial to use a higher processor frequency to allow serin time to process data bytes. The minimum for 9600 baud is 16Mhz. I prefer 32mHZ. At 32Mhz the Picaxe can use the LC-1000 at up to 19200 baud with software based serin. However even at 32Mhz Picaxe serin cannot handle data sent from the LC-1000 at 38400. The LC-1000 does not add space between bytes (1 actual stop bit and cannot be changed). So to utilize the LC-1000 at above 19200 hardware serin must be used. This is a problem with M2 Picaxe chips since the hserin buffer is only 2 bytes, so streaming data is impossible/impractical with M2 Picaxe Chips. However with an X2 Picaxe and the scratchpad used as a circular buffer, continuous serial data can be received and processed. And with an X2 Picaxe full duplex serial comms between two LC-1000s can be done. That is, the Picaxe on either end can be transmitting & receiving at the same time ( seamlessly).

The 08M2 is inadequate for anything but the simplest RF applications with the LC-1000. More I/0 pins are needed. However, it will work perfectly well as a remote sensor,or RC transmitter, but to utilize most of the features of the LC-1000, a 14M2 is the minimum. With a 14M2 there are enough Pins to monitor the TX_Ready, RX_Ready,& Linked pins as well as control the config and reset pins. Using 2 Lc-1000's and with 2 14M2s and a few extra components I have made a wireless programming application where a Picaxe across the room can be programmed wirelessly and where the Picaxe terminal at the PC is showing the serial data from the remote Picaxe. This application is not yet complete to my satisfaction, but when it is I will post the details in the completed projects area.

For anyone interested in this kind of RF stuff I highly recommend getting an 8 channel USB based logic analyzer. There are some out there for about $12.00 - 15.00 that work really well. To attempt to develop a serious serial / RF application without one or at bare minimum a good digital scope can result in a lot of wasted time / head scratching. The cheap logic analyzer can actually do more than a $1,500 digital scope when it comes to analyzing async serial data.
 
Last edited:
Top