An Electric Scooter Community on a Mission to Stamp out Transportation Mediocrity.

Covers electric scooter models whether shared or for consumers.
By PDruppo
#58262
alecxs wrote:
Sun Nov 19, 2023 5:14 pm
PDruppo wrote:
Sun Nov 19, 2023 1:19 pm
Hi, just ordered the PCBs. Tried Emile's version below, but somehow didn't work. I hope this will... any way to chat with you in case of additional questions? the thread doesn't seem too active anymore.
Not sure what you mean with "below" but the code by A-Emile works just fine to me. Maybe your phone does not support Bluetooth BLE?

you must flash the BLDC motor controller.
Yeah, I initially omitted that flashing step, who knows why! :o
I just got the PCBs yesterday, but have been struggling with flashing for a while.
I tried with both the scooter charger connected and without it. Same result.
1) opened the controller, soldered in the 4 pins near SM32 (they weren't there in my case - I can only assume they're soldered well and there's connectivity with the controller board.
2) I bought the st-link v2 USB dongle and connected all 4 pins according to instructions.
3) when I'm trying to read I'm getting the error: Cannot communicate with the device! Check the SWD cable connection and check all the needed pin connections on the SWD connector. Reboot the ST-Link with USD cable.
Error: < PROGRAM MEMORY reading failed.

Following Emile's advice and I think one mentioned here, when I'm jumper wiring the SM 7 pin with the other's Stlink GND it starts thinking for a while and gives me 'ST-link error', when I removed it shortly after clicking the read button, it shows 'the device is protected'. I tried like 20 times as least over and over again.. any tips and tricks?
I guess there's a chance the st-link v2 (although new) could be just bad, but other than this? Please help!!
I have pictures and videos I can share
User avatar
By alecxs
#58263
Not necessary to solder reset pin. in ST Link Utility select the connect under reset option, maybe reduce speed to 4 MHz. If the controller is completely powered off it will work, just connect the ST Link and click connect right after. no charger, no battery. Try few times.

if it shows the device is protected, the connection is ready for next step. now disable readout protection in option bytes to erase the flash. then you can flash the hex file.
By PDruppo
#58264
Thanks Alecxs, appreciate the support... so...
If by soldering the reset pin you mean the additional GND jumper, I wasn't soldering it. I just needed to solder 4 main pins to the board. It only had 4 holes in it.
Until now I have tried using the ST Visual Programmer, as per Emile's instructions, but after your advice, I moved the normal ST-link utility, updated firmware, connected under reset, disabled protection and flashed it... and it seems to have worked :mrgreen: I just don't have the original backup now. Didn't know how to do it. I will try now to install your board and connect everything, before putting the scooter together, just in case.
Does this looks like the expected outcome? link: Image
User avatar
By alecxs
#58265
right, should already work now even without the green box. at least for two minutes.

Now solder the DC-DC converter and adjust it to +5V before you solder the ESP32. for the pcb required assembly is the LOCK resistor. any value should be fine, you can also bridge it with wire. the TX + RX solder jumpers next to the connector must be closed, and the display jumper to power the display. depending on the ESP32 you maybe have to close more solder jumpers (not for the 38-pin) which ESP32 Dev Kit do you have?

all the other assembly is optional.
By PDruppo
#58266
alecxs wrote:right, should already work now even without the green box. at least for two minutes.

Now solder the DC-DC converter and adjust it to +5V before you solder the ESP32. for the pcb required assembly is the LOCK resistor. any value should be fine, you can also bridge it with wire. the TX + RX solder jumpers next to the connector must be closed, and the display jumper to power the display. depending on the ESP32 you maybe have to close more solder jumpers (not for the 38-pin) which ESP32 Dev Kit do you have?

all the other assembly is optional.
bummer... I've assembled everything and intended to launch it without your PCB first (as I know I got the screen to work and even unlock it with the phone app, but just couldn't get the battery signal or the drive control). Now, when I connected everything, I don't have the 5V and neither the ESP not the screen light up. Checked everything and it seems light the chinese converter must have broken down, as I couldn't get it to work : beyond 3V. So I changed the converter and inadvertandily put it once, the battery was charging. The GND cable before the converter fried ;( and now, I'm not getting any current up the handle bar. Something else must have fried in between (either a cable in the vertical steering bar or something in the converter. Went from bad to worse. Not really sure if there's anything I can try right now, a part from exchanging all the cables going up and hoping these were only the cables and not the controller...

EDIT: I managed to exchange part of the cable. It's good, but I have 41V now (at peaks it was showing me even 50V) - shouldn't it be rather closer to 38V? maybe that's why the cable fried in the first place when the DC-DC converter couldn't handle it? Can you direct me to the recommended DC converter?
Going to try this one, this time (up to 2A/10W output): https://www.amazon.com/GYVRM-K480502-Mo ... F8U7Q5SX2F
Last edited by PDruppo on Sat Dec 02, 2023 3:01 pm, edited 2 times in total.
User avatar
By alecxs
#58267
42V is fine, that is a normal voltage for fully charged battery. the long cable in the vertical steering rod is not protected against abrasion and can cause short circuits. the cable insulation wears through over time during steering movements - design flaw.

link to DC-DC converter is here. Only MP4560 or LM2596HVS is compatible with pcb board. the total costs off fully assembled pcb (in homework of course) including ESP32 is at $ 10 bucks per unit (1/5)
By PDruppo
#58269
ok, will order the the LM2596HVS and hope for the best.
One more question for now. You mention optional versions with power saving mode and/or deep sleep mode. However, what I did was add an additional simple witch on the VCC leading to the ESP power supply. This turns off the screen and the ESP32. Wouldn't that work? I was planning to turn it into a key switch, wouldn't that work? or are the deep sleep / power saving also meant to interact with the controller or the motor?
User avatar
By alecxs
#58270
That's your decision. I don't have a switch or anything else that differs from original. It is unlocked with the app, that's it. If you opt for power saving option you need something to wake up. I use the tilt sensor, scooter wakes up when I move it.
By Hans-wurst
#58333
alecxs wrote:
Sun Dec 03, 2023 9:02 am
It is unlocked with the app, that's it.
Hi Alexcs, ich habe ein bisschen bis dem ESP rumgespielt und auch die main-Version von Emile zum Laufen gebracht. Nun wollte ich gerne auch noch einmal deine Erweiterungen ausprobieren aber leider bekomme ich deinen Code nicht zum Laufen. Das Problem scheint bei der BT- Kopplung aufzutreten. Der Esp läuft und kommuniziert auch korrekt, doch sobald man versuch mit der App darauf zuzugreifen scheint es als ob sich der ESP resettet. Zuerst kommt noch der start-sound und dann der reset. Ich bekomme keine Kopplung hin. Ich habe die letzte Code-Version von dir (themed) verwendet. Im Quellcode ist in der BLE-Security.ino eigentlich kein Unterschied zu der Main-Version (die ja bei mir läuft). Nun kenne ich mich mit Coden leider fast gar nicht aus. Ich verwende eine alte IDE Version (arduino 1.8.19) und habe auch die littleFS bibliothek und die ESP8266audio installiert. Muss ich bei den boards dann auch ein ESP8266 board auswählen oder ganz normal meinen ESP32wroom? Hast du eine Idee, woran es liegen könnte?
By Hans-wurst
#58339
Hi Alexcs,
the main Version from Emile ist running correctly but O am not able to get your version to Work. I programmed your Last Version "themed" and installed all bibliotheks, but every time i try to connect the App, IT seems Like the esp Crash or will be reset. Have you any Idea what i can do?
  • 1
  • 19
  • 20
  • 21
  • 22
  • 23

https://pic.clubic.com/9cc14c4c1797064/1200x750/sm[…]

Below is the link with some information about ca[…]

@pawel1201 great work, Two questions 1. How can […]

New Lime Gen4 (V2) - Okai ES400A

looks good. on - minus tab of battery, solder th[…]