Open Source Arduino transmitter/receiver for (V)ESC

erwincoumans

100 W
Joined
Apr 2, 2015
Messages
141
Torqueboards asked me to help with a simple open source controller, so here is one very affordable example setup using two Arduino Nano's using nRF24L01+ transceivers.

I'll update this post over time to make it a easier step-by-step process. Originally, my post described an BLUNO Beetle using Bluetooth BLE, but it is not fully rock solid (drops connection easily). The nRF24L01+ is more 'rock solid' so that is used instead. (Below in quotes is the old Beetle description, for someone who still wants to check it out)

FullSizeRender_4.jpg
FullSizeRender_2.jpg

Bill of Material:
  • 2 Arduino Nano (around USD$ 10 at Amazon.com. I got the version without header for easier soldering of the nRF24L01+ (http://www.amazon.com/Lucksender-Atmega328p-Controller-Development-Compatible/dp/B00N9WVXMK/ref=sr_1_5?ie=UTF8&qid=1433746451&sr=8-5&keywords=arduino+nano) but there is a Arduino Nano I/O shield that has a socket for nRF24L01+. I'll test the I/O shield soon (http://www.amazon.com/gp/product/B00BD6KEYC?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s00)
  • 2 nRF24L01+ (around USD$ 7 per pair at Amazon.com, see http://www.amazon.com/nRF24L01-Wireless-Transceiver-Arduino-Compatible/dp/B00E594ZX0/ref=sr_1_1?ie=UTF8&qid=1433746522&sr=8-1&keywords=nrf24l01%2B )
  • Wires, potentiometer of your choice (I re-used the pot of a Karma)
  • Enclosure of your choice, I used a stripped-down Kama Nunchuck. USD$ 18.36 at Amazon, http://www.amazon.com/Wii-Kama-Wireless-Controller-Colours-Nintendo/dp/B0012R58LG

This RFDuino with Nano and nRF24L01+ would be compatible with the same setup too: https://rfduino.wordpress.com

The receiver has a safety mechanism, if it looses connection for 0.5 seconds it will go to neutral servo PWM.

The Arduino scripts for transmitter and receiver, there is a 'Download' button at the right side of the page:
https://github.com/erwincoumans/ArduinoServoTxRx

The Arduino scripts assume the following pin connections:
Code:
Transmitter has a potentiometer pin on Analog 3
Receiver has the servo PWM pin on D3

The nRF24L01+ transceiver is connected to both Tx/Rx Arduino Nano as follows:

VCC -> 3.3v
GND -> GND
CE -> D9
CSN -> D10
MOSI -> D11
MISO -> D12
SCK -> D13
IRQ -> not used/not connected
Note that some wireless KAMA Nunchucks can be directly used with VESC, but this Arduino solution can be customized (bi-directional communication, show battery level etc in the future) and has a more 'rock solid' connection.

Enjoy!


Here is old Bluno Beetle description, for someone who still wants to check it out. I prefer the Arduino Nano + nRF24L01+, its connection is more rock solid.

A pair of the new Bluno Beetle is a tiny Arduino with built-in Bluetooth 4.0 BLE make a great controller/transmitter and receiver for an electronic skateboard PWM servo signal: it is really small. The setup is very simple and only requires a tiny bit of soldering:

  • 3 wires for the receiver (ground GND, 5V and digital PWM pin D3)
  • 2 wires for the transmitter battery (ground GND and VIN), and 3 wires for the potentiometer (ground GND, 5V and analog pin 3)

FullSizeRender-27.jpg

Bill of Material:
  • 2 * Bluno Beetle at USD$ 14.90 each, see http://www.dfrobot.com/index.php?route=product/product&product_id=1259#.VXNIeuv6VF4
  • 1 3.7V LIPO batteries (Beetle accepts <8V), USD$ 6.99 for 4 batteries and a charger, I am using a single 3.7V 600mAh, 20C battery, see http://www.amazon.com/gp/product/B00LK0DY3O?psc=1&redirect=true&ref_=od_aui_detailpages00
  • Wires, potentiometer of your choice (I re-used the pot of a Karma)
  • Enclosure of your choice, I used a stripped-down Kama Nunchuck. USD$ 18.36 at Amazon, http://www.amazon.com/Wii-Kama-Wireless-Controller-Colours-Nintendo/dp/B0012R58LG
You need to setup one Beetle as Bluetooth CENTRAL and the other Beetle as Bluetooth PERIPHERAL, using the Serial Monitor of the Arduino IDE.
This only needs to be done once, and it will keep the setting.
See http://www.dfrobot.com/wiki/index.php/Bluno_SKU:DFR0267#Configure_the_BLE_through_AT_command
Code:
+++
AT+ROLE=ROLE_CENTRAL
Code:
+++
AT+ROLE=ROLE_PERIPHERAL
 
congrats for this. I had REALLY bad experience with my Nyko and wiireceiver. Using a GT2x since then. Do you thing that this is reliable and will be as rock solid in terms of signal then a GT2e ? just asking !

well done
 
[strike]It should be rock solid, it uses the same Bluetooth BLE protocol as the Boosted Board and Yunec E-Go.[/strike]
You can optionally secure the connection, so that only 2 specific Beetles connect, by MAC address.

The Nyko Kama never worked reliably for me.
 
This is exactly what I was looking for to make a sweet little controller. Ends up a little more expensive than the gt2b (almost triple for me not including a case), but you know...

My problem however is the lipo's linked, they can't be shipped to australia. Can I use any small lipo cell? and I assume I don't need 4 of them, just 1?
 
torqueboards said:
Can I use this for any ESC
Yes, any ESC, not just VESC.
bandaro said:
lipo's linked, they can't be shipped to australia. Can I use any small lipo cell? and I assume I don't need 4 of them, just 1?
You can use any battery you like, the spec of the Beetle tells <8V, it is not clear what the minimum is, likely 3.7V. A 3.3V coin cell didn't work for me. The Beetle uses the ht7850 voltage regulator.
 
I was looking at this one

http://hobbyking.com/hobbyking/store/__20386__Turnigy_nano_tech_750mah_1S_35_70C_Lipo_Pack_Fits_Nine_Eagles_Solo_Pro_180_.html

I had my accident with the Nyko Kama (+ wiiceiver); so I got a Nyko Kama ready to try this. Just ordered two Bluno Beetle.

Awesome!
 
Unfortunately after some more testing the Beetle BLE connection is indeed not rock solid. You might want to cancel your order until we find a rock solid transceiver that is customizable.

I think the nRF24L01+ with PA and NLA is better but it requires more soldering.

I'll do some more testing and report back.
 
torqueboards said:
Aww darn. Had a feeling too since I've heard bluetooth wasn't that reliable with boosted and yuneec e-go. The nRF24L01+ seems to be stable but I haven't tried it.

Yes, the nRF24L01+ has been stable for me, but it requires more soldering. I'll report back once I find a rock solid version.

It could be that the Beetle needs some configuring, but I don't want to encourage people to start ordering Bluno Beetles before more testing is done.

I'll report back soon.
 
torqueboards said:
How much soldering would be required? Shouldn't be too bad? I'm sure not as complicated as VESC.

I updated the first post and I replaced the Beetle with the Arduino Nano + nRF24L01+ and added new Arduino scripts in the github repository linked in the first post. By default it will require connecting 7 wires between Nano and nRF24L01+. There are some options to integrate the Nano and nRF24L01+ easier:

  • Arduino Nano I/O shield with nRF24L01+ socket, see http://www.amazon.com/gp/product/B00BD6KEYC?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s00
  • RFDuino custom PCB with Nano + nRF24L01+ socket, see https://rfduino.wordpress.com

I'll update this post with more details and easier setup.

Secondly, I'll figure out if there are some settings that make the Bluno Beetle 'rock solid' with its BLE. I was just hoping to go for the simpler Beetle route, but only if the BLE connection would be fully reliable. Here is my question for DFRobot in their forum: http://www.dfrobot.com/index.php?route=product/product&product_id=1259#comment-2067112037
 
nieles said:
http://www.rfduino.com/product/rfd22102-rfduino-dip/index.html

these might be interesting. (NFR51822 inside)

Perhaps, but if it is Bluetooth BLE, it might not be 'rock solid'. For now I am quite happy with nRF24L01+. If you have a VESC, we could connect the nRF24L01+ directly to VESC and write some App for it, but I like the dual Arduino + dual nRF24L01+ because it can be used with any ESC.

I also experimented with the Little Bits wireless receiver (http://littlebits.cc/bits/wireless-receiver, based on RFD21733), connected to a VESC. It is quite reliable but a bit expensive, and the magnetic connections are obviously not strong enough to be used for a skateboard controller. You would need to solder the receiver directly to your ESC, and create some contraption around it for the controller. Customizing the code would be harder, unless you add some Arduinos.
FullSizeRender-28.jpg
 
torqueboards said:
Would we be able to add in the 3.7v 600mah lipo packs to these with usb charging or would that make it more complicated.

erwincoumans said:
USB charging with 2 lipo packs would be great, but I haven't looked in how to deal with USB charging of those packs.

Do you have experience with USB charging of those packs? Also, a custom 3d printer enclosure would be nice, possibly using a little 2d joystick shield.

By the way: I also purchased some linear potentiometers/sliders, and added return springs (so it is similar to E-Go), if someone is interested in that. Obviously it doesn't matter what potentiometer is used (2d joystick or slider pot etc).

We can also discuss this in public in the forum thread?
 
@erwincoumans - I would be interested in the slider w/ return springs. Not sure, if you seen my other open source post which I wasn't able to finish.

I can also get a vacuum formed enclosure for the handheld depending on which route we all choose.
 
torqueboards said:
@erwincoumans - I would be interested in the slider w/ return springs. Not sure, if you seen my other open source post which I wasn't able to finish.

I can also get a vacuum formed enclosure for the handheld depending on which route we all choose.

For the spring-loaded slider, I purchased this one for USD$ 12 a piece: http://shop.lividinstruments.com/crossfader-slide-potentiometer/
(of course you can get cheaper sliders, but most are flimsy and this one is very sturdy and has two smooth tracks to put the springs on.)



Then simply open it and add a ballpoint spring on each side, on a different rail. You might want to extend (pull) or cut the spring to adjust the stiffness and restlength.

FullSizeRender-30.jpg

We could also experiment with other input sensors, for example a touch sensor:
http://shop.lividinstruments.com/force-sensing-resistor

I will add an optional battery feedback on the transmitter, either using LED or a small OLED screen. Then I'll create some 3d printed enclosures.
 
Alright, just borrowed two NRF24L01's from a buddy :)

Wondering if i'll go the 'lets gut a nunchuck' route, or make something from scratch.

For the receiver, i will be using a 5v pro mini, 3.3v regulator for the NRF, powerboost500 of adafruit as powersource / boost convertor, and a single 18650 as powersource. I have some busted PS3 controllers which might turn out as nice sources for a thumbstick ;)

Rough estimates tell me i should get easy 14+ hours out of a single 18650.

The receiver end will also get a 3.3v regulator, but will be fed from the 6V coming out of the HK150. Also the pro mini will be getting that 6V on its 'raw' pin.

Reading your code, it seems you might want some more features inside it :)
Like, light controls? And maybe feedback from the board to controller, for batterylevel or something.

Maybe it would be plausible to merge your code with https://github.com/jaustindavid/wiiceiver/ , at least for the control part. Especially the cruisecontrol would be very nice.

I'll look into all that later :)
 
buzztiaan said:
Maybe it would be plausible to merge your code with https://github.com/jaustindavid/wiiceiver/ , at least for the control part. Especially the cruisecontrol would be very nice.

I'll look into all that later :)

The current scripts at https://github.com/erwincoumans/ArduinoServoTxRx are just a starting point. Note that the nRF24L01+ scripts depend on the installation of the RF24 Arduino library, I added some installation instructions in the README there.

I am planning to implement cruise control. Would cruise control assume a fixed servo PPM signal, or is it really velocity based? In that case, the ESC needs to report the current velocity, right? I think the VESC can report the electrical velocity (ERPM), so it makes sense to use that for the VESC. Other ESCs might not have such feature, and we assume constant servo signal == constant speed?

Also, the receiver is already sending some dummy data back to the transmitter using some ACK message, so we can use that to report back any data we want (based on transmitter request messages).
 
erwincoumans said:
  • 2 Arduino Nano (around USD$ 10 at Amazon.com. I got the version without header for easier soldering of the nRF24L01+ (http://www.amazon.com/Lucksender-Atmega328p-Controller-Development-Compatible/dp/B00N9WVXMK/ref=sr_1_5?ie=UTF8&qid=1433746451&sr=8-5&keywords=arduino+nano) but there is a Arduino Nano I/O shield that has a socket for nRF24L01+.


  • Do we need two of the Arduino Nano Shields for the communication between Nunchuk and receiving unit?
 
elkick said:
erwincoumans said:
  • 2 Arduino Nano (around USD$ 10 at Amazon.com. I got the version without header for easier soldering of the nRF24L01+ (http://www.amazon.com/Lucksender-Atmega328p-Controller-Development-Compatible/dp/B00N9WVXMK/ref=sr_1_5?ie=UTF8&qid=1433746451&sr=8-5&keywords=arduino+nano) but there is a Arduino Nano I/O shield that has a socket for nRF24L01+.


  • Do we need two of the Arduino Nano Shields for the communication between Nunchuk and receiving unit?


  • If you like you can use an I/O shield for each Arduino Nano, but you can also solder the nRF24L01+ pins or use wires:
    Code:
    Each Arduino Nano is connected to its own nRF24L01+ transceiver as follows:
    (nRF24 -> Nano)
    VCC -> 3.3v
    GND -> GND
    CE -> D9
    CSN -> D10
    MOSI -> D11
    MISO -> D12
    SCK -> D13
    IRQ -> not used/not connected

    The I/O shield is bigger than I hoped, I received it yesterday, so I look for a smaller solution.
    Maybe we can design a simple small PCB and share the schematics. (those soldered wires become messy and take space)
    Similar to this PCB, it has Arduino + nRF24L01+ and schematic is available:
    https://rfduino.wordpress.com
 
Back
Top