VESC+hc-05+Arduino nano remote

General topics and discussions about the VESC and its development.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
joedusta
Posts: 8
Joined: 02 Aug 2016, 22:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

VESC+hc-05+Arduino nano remote

Postby joedusta » 02 Aug 2016, 23:23

Hi,
I'm using the VescUart example code to communicate with the VESC through linked bluetooth modems (HC05->HC-06)
https://github.com/erwincoumans/Arduino ... r/VescUart

I cant seem to get the remote (bt with arduino nano) to work with the VESC, I have built up the level of solutions trying to figure out whats going on, I tried:
-Arduino nano directly into the UART with HardwareSerial (Works)
-Arduino nano directly into the UART with SoftwareSerial (Works)
-Bluetooth radios are paired and communicate fine (tested over serial terminal)
-Remote wirelessly transmitting to an arduino Nano connected via serial to the VESC (works)

When I connect the bluetooth receiver directly to the VESC and monitor what it is receiving with a Arduino I get a legit packet (02 05 08 00 00 09 C4 21 7D 03) . Interestingly when I disconnect the TX (VESC) from the above working examples it doesn't work. Please help me get past this frustrating problem.

pf26
Posts: 310
Joined: 28 Mar 2016, 14:37
Location: FR Valence
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby pf26 » 03 Aug 2016, 10:20

Did you configure your HC05 / HC06 for 115200 bds ? (AT+BAUD8 command)
You could try to use BLDC tools on a computer with BT, and HC06 connected to the UART of the VESC. Check the received frames (at 115200), and also the returned frames (on Tx). Double check the Tx Rx pinouts, there may be confusions (which pins outputs the data to where)?
And some pins might require pullups.

joedusta
Posts: 8
Joined: 02 Aug 2016, 22:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby joedusta » 03 Aug 2016, 19:43

How do I check the received frames (at 115200), and the returned frames (on Tx) with BLDC tools? Is it through the terminal tab? I Just used a 3dr telemetry radio pair and it works wirelessly. So it is definitely something with the bluetooth radios. Is a stop bit or parity but needed?

Hmm interesting development, I thought when I was monitoring the VESC input i was getting a legit input, turns out not, it should be 02 05 08 00 00 03 E8 2B 58 03 instead of 02 05 08 00 00 09 C4 21 7D 03. This is where things get weird, I hook up the bt modules to two arduino's and manually send the right packet through serial, the other one receives it fine through the software serial and pumping it out thought hardware serial. I have checked the pinouts a million times (hence all the working solutions) and tried pullups.

More testing has revealed that on start up of the VESC when the bluetooth pairs with the controller it runs the first command, that is if the command is vesc.SetRpm(2500); it will execute it for about 2 seconds. Very strange:(

Its really annoying that this forum doesn't allow me to delete the double posts that i accidentally posted, so sorry about that
Last edited by joedusta on 04 Aug 2016, 01:03, edited 2 times in total.

joedusta
Posts: 8
Joined: 02 Aug 2016, 22:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby joedusta » 03 Aug 2016, 22:15

+
Last edited by joedusta on 04 Aug 2016, 01:03, edited 3 times in total.

joedusta
Posts: 8
Joined: 02 Aug 2016, 22:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby joedusta » 04 Aug 2016, 00:12

+

pf26
Posts: 310
Joined: 28 Mar 2016, 14:37
Location: FR Valence
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby pf26 » 05 Aug 2016, 08:45

If you want to test properly, you need to use both BLDCtools to send requests and a separate terminal software (hterm.exe?) an another serial port with TTL levels to catch the Rx and Tx. You can also use portmon.exe on window to see the sent and received frames on the BLDCTools serial port.
Most likely, the 2 frames you are talking about are correct (different frames are sent by BLDC tools permanently)

I think there is a little flaw in the serial com protocol in use with BLDCtools, which makes it difficult to resume receiving frames after some loss of data in a single received frame : this is due to the serial protocol used: if a paquet is corrupted, bldc-tools will wait for a start byte (value 0x02 or 0x03). But there is always a 0x03 at the end of a packet, so this will be assumed to be a new packet start, and the next byte is paket length MSB, it will be 0x2 (the next coming packet start), which corresponds to a long but acceptable packet.
It might take some time before the synchonization is found again especially when there is a lot of traffic (i.e. if you enabled STATUS sending by the VESC). Otherwise a timeout cancels the packet beeing received and waits for a real new one, I think if no byte arrives within 500ms, this may be too long.

joedusta
Posts: 8
Joined: 02 Aug 2016, 22:09
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby joedusta » 07 Aug 2016, 09:42

I've gone into terminal (in BLDCTool) and typed "help", a list of commands has been offered. I dont see any command relating to monitoring the UART or otherwise. I then went to a terminal program (coolterm) and connected to the VESC com port, nothing. Am i missing something? I agree with your packet lost idea, now i need to figure out what the VESC is seeing of the packet and maybe could reverse hack on the nano side to accommodate for dropped packets.

MikeLemon
Posts: 7
Joined: 29 Apr 2017, 22:58
Location: none
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: VESC+hc-05+Arduino nano remote

Postby MikeLemon » 29 Apr 2017, 23:02

Hi there,

How did you set UART TO software serial uart? when I include the library and go to set it to he desired uart it gives me some errors.
I also want to use two software serials for that because I want to control another vesc because it seems like the CAN bus IC keeps failing.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests