PDA

View Full Version : Help with RFA020 URF and ERF



Robtom8
10-01-2013, 15:19
Ive only just got the new RFA020 and im looking to replace it with with the (trouble with AXE213 reciever data units (http://www.picaxeforum.co.uk/showthread.php?22279-trouble-with-AXE213-reciever-data-units)). The project i am making at the moment is using a laptop to control a small boat with 2 propellers. the previous thread hyperlinked will explain the information behind this. However is there a way of using the URF to relay information to a PIC connected to an L298D which in turn drives two motors for the propellers of the boat via a laptop. The end product is being able to press one of the directional keys on the laptop which will then be sent to the boats ERF inorder to tell the pic to drive the Boat.

hippy
10-01-2013, 16:06
PC->USB->URF, over the air to ERF->PICAXE->L298D shouldn't be a problem. In fact, it would be just like using a normal serial link over a hard-wired cable.

Haku
11-01-2013, 06:20
I've used two XRF modules to control a dual motor bot with an L298N (now upgraded to custom more powerful H-bridges), they work well.

Couple of points to keep in mind:

The Ciseco RF modules two configurable settings to take note of; packet size and a buffer. If you send a message via serial that's smaller than the radio packet size (default 12 characters) it'll wait 100ms (or whatever you set) before transmitting it over the airwaves, but if you send a message via serial that's the same size as the radio packet size it'll transmit that over the airwaves with no delay.
This page is pretty good at explaining things further: http://www.openmicros.org/index.php/articles/84-xrf-basics/151-packet-length-and-timeout

Don't forget to put failsafe code into your program to stop the motors when it stops receiving commands over the airwaves. :)

Robtom8
11-01-2013, 11:00
Hi,
Im a little confused on the method behind the process of going from laptop to USB to URF as i have been trying to figure out a way of doing this without writing complicated coding as i have only come into contact with PIXACE language for about a year due to college work. Would you be able to write an example of this process or code to help me get steered in the right direction. The last method I tried was compliacted as it went through: laptop -> Motor Bee -> 18m2 -> AXE213. however this did not work as planned.

Would someone be able to give me an example of codeing that allows me to use my laptop as an input for the URF to transmit over to an ERF as i am stuck on trying to do it?
Many thanks in advance.

hippy
11-01-2013, 11:50
You can simplify things by using Programming Editor Terminal to send printable characters to the robot; "L" for Left, "R" for Right etc. If you want a specialised app that sends cursor keys you can write that later; this will get something working as quickly as possible.

As noted, this works with a hard-wired cable as well as between URF and ERF so start with an AXE027, downloading the following program -

#picaxe 18m2
#terminal 4800
do
serrxd b0
sertxd( "Got ", b0, cr, lf )
loop

Download that, Terminal should appear, send an "L" and "Got L" should come back. Close Terminal when satisfied it is working.

Un-plug the AXE027, add the ERF for the PICAXE, power up the PICAXE.

In Programming Editor, select the URF via View->Options, open Terminal, select 1200 baud, then select 4800 baud, send an "L" and again "Got L" should come back.

Now add some PICAXE code to handle the character received to control the motor driver chip, and you're done.

Robtom8
12-01-2013, 10:28
I have tried it today. the download cable works when inputing this however when using the ERF and URF it is not downloading or sending the data. I have tested the components and have also made sure that the com ports are right. when using a voltmeter on the pins i am getting a reading of 3.31. Maybe its because i am using a different 18M2 PIC if that helps from last night. Why is the chips not downloading the data?:(

hippy
13-01-2013, 16:23
Did you do it exactly as described in post 5 ?

If not there will be other issues to take into account. Using SERRXD, which blocks further downloads, you cannot initiate another download without a Hard Reset, and with no Reset button on an 18M2 that has to be a power cycle. The normal process for Hard Reset is to turn board power off, initiate download, turn board power on. That won't work with URF-to-ERF download; the URF will have sent its "here's a download" message before the ERF is powered up so the ERF never sees it, never passes that on to the PICAXE. A power-cycle Hard Reset for URF download requires the power to be turned off for the PICAXE but it must be kept on for the ERF.

It Is perhaps best to use URF-to-ERF for either downloading or communications, at least until you are familiar and experienced with doing both. Start with download via AXE027, wireless data communications to the ERF connected to a PICAXE input other than the download Serial In.

There could be other issues as well so it's best to post your hardware circuit and when reporting voltages measured, indicate where that is measured.