Let's Make Robots!

mRF24J40MA 2.4GHz Transceiver USB Base Station Project

Allows my robots to communicate wirelessly with my PC.

Like many of us, I've been working quietly on my next robotics project.  Along the way I wanted to be able to wirelessly monitor what's happening deep inside their firmware.  On the bench a USB cable is enough but once they begin to free roam under their own control a wireless solution is needed.

I bought some MicroChip mRF24J40MA 2.4GHz transceiver modules for about $12 from DigiKey.  They communicate with the processor via SPI.  I managed to interface the boards to my robots, Fitzy and Carraldo, and after many tribulations they could chat back and forth.

At this point my plans for extending the conversation to my PC slammed into a wall.  Microchip sells a USB attached network sniffer for about $50; the ZENA.  I had hoped that I'd find a way to tap into this device.  Unfortunately it was beyond me.  So, in the end, I build my own USB dongle equipped with a mRF24J40MA and so now I can listen in or communicate with my creations.

I've shared the design on the linked page; all code, schematics, toner transfer patterns, and build instructions.  Perhaps someone will find it, or bits of it, useful.

In the meantime, I'm working on a remote wireless card that will sport a virtual 8 bit port plus a small prototyping area that you'll be able to control from the wireless USB dongle.  The hardware is complete and I'm writing the code.  It's largely adapted from code I used in the robots and the USB dongle.  It will support regular digital input and output, 12-bit analog input on 4 of the pins, PWM, Servo functions and hopefully a host of additional features.

Dr Iguana

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Telemetry is still voodoo to me :( Tasty work. Thank you or sharing.

Hi birdmun,

That's a completely fair observation.  In the MicroChip familly that I use there are several 18F chips with USB capability and also many dsPIC32 (sadly not the dsPIC33).  Using an 18F2550 would have combined the dsPIC33 and FT232RL into one.

The reason I went with the FT232RL was simplicity.  I'd earlier done a design using the 18F2550 and had problems with the device occassionally (but not often) going offline.  I was never certain why that happened and the USB capability manifests itself through some fairly complicated code on the 18F.  In the end I guessed that the 18F was being put into sleep mode by the USB and that I simply did not understand how to deal with this.  The FT232RL adds some bucks but so far it just works.

The dsPIC33 was chosen because I'd spent the last three weeks working to get the mRF24J40MA talking to the processor.  It was a long road of misadventures so probably doing it again with a new familly of processor (18F) would go much smoother but you know the expression "Once bitten ...".

1) I was learning SPI and did not appreciate the implications of a protocal that has no defined start conditions.  Both parties have to agree when the conversation begins or the result is gibberish.  In the case of SPI, it's a matter of using the /CS (chip select low) line on the mRF24J40MA module.  I was short of control lines and hardwired the /CS low not realizing that any random noise during startup would permanantly put the microcontroller and RF module out of sync.

2) I was counting on the ZENA wireless packet sniffer to be a big help during development.  It turned out that when plugged into the front USB of my computer it does not capture packets.  It detects, Windows installs the driver, the Wireless studio software can see it, BUT it can not capture packets.  Plugged into the rear USB it works as advertised.  I only realized that everything was working when, out of desperation, I added the RF module to my second robot, Carraldo, and suddenly the two robots were happily communicating even though the ZENA showed nothing.  Once I moved the sniffer to the rear USB it saw everything fine.

3) FInally, I wanted to move quickly on the wireless base station so I decided to go with what worked and that, at least, has proved a success.

Cheers

Thanks for the explanation. It was a much more indepth reply than I had expected. Just working is much better than trying to figure out how to make something else work correctly, depending on the headache(s) one has already encountered. :)

I'm kinda surprised something like a 18f2550 wouldn't have worked for you. Would it not have saved money/space? To be fair, I only know enough to get myself into trouble. :) I would imagine there are smaller chips that have USB capability built in.