You are here

Flipsky 75200 V2 Pro + Flipsky Display V2.0 E-Moped with ADC15 pin use

2 posts / 0 new
Last post
Aleksander Zajc
Offline
Last seen: 2 days 23 hours ago
VESC Free
Joined: 2026-06-15 14:27
Posts: 2
Flipsky 75200 V2 Pro + Flipsky Display V2.0 E-Moped with ADC15 pin use

I want to show some example what i couldn't find and what worked for me. Firmware is 75_300 R3 no hardwire limits version. Use case is Ebike moped, ADC and UART, etc.

Using toggle (not momentary) external switch between 3.3v and ADC15 pin. And coding have been done with AI.

 

Example 1 switch sets max duty cycle

 

; Background thread monitoring ADC15 or auxiliary pin logic
(loopwhile-thd 100 t {
   (def adc15-val (get-adc 2)) ; Adjust channel index or use gpio-read depending on map
   (if (> adc15-val 2.5)
      { (conf-set 'l-max-duty 0.10) }  ; ON
      { (conf-set 'l-max-duty 0.94) }  ; OFF
   )
   (sleep 0.1)
})
 

Example 2 switch sets current usage of duty cycle as max duty cycle

 

;; -1 means an undefined switch state at controller startup
(define switch_active -1)

;; Starting a background thread with a unique thread ID of 100
(loopwhile-thd 100 t
  (progn
    ;; Reading voltage on physical pin ADC15 (Channel 2 in VESC)
    (define adc15-val (get-adc 2))

    ;; ON STATE: If the voltage is above 2.5 V and the switch is not yet activated
    (if (and (> adc15-val 2.5) (!= switch_active 1))
      (progn
        ;; 1. Read the current actual duty cycle value
        (define live_duty (get-duty))
        
        ;; 2. Set this read value as the new maximum limit
        (conf-set 'l-max-duty live_duty)
        
        ;; 3. Lock the switch state to ACTIVE
        (setq switch_active 1)
        
        ;; Output to Lisp console for performance control
        (print (list "Switch ON: l-max-duty locked to: " live_duty))
      )
    )

    ;; OFF STATE: If the voltage is below 2.5 V and the switch is not yet turned off
    (if (and (<= adc15-val 2.5) (!= switch_active 0))
      (progn
        ;; 1. Reset maximum duty cycle back to default 94.0%
        (conf-set 'l-max-duty 0.94)
        
        ;; 2. Lock the switch state to INACTIVE
        (setq switch_active 0)
        
        ;; Output to Lisp console
        (print "Switch OFF: l-max-duty reset to 94%")
      )
    )

    ;; 100 milliseconds (0.1 second) pause between samples
    (sleep 0.1)
  )
)
 

Next time ill explore Flipsky display pas gears bytes (when ill have more time) to utilize for ADC1 or throttle (in other words) with duty cycles (or max moped speed sets)

Aleksander Zajc
Offline
Last seen: 2 days 23 hours ago
VESC Free
Joined: 2026-06-15 14:27
Posts: 2

meanwhile, i would like to mention about regen for emopeds;

settings Battery Current Max Regen is usually as your charger provides (in my case 72v 45ah is charged at 84v 10amp. So in this case -10.00 A) and you know what happens is BMS fails and opens the door, or reject on to high spikes.

settings MotorCurrent Max Brakes is usually as your generator capable to deliver to much amps for your e moped battery and it also heating on this job. Its related as the Motor Current Max effect does, how soft or aggressive bite. Best amp setting are motor rated or the middle ones Watt / Volts = -__.00 A (in my case 5000w motor / 72v = (-)69.444A and that is ok but ill go rather with smoother introduction value -50A  regardless what value above plays in settings Motor Current Max, usually a lot like 100A and up)