Open Source Arduino transmitter/receiver for (V)ESC

Lightweight / Folding / Portable EVs - seats optional
erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Open Source Arduino transmitter/receiver for (V)ESC

Post by erwincoumans » Jun 06 2015 2:34pm

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_4.jpg (76.34 KiB) Viewed 6344 times
FullSizeRender_2.jpg
FullSizeRender_2.jpg (49.5 KiB) Viewed 6344 times
Bill of Material: 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: Select all

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: 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/B ... AT_command

Code: Select all

+++
AT+ROLE=ROLE_CENTRAL

Code: Select all

+++
AT+ROLE=ROLE_PERIPHERAL
Last edited by erwincoumans on Jun 10 2015 10:11am, edited 8 times in total.

User avatar
okp   100 kW

100 kW
Posts: 1153
Joined: Oct 26 2014 3:27pm
Location: Paris
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by okp » Jun 06 2015 3:19pm

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

torqueboards   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by torqueboards » Jun 06 2015 5:11pm

Awesome! Thanks for sharing..

I'm also curious on the reliabilityand if interference can disrupt the connection?
DIYElectricSkateboard.com Electric Skateboard Kits

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by erwincoumans » Jun 06 2015 7:06pm

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

The Nyko Kama never worked reliably for me.
Last edited by erwincoumans on Jun 07 2015 1:03pm, edited 1 time in total.

torqueboards   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by torqueboards » Jun 06 2015 9:32pm

Can I use this for any ESC? I've heard of issues with the Boosted BLE also and people losing connection.

GT2B is really rock solid. Have about 2200+ miles on my board and it's never had any issues.
DIYElectricSkateboard.com Electric Skateboard Kits

User avatar
bandaro   10 kW

10 kW
Posts: 526
Joined: Jun 01 2010 2:17am
Location: Canberra, Australia

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by bandaro » Jun 06 2015 10:29pm

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?

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by erwincoumans » Jun 06 2015 10:35pm

torqueboards wrote:Can I use this for any ESC
Yes, any ESC, not just VESC.
bandaro wrote: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.

User avatar
okp   100 kW

100 kW
Posts: 1153
Joined: Oct 26 2014 3:27pm
Location: Paris
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by okp » Jun 07 2015 12:26am

I was looking at this one

http://hobbyking.com/hobbyking/store/__ ... _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!

elkick   100 W

100 W
Posts: 127
Joined: Nov 13 2014 3:45am
Location: Hamburg

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by elkick » Jun 07 2015 10:36am

Thanks erwincoumans, I will give it a try as well, just ordered the beetles.

Might be worth to try it with one of those Logic3 Nunchuks lying around here with integrated rechargeable batteries. :)
http://www.esk8.de/vesc VESC V4.12 - made in Germany
http://www.esk8.de/shop General eSkateboard parts

torqueboards   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by torqueboards » Jun 07 2015 10:51am

Thanks erwin! I'm in for 1 to test it out.

(2) Bluno Bettle - $41
3.7v 600mah - $8.98
TOTAL = $49.89 so far.

Neat project to try out.
DIYElectricSkateboard.com Electric Skateboard Kits

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by erwincoumans » Jun 07 2015 12:09pm

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   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by torqueboards » Jun 07 2015 12:13pm

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.
DIYElectricSkateboard.com Electric Skateboard Kits

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: HOWTO: Open Source Arduino Bluetooth transmitter for (V)

Post by erwincoumans » Jun 07 2015 12:30pm

torqueboards wrote: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   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: FAIL: Open Source Arduino Bluetooth transmitter for (V)E

Post by torqueboards » Jun 07 2015 12:37pm

How much soldering would be required? Shouldn't be too bad? I'm sure not as complicated as VESC.
DIYElectricSkateboard.com Electric Skateboard Kits

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by erwincoumans » Jun 08 2015 2:19am

torqueboards wrote: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:
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= ... 2067112037

nieles   10 kW

10 kW
Posts: 672
Joined: Jul 14 2008 5:39pm
Location: The Netherlands

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by nieles » Jun 08 2015 2:26am

http://www.rfduino.com/product/rfd22102 ... index.html

these might be interesting. (NFR51822 inside)

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by erwincoumans » Jun 08 2015 2:37am

nieles wrote:http://www.rfduino.com/product/rfd22102 ... 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   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by torqueboards » Jun 08 2015 2:41am

torqueboards wrote: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 wrote: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?
DIYElectricSkateboard.com Electric Skateboard Kits

torqueboards   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by torqueboards » Jun 08 2015 2:43am

@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.
DIYElectricSkateboard.com Electric Skateboard Kits

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: Open Source Arduino nRF24L01 transmitter/receiver for (V

Post by erwincoumans » Jun 08 2015 11:13am

torqueboards wrote:@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/crossf ... ntiometer/
(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.)
crossfader__53400.1405378799.1280.1280.jpg
crossfader__53400.1405378799.1280.1280.jpg (11.75 KiB) Viewed 6512 times
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.

torqueboards   100 MW

100 MW
Posts: 2940
Joined: May 27 2013 10:02pm
Location: San Francisco, CA
Contact:

Re: Open Source Arduino transmitter/receiver for (V)ESC

Post by torqueboards » Jun 08 2015 11:38am

Awesome man! Thanks for sharing. This will come out nicely.
DIYElectricSkateboard.com Electric Skateboard Kits

User avatar
buzztiaan   1 W

1 W
Posts: 52
Joined: Mar 09 2015 4:57am
Location: Netherlands

Re: Open Source Arduino transmitter/receiver for (V)ESC

Post by buzztiaan » Jun 09 2015 2:37am

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 :)
HK150 - 5055 SK3 280kv - 6S 5000mAh - 90mm bigfoots
https://nurdspace.nl/RobertLongboard

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: Open Source Arduino transmitter/receiver for (V)ESC

Post by erwincoumans » Jun 09 2015 3:26pm

buzztiaan wrote: 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).

elkick   100 W

100 W
Posts: 127
Joined: Nov 13 2014 3:45am
Location: Hamburg

Re: Open Source Arduino transmitter/receiver for (V)ESC

Post by elkick » Jun 10 2015 7:20am

erwincoumans wrote:
Do we need two of the Arduino Nano Shields for the communication between Nunchuk and receiving unit?
http://www.esk8.de/vesc VESC V4.12 - made in Germany
http://www.esk8.de/shop General eSkateboard parts

erwincoumans   100 W

100 W
Posts: 141
Joined: Apr 02 2015 11:25pm

Re: Open Source Arduino transmitter/receiver for (V)ESC

Post by erwincoumans » Jun 10 2015 8:08am

elkick wrote:
erwincoumans wrote:
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: Select all



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

Post Reply