By draculauto - Wed Jan 22, 2020 11:15 am
- Wed Jan 22, 2020 11:15 am
#19323
An Electric Scooter Community on a Mission to Stamp out Transportation Mediocrity.
Pata27 wrote: ↑Thu Jan 23, 2020 1:06 pmHi all,
I'm working on a more functions friendly code for ours arduino nano's.
I will send it once it will be tested by some friend of mine to avoid bugs.
It will give you the ability to use a switch or a capacitive sensor to turn on/off the headlight.
Detect powerloss to lock it directly other than waiting 20sec of timeout.
And the possibility to use a speaker.
All those functions are gonna be 'options' so you will have the possiblity to turn them on or off as you want with some variables in the code.
I will work in the future in an implementation of some NFC to unlock the scooter.
If you want some more functions, just reply to this message saying what you want to be available in the code.
Could be somthing like two speed modes or anything else, if you had some ideas i be glad to implement them in the code.
@BiingobomBiingobom wrote: ↑Thu Jan 23, 2020 3:11 pmI can now switch my ES200G on and off with my mobile phone via Bluetooth. I use an Arduino Nano (consumption approx. 25 mA), a Bluetooth module HC-05 (consumption approx. 5 mA) and a LM2596S Step-Down Converter with a Z-Diode (15V, 3W) to first reduce the 42V from the scooter to below 30V and then to reduce it with the LM2596S to 5V for the Arduino. This works great and I need neither an additional power source (powerbank) nor a visible switch to turn my scooter on. The arduino is always on and takes approx. 30mA together with the bluetooth module. This should be okay because the scooters battery capacity (12800 mAh) could run my arduino for 426 hours without charging. Okay for me and no one can pair up and drive my scooter without my Bluetooth PIN.
Now I would like to have not only a switch for on and off in my RemoteX-Scooter-App. I would also like to see how full the scooter's battery is as soon as I am paired via Bluetooth and also be able to switch the lights on and off. Does anyone have an idea how to read the current battery status from the controller (BMS) with the Arduino?
/*
-- New project --
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.4.3 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.3.1 or later version;
- for iOS 1.3.5 or later version;
This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
*/
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP32CORE_BLE
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_BLUETOOTH_NAME "My_Scooter" // The name you see the Scooter in the RemoteXY app
#define REMOTEXY_ACCESS_PASSWORD "password" // Put here the password to access the Scooter
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,2,0,0,0,49,0,8,8,1,
2,0,17,20,33,13,4,26,31,31,
79,78,0,79,70,70,0,129,0,37,
53,12,6,16,70,97,115,116,0,2,
0,10,50,22,11,1,26,31,31,79,
78,0,79,70,70,0 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t switch_1; // =1 if switch ON and =0 if OFF
uint8_t speed_switch; // =1 if switch ON and =0 if OFF
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#include <Arduino.h>
////////////////////////////////////////////
// Scooter Command include //
///////////////////////////////////////////
byte slow[] = {0xA6, 0x12, 0x02, 0x65, 0x14, 0x86}; // Speed Limit to 20 km/h
byte fast[] = {0xA6, 0x12, 0x02, 0x35, 0xFF, 0x38}; // Maximum Speed
byte off[] = {0xA6, 0x12, 0x02, 0x00, 0xFF, 0xEA};
void setup()
{
RemoteXY_Init ();
Serial.begin(9600);
}
void loop()
{
RemoteXY_Handler ();
if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 0))
{
Serial.write(slow, sizeof(slow));
}
else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 1))
{
Serial.write(fast, sizeof(fast));
}
else
{
Serial.write(off, sizeof(off));
}
delay(200);
}
Hi all,mayaku wrote: ↑Fri Jan 24, 2020 1:07 amHi all ^^
I tried to get the ES200 unlock code from git running but the scooter never powered up.
https://github.com/chappy1978/ES200-Sco ... tree/Final
Then i decided to copy my solution for a Nano V3 with one button (http://www.mathertel.de/Arduino/OneButtonLibrary.aspx) because the output on the serial monitor for the ESP32 never was the same as with my working Nano V3.
The code is very simple but convirmed working for an ES100D from Voi and an ESP32
Code: Select all/* -- New project -- This source code of graphical user interface has been generated automatically by RemoteXY editor. To compile this code using RemoteXY library 2.4.3 or later version download by link http://remotexy.com/en/library/ To connect using RemoteXY mobile app by link http://remotexy.com/en/download/ - for ANDROID 4.3.1 or later version; - for iOS 1.3.5 or later version; This source code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. */ ////////////////////////////////////////////// // RemoteXY include library // ////////////////////////////////////////////// // RemoteXY select connection mode and include library #define REMOTEXY_MODE__ESP32CORE_BLE #include <RemoteXY.h> // RemoteXY connection settings #define REMOTEXY_BLUETOOTH_NAME "My_Scooter" // The name you see the Scooter in the RemoteXY app #define REMOTEXY_ACCESS_PASSWORD "password" // Put here the password to access the Scooter // RemoteXY configurate #pragma pack(push, 1) uint8_t RemoteXY_CONF[] = { 255,2,0,0,0,49,0,8,8,1, 2,0,17,20,33,13,4,26,31,31, 79,78,0,79,70,70,0,129,0,37, 53,12,6,16,70,97,115,116,0,2, 0,10,50,22,11,1,26,31,31,79, 78,0,79,70,70,0 }; // this structure defines all the variables of your control interface struct { // input variable uint8_t switch_1; // =1 if switch ON and =0 if OFF uint8_t speed_switch; // =1 if switch ON and =0 if OFF // other variable uint8_t connect_flag; // =1 if wire connected, else =0 } RemoteXY; #pragma pack(pop) ///////////////////////////////////////////// // END RemoteXY include // ///////////////////////////////////////////// #include <Arduino.h> //////////////////////////////////////////// // Scooter Command include // /////////////////////////////////////////// byte slow[] = {0xA6, 0x12, 0x02, 0x65, 0x14, 0x86}; // Speed Limit to 20 km/h byte fast[] = {0xA6, 0x12, 0x02, 0x35, 0xFF, 0x38}; // Maximum Speed byte off[] = {0xA6, 0x12, 0x02, 0x00, 0xFF, 0xEA}; void setup() { RemoteXY_Init (); Serial.begin(9600); } void loop() { RemoteXY_Handler (); if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 0)) { Serial.write(slow, sizeof(slow)); } else if((RemoteXY.switch_1 == 1) && (RemoteXY.speed_switch == 1)) { Serial.write(fast, sizeof(fast)); } else { Serial.write(off, sizeof(off)); } delay(200); }
The delay at the end is necessary because otherwise the serial output is written too fast and the scooter won't start
Very important is the baud rate 9600, didn't get it working with an other ^^
Here are the setting for the Arduino IDE:
The wiring is the same as for the Nano V3.
I hope somebody can use this or even better improove it