Blazemaguire
Senior Member
Hey all,
I have a student developing an RC vehicle using the cheap 433mhz ebay wireless modules. Essentially an RC tank. He's using the RFOUT and RFIN commands for simplicity, as myself (and especially him) are not the strongest at coding.
The transmitting PICAXE sends a different number (e.g, '1' for forwards, '2', for backwards, '3' for turn right etc) and the recieving PICAXE obviously waits for a number ursing RFIN, translates that number into what it should do with the drive motors, and thus how the vehicle moves. - It transmits a '0' constantly when no control buttons are pressed as an instruction to remain stationary)
The problem we're having is that if the vehicle goes out of range (and that's not hard with these cheap modules - maybe 15 meters) the last transmitted numbers is the last thing left in the Recieving PICAXE's variable, and seems impossible to update due to how RFIN works (i.e, RFIN waits until full data is received before proceeding - no time out feature like SERIN) - thus the robot continues driving off into the sunset... and it's quite a large / heavy robot (bike chains and sprockets for tank tracks) - As you can imagine, this isn't ideal round a school car park. It looks like it will do some speed as well, though the chassis is not quite finished so we haven't tested in anger yet, but we have discovered the fail safe issue just bench testing.
I would post the code, but I'm at home right now (doing his research for him... blame our results driven education system for that one) and don't have access to it.
I'm not sure how useful it would be anyway because I believe the problem is RFIN waiting for a response.
What we're looking for is some fail safe method of the receiver realizing it's gone out of range, and thus shutting the motors off. Or some way of making a variable with a number stored in it 'time out' - However, I can't see how to do this when the program loop gets stuck at RFIN waiting for a transmission)
I know this could be solved with serin[timeout] / serout, and I've used these commands with the XRF type serial wireless modules before, but these take care of error checking etc for you, which is why we wanted to use RFIN and RFOUT for simplicity... also, the student wouldn't stump up for the XRF modules, so we are stuck with the cheapo 433mhz ones.
Unfortunately, the student has already made the PCB, so a hardware mod to solve the problem would be tricky (also the board is using a combo of SPST and DPDT Relay's to act as the motor - PIC interface as we didn't have time or money to develop a H-Bridge / transistor based motor reversing circuit that could handle the current draw of the hefty motors he picked).
Any thoughts welcome. If it helps, I can try and replicate the code, but I hope people can understand what I'm trying to describe.
Rob
I have a student developing an RC vehicle using the cheap 433mhz ebay wireless modules. Essentially an RC tank. He's using the RFOUT and RFIN commands for simplicity, as myself (and especially him) are not the strongest at coding.
The transmitting PICAXE sends a different number (e.g, '1' for forwards, '2', for backwards, '3' for turn right etc) and the recieving PICAXE obviously waits for a number ursing RFIN, translates that number into what it should do with the drive motors, and thus how the vehicle moves. - It transmits a '0' constantly when no control buttons are pressed as an instruction to remain stationary)
The problem we're having is that if the vehicle goes out of range (and that's not hard with these cheap modules - maybe 15 meters) the last transmitted numbers is the last thing left in the Recieving PICAXE's variable, and seems impossible to update due to how RFIN works (i.e, RFIN waits until full data is received before proceeding - no time out feature like SERIN) - thus the robot continues driving off into the sunset... and it's quite a large / heavy robot (bike chains and sprockets for tank tracks) - As you can imagine, this isn't ideal round a school car park. It looks like it will do some speed as well, though the chassis is not quite finished so we haven't tested in anger yet, but we have discovered the fail safe issue just bench testing.
I would post the code, but I'm at home right now (doing his research for him... blame our results driven education system for that one) and don't have access to it.
I'm not sure how useful it would be anyway because I believe the problem is RFIN waiting for a response.
What we're looking for is some fail safe method of the receiver realizing it's gone out of range, and thus shutting the motors off. Or some way of making a variable with a number stored in it 'time out' - However, I can't see how to do this when the program loop gets stuck at RFIN waiting for a transmission)
I know this could be solved with serin[timeout] / serout, and I've used these commands with the XRF type serial wireless modules before, but these take care of error checking etc for you, which is why we wanted to use RFIN and RFOUT for simplicity... also, the student wouldn't stump up for the XRF modules, so we are stuck with the cheapo 433mhz ones.
Unfortunately, the student has already made the PCB, so a hardware mod to solve the problem would be tricky (also the board is using a combo of SPST and DPDT Relay's to act as the motor - PIC interface as we didn't have time or money to develop a H-Bridge / transistor based motor reversing circuit that could handle the current draw of the hefty motors he picked).
Any thoughts welcome. If it helps, I can try and replicate the code, but I hope people can understand what I'm trying to describe.
Rob