Arduino Mega based DIY Remote (XBee)

As I have recently mentioned in some of the other threads, I have been collecting some new components to build myself a second DIY remote control. Some of the components that I have collected and their requirements include:

2 4 function Joysticks (servocity.com/html/4_function_joystick.html): 3 Analog + 1 digital each: 6A 2D

2 Sliders (mouser.com/ProductDetail/Eag … P9ug%3d%3d): 2A

1 16 button keypad (I had a different one, but will probably change to: elexp.com/cmp_1604.htm): 8D

Other switches: 4+ (can be handled by 1 D if added on to keypad logic)

XBee: 1 USART (2 D maybe 3)

1 Display (Trying an OLED like DialFonZo - sparkfun.com/products/8537): 1 U

Sound: 1D

PC connection: 1U

So I need at least: 6 Analog pins, 12 digital pins, 3 Usarts. Which does not fit on a Basic Atom Pro 28, so I decided to go with an Arduino Mega. I am using ones by SeeedStudio: seeedstudio.com/depot/seeedu … 73bf3cbf85
This gives me: 4 USARTS, 16 Analog pins, and 70 digital pins, so leaves me lots of room to experiment and add additional things like Nunchucks (Wii)… I thought about doing this with an Arc32, but I did not have any spare ones sitting around.

I have started to experiment with a rats nest of wiring and have some of the pieces in place, so far I have done the following:

Step 1: I plugged in a 4x4 keypad I had sitting around (different one made by actcomponents.com), that I ordered years ago from Digikey. I put tape over some of the keys to have the same labels as the ones that were used in the DIY. Code is working on Arduino. Easy to hook up, just used 8 digital IO pins. Did not need pull-ups as I simply enabled the ones on the Atmega1280. This now works.

Step 2: I connected up a 128x128 OLED display. Connected to USART, running at 125000 baud rate. I started off with some of DialFonZo BAP code and have it running on the Arduino. Started creating functions to do many of the simple things like display text, numbers… Got some of it working. Will add more as I need it. Will also try to abstract this out into a c++ class, such that I can have different implantations for a simple 2 line or 4 line LCD display.

Step 3: rigged up one of the 4 function joysticks. Have it connected to 3 of the analog inputs, plus 1 digital. Have analog code in place that does the averaging of the last 8 samples (like our BAP code). That part appears to be working. I have some of the centering code in place that scales the output from 0-255 and tries to make the initial centers to be 128. Still need to add the code to read the actual Mins/Maxs for each one. Note: these joysticks appear to give me good values from near 0-1023.

The following picture shows the OLED display with outputs showing the outputs for 1 joystick (Should look familiar to DialFonZo):

Step 4: I connected up an XBee using a parallax USB adapter (parallax.com/Store/Accessori … fault.aspx). I have had better luck with these on Atmega based systems than the ones from sparkfun as it does voltage conversion both directions…

Step 4a: I converted my XBee conversion program from Basic for the BAP to an Arduino sketch. Currently only working on Mega, but will add support for non-mega as well.

That is what is completed so far. My next steps will include:

  1. build some form of case for these components as they currently are not very portable :laughing: This will also include something to clean up the wiring. Maybe a shield, maybe …

  2. Hook up the rest of the current components (2nd joystick, sliders, speaker…)

  3. Figure out what I want to display on the OLED. Will probably have a graphical battery indicator (rectangle shows how much left, maybe change color…), show the 3 joystick values for each stick plus slider (value and/or graphic). Maybe some Status areas: Text? Values? Button States? …

  4. Finish porting my DIY Remote code to this new platform. Will take me awhile as I have several other projects going on as well.

That is all for now.

Thoughts?

Kurt

sounds like a dream :slight_smile: i like it and planning to create same/similar but with BT module

if you be so kind and share firmware and some schematics

Maybe a LCD Display with touchscreen. You would be able to create virtual buttons that change in form, size, labeling and function due to different programs.
Same thing for the sliders and switches. I would also decrease wearable parts und clean up the front panel to make space.

Do you have a CNC mill?

I will for sure share everything. I don’t have any schematics for what I am doing yet. May produce one later as I have things hooked up. These parts are pretty easy to wire in on the mega. The 16 button keypad is simply running a 8 (4 rows and 4 cols) wires from the keypad to the arduino. Software wise you enable the hardware pull-ups. The joysticks I simply wired up 3 wires per axis (+5, GND, and the center one which I connect to an analog pin… Will cleanup soon and post.

Code wise I am still experimenting, I could post bits and pieces that I have so far, like code to read buttons and the like or the sketch that I used to do the XBEE configure, but will wait until I have some more limping along. That is unless some one wants to see some specific stuff now.

I think touch screens would be interesting as well, but decided to first try a simple progression from our first DIY. Maybe something like: sparkfun.com/products/10089

As for CNC mill? No :frowning: I have drills, jig saw, Dremel, table saw, miter saw…)

I have not played around much with BT yet, but could be fun. I like working with XBees as it makes it easy for me to set it up such that I can control multiple things…

Kurt

Hm, if you need something to be milled just ask. Maybe i can make it for you.
I mill most parts of GFK FR4 if its possible

i like Xbees too but here in Poland it’s quite expensive and rare enough to make decision for BT module.
at the other hand BTM-222 modules promising 100m range so mostly enough. here it costs around 20$ when Xbee around 60$

as a schematic i meant the connections from peripherals to mega board, could be very useful since arduino uses own pin map

eagerly waiting for topic updates :slight_smile:

Ha, i use BTM-222 too. Unfortunately i havent got them working with BB.

that would be offtopic but need to ask.

how did you connected BTM to BB? mine works fine with SSC and there is a 74HCT14D (or similar) in between BTM and Tx/Rx pins of SSC. connection ommits MAX232 chip.

viewtopic.php?f=30&t=7429

Quick update, to say that I have not drooped this project, I have been busy with other projects like testing Arduinos and other non robot tasks, like building a deck and planting trees.

However today I did have a little time to play with this and I am playing around with some of the XBEE code. I now have code that I can run from the debug port connected to the PC that allows me to select a destination. It has all of the code in place to issue the ND command and find all of the XBee that are available and create and maintain a list of them and allow me choose which one to communicate with. Later will have a configuration panel for the display to do this, but waiting until I have more of the hardware connected up.

I still need to make some type of front panel to hold all of the stuff, maybe should take some of you up on the offer. But in the mean time I can continue to play.

Well that is all of the typing I can do for now.
Kurt

While waiting for Botboarduino to arrive, I have been playing some with remote control code. Currently only have one joystick and the buttons hooked up, but it is enough to test a lot of the code. I am still doing configuration with serial port. The display currently looks like:arduino-remote-2.jpg

The code is working well enough now that I can hit 0 on my T-Hex and it starts, can hit other buttons and tell it to walk or the like. Also getting messages to display as you can see walking on the display.

I also hacked up hardware serial for build 22 to allow for output buffering. Have not tested much, but so far it looks like it works on Mega, soon will test on others like UNO and botboardduino.

Still more work to go, but I uploaded current code which includes the serial code in case anyone wants to have a preliminary look.

Kurt
DIY_Remote-110704a.zip (25.3 KB)

Hi there… Really Really interesting …!!!

Just take a look at the thread…!

I attach a little code for the Arduino with a library that i have edit.

I think i will rejump in the game… :slight_smile:
DIY_Remote_Rev5(03-06-2011).zip (5.76 KB)

I don’t know if i have post that last video yet… if i did… real sorry… LOL

Looks great! My goal is to implement the same functionality as the earlier DIY XBees which has BAP28… At least for a common communication protocol. As part of this I will be changing the client sides as well to allow for additional data in the packets. Have clients that know their minimum data and ignore additional. Or could add more handshaking where clients say which fields they want…

I like your configuration stuff, may lift some of it. May also extend my protocol some and add the ability for robot to report battery levels maybe as percentage or like an show level as some form of graph, which changes color when below some percentage…

Lots of things to try when I have chance and …

Kurt

I was more at the “Interface” side when i suddenly have no time… LOL

Would like to have multiple pages to change function etc…

On that video it show mainly the I/O page wich show the value of potentiometer and digital switch.

@Kurte: Witch board do you use. i have try to upload your program but have issues…

I am using Seeeduino Mega board. Soon with Botboarduino Mega shield.

Kurt

I am using:

robotshop.com/ca/dfrobot-atmega1280-mega-usb-microcontroller-4.html
with that shield
robotshop.com/ca/dfrobot-i-o-expansion-shield-arduino-mega-v1-1.html

I get that when press “Play”

Display_OLED.cpp:6:23: error: Streaming.h: No such file or directory Display_OLED.cpp: In function 'void OLEDDisplayString(byte, byte, byte, word, const char*)': Display_OLED.cpp:50: error: no match for 'operator<<' in 'Serial2 << "s"' Display_OLED.cpp:50: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In function 'void OLEDDisplayNum(byte, byte, byte, word, word, byte)': Display_OLED.cpp:72: error: no match for 'operator<<' in 'Serial2 << "s"' Display_OLED.cpp:72: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In function 'void OLEDDrawRect(byte, byte, byte, byte, word)': Display_OLED.cpp:86: error: no match for 'operator<<' in 'Serial2 << "r"' Display_OLED.cpp:86: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In member function 'void RemoteDisplay::Init()': Display_OLED.cpp:111: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In member function 'void RemoteDisplay::SwitchToDisplayMode(byte)': Display_OLED.cpp:123: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In member function 'void RemoteDisplay::DisplayJoystick(byte, byte, byte, byte)': Display_OLED.cpp:151: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In member function 'void RemoteDisplay::DisplayKey(char)': Display_OLED.cpp:204: error: '_BYTE' was not declared in this scope Display_OLED.cpp: In member function 'void RemoteDisplay::DisplayStatus(char*, char*)': Display_OLED.cpp:224: error: no match for 'operator<<' in 'Serial2 << "c"' Display_OLED.cpp:224: error: '_BYTE' was not declared in this scope
Underline that:
OLEDSerial << “s” << _BYTE(x) << _BYTE(y) << _BYTE(bFont)

One last thing is that i want to order XBee. but want to have the same as yours… to be able to follow you…

I am using the streaming library: arduiniana.org/libraries/streaming/
You can find this in the help\libraries section.

I am using simple Version 1 XBee like: sparkfun.com/products/8664

On Atmega based processors I have had better luck with Parallax based adapters. The one I am using: parallax.com/Store/Accessori … fault.aspx

–Kurt

Ok but witch one you suggest to buy ?

The parallax is much cheaper too…!