Open Source Arduino transmitter/receiver for (V)ESC

I'm actualy looking to swap the receiver to the nrf51822 Bluetooth smart module.
The reason why and maybe a good reason for others to use it, is because it is compatible with Bluetooth smart and 2.4ghz gazel protocol (nrf24l) it is the chip I am writing my android and iOS app around, but the reason for this is i can use the same chip for my in hand transmitter and an iPhone/android app, there are already apps on the markets to send pwm signals like redbear, ADRFRUIT, and Nordic with a simple slider, so we can use a controler and an app when battery goes dead.

This chip also can be used as a beacon so you can be notified to connect or disconnect to you board when you get near. Or even get charge status data.

Sadly you can only use 1 protocol at a time!
 
jacobbloy said:
At this point I can sell it as I don't have firmware, but I'm getting them made!

Hi Jacob,

I would also buy a couple of sets from you if you do a run.

Thanks and keep up the good work!

:D
 
Wiiceiver - very dangerous due to random periodic dropped signal (so ultimately not feasible), but awesome coding and control of the board especially with the cruise control and variable acceleration speeds when it isn't dropping signal

2.4ghz R/C remote like the gt2b - awesome reliability, but the trigger is so sensitive and impractical to hold the 'perfect' speed long term.. it's sketchy enough to also not be a feasible solution long term.. not an enjoyable one anyway



Can someone with the skilllzz put the awesome wiiceiver coding with 2.4ghz R/C stability/reliability inside the same Nyko Kama controller (I love the controller, its the perfect size and perfect setup with the cruise control button)??

If someone can do that, I'll take 3-4 units right away :)
 
I think jacobbloy is working on something. Would be nice if it was universal with other ESCs.

Gt2b is awesome 2400+ miles with no drops and holding throttle is easy for me compared to the Quantum Pistol Grip. Only drop was when the battery died out on me.

Wiiceiver works but takes time to fix the connection issue with the Nyko Kama Receiver + Nyko Kama Transmitter. I'll buy for an upgraded Nyko Kama Receiver/Transmitter in 2.4ghz also.
 
Just wanted to post some updates on my modified nunchuk with a custom PCB. I have been working on it the last couple of days, mostly on power saving.

* I have changed to this receiver on the VESC:
http://www.ebay.com/itm/NRF24L01-PA-LNA-SMA-Antenna-Wireless-Transceiver-communication-module-2-4G-1100m-/381268741220?pt=LH_DefaultDomain_0&hash=item58c5634c64
I don't know if my other receiver was broken, but this one has much better range even though the transmitter in my modified nunchuk is the same. I can be 100M far away and control it, and when I use it normally there are no glitches at all. With the other receiver, I could only go 3 to 5 meters away and while using it and I got occasional glitches like the nyko kama. Now the glitches are completely gone. I will experiment a bit more with receivers to see it if the one I had at first was faulty since 3 to 5 meters is way less than it should be.

* I have added a checksum on top of the packets in case there are glitches while reading over SPI with the cable.

* I have reduced the MCU clock frequency and made it go to low power mode when it cannot hear the VESC any more. In low power mode, the current draw is 0.09mA, so it can be left with the batteries for more than a year. Before this I had to remove the batteries when not using it because they would die in a day or two. While running, the current consumption now is 15mA, which is 60 - 70 hours on normal AAA-batteries. Using it for an hour every day (which is more than I do), the batteries would last for two months or more. The original kama had the same current consumption in low power mode, but 25mA when running which is a lot more. I don't know if I really need rechargeable batteries now.

What do you think? Is the power consumption low enough to use AAA-batteries, or would you prefer rechargeable batteries?
 
vedder said:
* I have changed to this receiver on the VESC:
http://www.ebay.com/itm/NRF24L01-PA-LNA-SMA-Antenna-Wireless-Transceiver-communication-module-2-4G-1100m-/381268741220?pt=LH_DefaultDomain_0&hash=item58c5634c64
Yes, that is the extended range version that I am testing too (PA+LNA/SMA). I have not had glitches with the regular nRF24L01+, as long as the transceiver is not too close to the motor or controller. The PA+LNA antenna seems a bit bulky for a hand-held controller.

I also have a USB dongle version of the nRF24L01+PA+LNA that works on Linux and Mac, so you can communicate to your VESC nRF24L01+. I use libusb to communicate with the USB transceiver. So you could use it also to wireless upload a new firmware and perhaps custom user-plugins for VESC. If you are interested in that, I can put the source code for this in a github repo.
Here is a link to the 'crazy radio long range': http://www.seeedstudio.com/depot/Crazyradio-PA-long-range-24Ghz-USB-radio-dongle-with-antenna-p-2104.html
What do you think? Is the power consumption low enough to use AAA-batteries, or would you prefer rechargeable batteries?
AAA batteries are a bit more convenient than small lipos, but either way will do.

I still prefer the ease of programming using the Arduino IDE over programming the STM32Fx series, Arduino seems to have more tutorials and library coverage. So if you want to go for STM32Fx it would be helpful to provide some tutorial how to write 'plugins', and make it easy to upload those plugins over USB instead of firmware flasher.


buzztiaan said:
Could an admin move the non-arduino posts to a seperate thread?
At this stage this thread is hijacked beyond repair, I'm afraid. If I have new developments with Arduino, I likely create a new thread. I could as well remove the word 'Arduino' from the title :D
 
Another update: I tried to minimize the time the NRF is on, so the current consumption in run mode is now less than 8mA. This means that the nunchuk can be on for more than 120 hours on 2 AA batteries.

erwincoumans said:
vedder said:
* I have changed to this receiver on the VESC:
http://www.ebay.com/itm/NRF24L01-PA-LNA-SMA-Antenna-Wireless-Transceiver-communication-module-2-4G-1100m-/381268741220?pt=LH_DefaultDomain_0&hash=item58c5634c64
Yes, that is the extended range version that I am testing too (PA+LNA/SMA). I have not had glitches with the regular nRF24L01+, as long as the transceiver is not too close to the motor or controller. The PA+LNA antenna seems a bit bulky for a hand-held controller.

I'm only using the PA+LNA version on the receiver, the transmitter in the nunchuk is still the small smd module. So even if the TX power is the same, the gain in the antenna and possibly in the rx part of the LNA help a lot.

erwincoumans said:
I also have a USB dongle version of the nRF24L01+PA+LNA that works on Linux and Mac, so you can communicate to your VESC nRF24L01+. I use libusb to communicate with the USB transceiver. So you could use it also to wireless upload a new firmware and perhaps custom user-plugins for VESC. If you are interested in that, I can put the source code for this in a github repo.
Here is a link to the 'crazy radio long range': http://www.seeedstudio.com/depot/Crazyradio-PA-long-range-24Ghz-USB-radio-dongle-with-antenna-p-2104.html

It would be nice to have some code that uses libusb for that :)

erwincoumans said:
I still prefer the ease of programming using the Arduino IDE over programming the STM32Fx series, Arduino seems to have more tutorials and library coverage. So if you want to go for STM32Fx it would be helpful to provide some tutorial how to write 'plugins', and make it easy to upload those plugins over USB instead of firmware flasher.

It is most likely easier for beginners to get an LED blinking with Arduino, but the Arduino IDE is horrible. Eclipse with indexing, refactoring, auto-completion etc. is so much better. Also, I think the Arduino libraries are not made for making complex programs. When things grow, ChibiOS with threads and the libraries made for an rtos is so much better. Even with the nunchuk transmitter I think the code is easier to follow than it would be if it was written using arduino. Another reason I prefer chibios with STM is that I can use the same code base for the VESC and the nunchuk implementation, which makes development easier for me.

Regarding writing and uploading firmware to the stm32f100, I'm using the build in UART bootloader in the f100, which is very similar to how firmware is uploaded to the arduino. Even an arduino could be connected to my modified nunchuk to upload firmware if you really want to do that. Otherwise, a CP2012 or ftdi USB-toUART module such as this one works:
http://www.ebay.com/itm/Replace-FT232-6Pin-USB-2-0-to-TTL-UART-Module-Serial-Converter-CP2102-STC-/321546809495?pt=LH_DefaultDomain_0&hash=item4addaef097

A short tutorial for Ubuntu goes something like this:

1. Install toolchain
Code:
sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q2-1trusty1 git build-essential

2. Install stm32flash
Code:
git clone https://github.com/ARMinARM/stm32flash.git stm32flash
cd stm32flash
make
sudo make install

3. Connect the USB-to-UART module to the nunchuk PCB:
DTR is connected to the reset pin
RTS is connected to the boot0 pin
RX and TX are connected as usual (RX to TX and TX to RX).

4. Get and upload the firmware:
Code:
git clone https://github.com/vedderb/nunchuk_mod.git nunchuk_mod
cd nunchuk_mod
make upload

5. Done! If you'd like, open main.c and study/modify it. Then upload it again with
Code:
make upload
 
vedder said:
erwincoumans said:
I also have a USB dongle version of the nRF24L01+PA+LNA that works on Linux and Mac, so you can communicate to your VESC nRF24L01+. I use libusb to communicate with the USB transceiver. So you could use it also to wireless upload a new firmware and perhaps custom user-plugins for VESC. If you are interested in that, I can put the source code for this in a github repo.
Here is a link to the 'crazy radio long range': http://www.seeedstudio.com/depot/Crazyradio-PA-long-range-24Ghz-USB-radio-dongle-with-antenna-p-2104.html

It would be nice to have some code that uses libusb for that :)
OK, I uploaded the code here, I got it to work for Linux and Mac OSX: https://github.com/erwincoumans/usbCrazyRadio

The Linux or Mac PC will connect to a nRF24L01+ receiver on a specific pipe, and enables dynamic payloads and acknowledgements packages. For testing, it sends a few thousand packets and waits for the ack each time. It takes around 1ms for each package, roundtrip (2000 packages at 2sec).

How would a VESC app look like that has similar functionality to the following Arduino script?
https://github.com/erwincoumans/usbCrazyRadio/blob/master/arduino/crazyradio_pingping_with_ack.ino

In other words for a VESC with nRF24L01+

  • How to connect/solder the nRF24L01+ radio, pinout, and does it require modification to the original VESC 4.7?
  • How to select the pipe number, say const uint64_t pipe = 0xe7e7e7e7e7LL;
  • How to enable dynamic payload and acknowledgements?
  • How to implement bool radio.available(), radio.getDynamicPayloadSize, radio.read(..), radio.writeAckPayload(...)?

Once this would work on VESC, it would be much easier to start developing some remote controller (and doing the testing/development on Linux or Mac first).

Thanks for all the hard work!
Erwin
 
Sry but i don't get it :(
I bought 2 Arduino Nanos + 2 nRF24 + still have an old nunchuck from my wii times:)
But that was it, i have no idea how to wire them, and no idea how to upload the programs.
Would be awesome if someone could make a beginnerfriendly tutorial, how to set this up. Maybe some pics.
 
The wires between Arduino Nano and nRF24L01+ was in the first posting:
Code:
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

If you don't want to solder, you can get this shield for Arduino Nano + nRF24L01+ from Amazon for 10 dollar:
http://www.amazon.com/Arduino-Nano-I-O-Shield/dp/B00BD6KEYC

This shield is probably too bulky, but might help your testing (in case your soldering skills are not great).

Please download the Arduino IDE and follow the instructions from the Arduino websites how to upload a sketch.

At some stage I might write a beginner friendly tutorial. Until then, please ask more specific questions, where you get stuck exactly.
 
Hey,
Awesome work, so i ordered everything and got everything to work
couple of problems i ran into:
1. but the thing is too sensitive -
as i see it, it all starts with the stick it outputs 128 on neutral - then at about a third of the range 255 (which is the maximum it goes up to) and in the other direction reaches 0 also at a third of the range.
So how do i get it to use the entire range? how do i increase its range?
2. when going quickly from full throttle to full brake it seems to ignore my command
is there any way to treat this?

Thanks a lot,
A
 
guys i think that vedder was working unchanging the NRF24 chip input to not require any soldering and instead use the hall sensor input in stead of using the servo input and removing lowpass filters. I'm not completely sure but i think this has already been done.
VEDDER has some of my nunchuck pcbs in hand and is working on testing them and helping to him any problems. austin creator of the wiiceiver is going to be helping write code for the whichever to allow my PCB to communicate directly to the whichever with so it can be used with non VESC applications or for quicker VESC connectivity.

https://github.com/jacobbloy/BLDCAP...ogle.com/open?id=0Bym9XrdeViekVDRESlNPNzk2Z3c

i need the community help to connect a bluetooth module to the VESC and test that the current APK can connect search for bluetooth devices found in the settings tap of the APP and connect to the VESC bluetooth module.

the data that i need is:
You should pair devices and tell me the device type - it will be displayed something like "Service %TYPE%: %NAME%"
this is done all through the settings tab of the android APP.

Connecting bluetooth is easy and works with the same firmware as before without modifications. Just enable the UART app and connect a bluetooth-serial dongle (e.g. the rn-41 as found on the bluesmirf gold) to the rx and tx pins of the VESC. Something like this works to connect to it from ubuntu:
https://gist.github.com/xseignard/9367829
Then, in BLDC Tool, replace /dev/ttyACM0 with /dev/rfcomm0
 
razad7@gmail.com said:
Hey,
Awesome work, so i ordered everything and got everything to work
couple of problems i ran into:
1. but the thing is too sensitive -
as i see it, it all starts with the stick it outputs 128 on neutral - then at about a third of the range 255 (which is the maximum it goes up to) and in the other direction reaches 0 also at a third of the range.
So how do i get it to use the entire range? how do i increase its range?
2. when going quickly from full throttle to full brake it seems to ignore my command
is there any way to treat this?

Thanks a lot,
A
Are you using the Arduino script?

You could tweak the value on the receiver scipt, rangeServo (and if neutral is not centered, adjust neutralServo).
https://github.com/erwincoumans/ArduinoServoTxRx/blob/master/nrf24l01_receiver/nrf24l01_receiver.ino#L7


If that doesn't help, try to debug using serial printf. Another value to check is potValueA in the transmitter script:
https://github.com/erwincoumans/ArduinoServoTxRx/blob/master/nrf24l01_transmitter/nrf24l01_transmitter.ino#L70

Good luck!
Erwin
 
I finally got my arduino (clones) and after some frustrating hours (ch340 chip+win7=rage) i got one of them to do his work. I was able to upload the ''blink'' sketch. The other one is broken i think, it will not be shown under ''serial port'' but the power led is on :INano OK.JPG
or maybe it isn't broken and im just stupid, dunno..

With the intact one i wanted to build my transmitter, but wich sketch do i have to upload?
-beetle_transmit_kama_pot
-nrf24l01_transmitter
-''the nrf24 from the readme''
???only questionmarks in my head :shock:
 
http://kiguino.moos.io/2014/12/31/how-to-use-arduino-nano-mini-pro-with-CH340G-on-mac-osx-yosemite.html
try this for the undetected arduino. worked for me
 
I just saw that and almost everything google spits out. CH341 driver didn't work under win7 for me, shouldn't be necessary under linux (I also have no idea how to install specific driver under Linux). Minicom didn't help to. If i don't get this chip working, I'll maybe try the Wiiceiver method.
 
Nordel said:
I just saw that and almost everything google spits out. CH341 driver didn't work under win7 for me, shouldn't be necessary under linux (I also have no idea how to install specific driver under Linux). Minicom didn't help to. If i don't get this chip working, I'll maybe try the Wiiceiver method.

Nordel,

If i'm not mistaken one of my nanos use the CH341, i had to do a lot of digging but found a driver on the manufacturer website that worked on win7, i'ts been a long time and i don't remenber where exactly, just to let you know that it can work
 
I had that driver installed, didn't work for me.
Now I'm using Linux and everything worked, but only with one of both.
No matter.. my real problem is i don't know exactly what to upload :?:
 
Nordel said:
I had that driver installed, didn't work for me.
Now I'm using Linux and everything worked, but only with one of both.
No matter.. my real problem is i don't know exactly what to upload :?:

The github repository has Arduino Nano + nRF24L01+ scripts for the receiver Arduino, and the transmitter Arduino. You don't have a Beetle Bluetooth, so can can ignore those scripts, right?

For the transmitter Arduino Nano + nRF24L01+ upload this script: https://github.com/erwincoumans/ArduinoServoTxRx/tree/master/nrf24l01_transmitter
For the receiver Arduino Nano + nRF24L01+ upload this script: https://github.com/erwincoumans/ArduinoServoTxRx/tree/master/nrf24l01_receiver

Transmitter has a potentiometer pin on Analog 3
Receiver has the servo PWM pin on D3

The nRF24L01+ transceiver is connected to both transmitter (Tx) and Receiver (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

What part was confusing you?

Good luck!
 
Simple scripts for Arduino Nano with nRF24L01+ as transmitter and receiver for servo control.

The nRF24L01+ transceiver requires installing the RF24 library https://github.com/maniacbug/RF24 Hit the 'download' button, rename to RF24.zip and use Sketch/Import Library/Add Library and point to the RF24.zip file in the Arduino IDE

Also scripts for Bluno Beetle, Arduino Uno compatible transceiver with BLE Bluetooth

See also the discussion at http://endless-sphere.com/forums/viewtopic.php?f=35&t=70021


:?: I thought I would first have to upload something from link in the Readme. :?:

This method works better than https://endless-sphere.com/forums/viewtopic.php?f=35&t=57316?^^
 
Back
Top