DIY custom 2.4ghz RC radio system for robotics

Looking good Jim!

I’ve a little suggestion about your vaccant AD input for an extra joystick. What about using one or two sliding potentiometer futurlec.com/PotSliding.shtml ? Would be very useful for ex. setting max speed, leg lift height or body height for a hexapod.

A very good idea if you ask me! I’m using 2 buttons (up/down) to change analog settings like speed and body height. But a slider would give much more control!

Xan

I like this display from that company for two reasons:

1.) Black and yellow are the colors of lynxmotion
2.) Fantastic contrast for easy to read information

I like it too. I will see about adding them to the controller on the right side. Thanks for the idea. 8)

I’m glad you did. Looking forward to see the result!

It needed something over there anyway. :smiley:

LOL

…but what if you aren’t remotely controlling a slot machine? :wink:

You would have to use slot #10 :laughing:

Well we are very close to releasing 4 new all aluminum arms, to replace the L5, L6 and SES arm kits. Then we will have no more yellow lexan robots. The black and yellow served us well, but we are moving away from Laser cut parts in favor of aluminum.

Hey Zenta, I was going to order some of these, but they don’t appear to sell the square knobs for them. You know of any place that does?

Nevermind I found them at Mouser. I ordered a bunch. I got the displays in today. I should be able to wrap all this up in the next week or so.

Sounds good Jim! Can’t wait to see the pics of everything together! :smiley:

Xan

Ok, here it is with the Matrix Orbital display and the two additional sliders. Now I just have to build 4 more. Then the programming will start to progress. 8)

It is looking great!

Kurt

Edit: Which matrix orbital display are you using?

WOW 8) Thats super cool :smiling_imp:
Much better with the sliders :wink: , and nice display too. And now you’re using all 7 channels I suppose?

Yup all 7 channels. And just after you complained about how long it takes to read all 7 channels. lol :wink:

The display is MOS-AL162-A. Yup I cheaped out on it. :stuck_out_tongue:

Here is the code as it is right now.

[code]; declare variables here
cha1 var word
cha2 var word
cha3 var word
cha4 var word
cha5 var word
cha6 var word
cha7 var word
a_key var bit
b_key var bit
c_key var bit

; create variables for averaging code
index var byte
buffer1 var word(8)
buffer2 var word(8)
buffer3 var word(8)
buffer4 var word(8)
sum1 var word
sum2 var word
sum3 var word
sum4 var word

; initialize each buffer element, each sum, and then index to 0
for index = 0 to 7
buffer1(index) = 542
buffer2(index) = 542
buffer3(index) = 542
buffer4(index) = 542
next

sum1 = 4336
sum2 = 4336
sum3 = 4336
sum4 = 4336
index = 0

; initialize unused channels outside the main loop
cha5=1500
cha6=1500
cha7=1500

; chirpy squeak kinda thing
sound 9, [100\880, 100\988, 100\1046, 100\1175]

; wake up the display module
serout 8,i19200,[254, 88, 254, 66, 0] ;Matrix Orbital

; initialize the ppm output signal
low 15

; — top of main loop —
start:

; averaging expects that the a/d values are < 4096
; for each channel
; read the a/d
; subtract the previous value from 8 samples ago from the sum
; store the new value in the circular buffer
; add the new value to the sum
; divide the sum by 8 to get the average value
; convert joystick values 392 - 692 to servo values 1000uS - 2000uS

adin 16, cha1 ; right vertical
sum1 = sum1 - buffer1(index)
buffer1(index) = cha1
sum1 = sum1 + cha1
cha1 = sum1 / 8
cha1 = (((cha1*42)-6500)/10)

adin 17, cha2 ; right horizontal
sum2 = sum2 - buffer2(index)
buffer2(index) = cha2
sum2 = sum2 + cha2
cha2 = sum2 / 8
cha2 = (((cha2*42)-6500)/10)

adin 18, cha3 ; left vertical
sum3 = sum3 - buffer3(index)
buffer3(index) = cha3
sum3 = sum3 + cha3
cha3 = sum3 / 8
cha3 = (((cha3*42)-6500)/10)

adin 19, cha4 ; left horizontal
sum4 = sum4 - buffer4(index)
buffer4(index) = cha4
sum4 = sum4 + cha4
cha4 = sum4 / 8
cha4 = (((cha4*42)-6500)/10)

; finally increment the index and limit its range to 0 to 7.
index = (index + 1) & 7

; update the display module
branch (index & 3), [update1,update2,update3,update4]

update4:
serout 8, i19200, [254, 71, 1, 2, dec cha4]
goto makepulses

update3:
serout 8, i19200, [254, 71, 1, 1, dec cha3]
goto makepulses

update2:
serout 8, i19200, [254, 71, 13, 2, dec cha2]
goto makepulses

update1:
serout 8, i19200, [254, 71, 13, 1, dec cha1]
; goto makepulses

; build and send the ppm output
makepulses:
pulsout 15,800
pauseus ((cha12)-800)
pulsout 15,800
pauseus ((cha2
2)-800)
pulsout 15,800
pauseus ((cha32)-800)
pulsout 15,800
pauseus ((cha4
2)-800)
pulsout 15,800
pauseus ((cha52)-800)
pulsout 15,800
pauseus ((cha6
2)-800)
pulsout 15,800
pauseus ((cha7*2)-800)
pulsout 15,800

; do it again ad infinitum
goto start [/code]

When using an extra co-BAP I don’t think thats a problem anymore. :wink: But I’ve not tried reading all 7 channels on a single BAP, I think it should work ok. Just a bit more time taking… Eh wait :unamused: , I was thinking of my Futaba receiver now… Your Spectrum are probably a bit different, I’m thinking of in what order the receiver sends out the pwm pulse to each channel. You probably have to use the scope to check the actual order. This is for making sure you read the channels in the right order or you’ll end up spending very much time waiting for the next channel, if you know what I mean. Maybe the spectrum have another more ideal order for what I know?

Thanks for sharing your code Jim!

Now, this must be the ultimate robot controller. Would be fun to try making something like this one time.

When are you going to try it on one of your robots? A little video would be great :wink:

It is great to see the progress here! The fun thing about this is that we can make it all very customizeable and scaleable.

I think it will be easy to now integreate in the new sliders in. It is probably more or less the same code as for the two joysticks. A ADIN in for each of them probably using the same averaging code.

Likewise I think the keypad code should be easy to integrate. You might get by trying the pull-up resistors that are built into the the atom-pro or we might be better off adding some explicit ones to the 4 inputs (either row or column). I will modify the code I sent you earlier once I know which 8 IO pins you are using for the keypad. I am pretty sure your IO pin assignment from before:

=Row C=Column P0 = Spare analog input (battery check) P1 = Spare analog input P2 = Joystick 3 (optional) Y P3 = Joystick 3 (optional) X P4 = Keypad R1 P5 = Keypad R2 P6 = Keypad R3 P7 = Keypad R4 P8 = PPM out P9 = Speaker P10 = LCD out P11 = Spare P12 = Keypad C1 P13 = Keypad C2 P14 = Keypad C3 P15 = Keypad C4 P16 = Joystick 2 (right) Y P17 = Joystick 2 (right) X P18 = Joystick 1 (left) Y P19 = Joystick 1 (left) X
Is no longer accurate. I believe you are using:
P2-P3? for sliders?
P8 - LCD
P9 - Sound
P15 - PPM out.
P16-P19 for Joysticks

I like the idea of using P15 here for PPM as for a second version I may want to experiment with XBEE and use P14-P15 for bidirectional communicaton using the hardware serial port

So it looks like the Keypad may have to be split to a use 3 connectors? Maybe something like: P4-P7 and P10-11,12-13.

I think it would be great to have multiple versions of this controller. One that is RC that would be easy to integrate the RC stuff with for example the ROVER if you wish to use the 4 channels to directly control the motors. I think the Zigbee aproarch will be a lot of fun to integrate bidirectional communication. Also it would be fun on working on minimizing the processor overhead. We could for example have the controller only output when things change so for example the phoenix would not have to keep asking what the values are, but would simply need to check to see if the controller told it things are different…

Again Jim this look great! As for cheaping out on the LCD, it looks like a reasonable one for now and being a DIY project, one could always upgrade it!

Kurt