SCRIPTING EBIKE PAS👨‍💻 IN VESC! 👏 👏 Detecting PAS Sensor via Script

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 มิ.ย. 2024
  • buymeacoffee.com/ebikebuilder My initial thoughts on scripting in VESC. i show a script i Have been working on for EBIKE PAS. It seems 🤔 possible to do PAS with a script! Follow along as i geek out scripting in VESC. It's not done yet, I talk about what I have learned so far. And i demonstrate the script detecting the PAS sensor.

ความคิดเห็น • 24

  • @roccitycyclecam
    @roccitycyclecam 9 วันที่ผ่านมา +1

    I have a Cycle Analyst with the JST connector. I ended up modding my Flipsky (I have a different model) and ran V+ and V- leads coming out of the Flipsky and crimped my own cabling so I could connect the CA to the Flipsky. This is important because the CA is designed to take all your input devices (throttle, PAS, e-brake) and interpolate those signals and send a corresponding voltage output meant to drive the throttle input on a controller. Basically, I configured my Flipsky to take a throttle input on ADC1 and wired my custom cabling so the throttle out signal from the CA is connected to ADC1. I'm abstracting a lot of software configuration that needs to be done on the CA and VESC in terms of throttle voltages, output signal voltage, ramp up/ramp down time, etc., but the point is that I have my throttle and PAS connected to my CA and that drives the ADC input.
    As someone who read/writes Python, it was a lot easier and more intuitive than writing all this custom scripting in Lisp. Don't let me discourage you though, this is an immense help to the community and gives you a bit more control like regen braking when pedaling backwards (and you should probably put the finished script on GitHub or something).

  • @briansmythe3000
    @briansmythe3000 12 วันที่ผ่านมา +1

    I tried Programming something once, It was on a Atarie 1064 😮 I kid you not
    Back in the Dark 🕶️ age's
    Well done Bro you will get it sorted

  • @davihazel3653
    @davihazel3653 11 วันที่ผ่านมา +1

    This is exciting 🙌

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา +1

      I’m stoked yeah programming can be pretty boring 🥱 but when its for making e-bikes better LET’S GO BOYS

  • @Bengy22
    @Bengy22 11 วันที่ผ่านมา +1

    Nice can't wait to see the test video on this. Maybe now that you have some experience you can make a script to hook up a nice display that works in the sun! And also for the bbshd you also could figure out how to implement a wheel speed sensor so you can keep the gears and have a accurate speedo

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      I was thunkin bout figuring out how to communicate with those bafang displays. I think you could have the vesc script sending the speed and pas level and different commands to the display, idk if its uart or how it works but there’s probably some way to hook vesc up to a normal bafang display . Good ideas 💡 bengy!! yeah the bbshd could use a script of its own. I bet i could totally smooth out the bbshd start, get it to electronically figure out when the drive train engages 😎. And yeah wheel speed sensor!! Not sure if i could override that speedo in the vesc tool from my script, or where else i could display the speed to the user: but yeah i think there’s w lot of ebike displays like eggrider 500C etc that al kind of use the same uart protocol or whatevrr . Maybe that’s possible to just script commands to the bafang display and use a 500C

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      Nother thing is i think you could write ✍️ a script to get rid of ghost pedaling, that would power the motor based on your crank rpm , but in a smart way. Assuming you are actually pedaling and just want to be able to pedal and ride it normally. but when you get to that ghost pedal crank spinout rpm AND that vehicle speed where it becomes impossible to pedal, and it could ease off on the pas power so it doesn’t feel like your ghosting out. you can do stuff like that with a script. Reading inputs and running some logic

    • @Bengy22
      @Bengy22 11 วันที่ผ่านมา

      @@EBikeBuilder_ I'm not sure exactly how but Luna figured out the bafang display and speed sensor for their controller so it can be done. Maybe read the github that Marcos posted as I believe it has some code in it that could help you understand how he converted the bafang uart display to play nicely with vesc. Really cool you are doing this for the community as I'm sure it will help a lot of people out. Not a whole lot of good info that is also easy to find on this stuff. And that script sound really cool!

  • @rufusirvin5279
    @rufusirvin5279 11 วันที่ผ่านมา +1

    Ya it is cool. Backpedal Regen would be good for city pavement but would not work offroad as you're always backpedaling to avoid boulders and stumps. If I had a pavement bike I would choose backpedaling. I learned visual basic scripting for networking years ago, so will look into LISP. So how will you implement variable Regen?

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      I can make a flag to disable regen or wat Not. Maybe there could be a minimum backwards crank rotation % setting to control how much you have to back pedal to do it. But i think Justin said something like the pedaling backwards nonstop is goofy 😜 so i don’t want to have to continue pedaling backwards to hold regen active. Maybe just peda backwards x % to start regen? So when you are pedaling normally its not an issue. And the transition from pedaling to regen would kind of ease on. Then maybe after regen kicks in ; you can backpedal to increase the intensity of the Regen. But not have to continue back pedaling constantly. So just like after regen starts, maybe you have half a crank rotation or a full crank rotation where you can rotate the cranks back to increase regen. then soon as you start pedaling forward it should ease off the Regen pretty quick

  • @NoInfoFound
    @NoInfoFound 12 วันที่ผ่านมา +1

    Thanks for trying out the VESC/flipsky scripting. I may give it a go for a optimized cruise control function.

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      What’s the expected behavior of cruise control? And how does it currently work? Maybe there’s a way to hook into it with scripting. I haven’t tried it yet, do you use a button? I will see if scripting has access to cc

    • @NoInfoFound
      @NoInfoFound 11 วันที่ผ่านมา +1

      @@EBikeBuilder_ I believe the current flipsky default (6.02) is a simple button to turn it on. I don't believe it has a cancel on e-brake switch or throttle change function built in yet.

    • @camerontechstuffs
      @camerontechstuffs 11 วันที่ผ่านมา +2

      @@NoInfoFound Cruise on default firmware uses a toggle switch, and will hold whatever speed you are going at. E-brake pauses cruise and it auto resumes at the new (slower) speed. Throttle also pauses cruise and auto resumes at the new (higher) speed. It doesn't cancel until you toggle the switch back off though so its somewhat of a learning curve.

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      @@camerontechstuffsthanks for explaining how it currently works, that’s helpful, it sound’s different than i would expect like in a car. But it sounds like having some way to adjust the cruise speed could be useful. I’m just used to cruise control in cars Not bikes. I’ll have to think more about it

    • @ChrisOlin
      @ChrisOlin 11 วันที่ผ่านมา +1

      My immediate thought is trying to implement some sort of virtual freewheeling

  • @BrettWoodBiking
    @BrettWoodBiking 12 วันที่ผ่านมา +2

    I understand being able to read on the receive pin (rx) , But I got lost when you said in the script you can read on the transmit pin (tx)
    If it's possible, I would have it start regen on back pedal and continue even if backpedaling has stopped... until forward is detected. Like an old timey coaster brake.
    Either way, you're way over my head on this but I still watch. I find it interesting. If it works, it works right? 👍

    • @NoInfoFound
      @NoInfoFound 12 วันที่ผ่านมา +1

      I suspect that the 'pins' are actually connected to general purpose input and output pins on the controller. So even though it is labeled 'tx' (transmit), it can actually receive or transmit depending on what the program actually chooses to use the pin for.

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา +2

      I’m lost too 😂 idk what rx and to even mean. Or why they are the default pas wiring in Vesc. But that’s where I have my PAS sensor wired 😂 I get lost too quite frequently especially when scripting Vesc. 😅 don’t know what im doing but some how it’s working

    • @BrettWoodBiking
      @BrettWoodBiking 11 วันที่ผ่านมา +3

      @@EBikeBuilder_ hey, it's working right? Go with the flow

    • @patrickoneill1011
      @patrickoneill1011 11 วันที่ผ่านมา +1

      Rx = Receive Signal
      Tx = Transmit Signal

    • @EBikeBuilder_
      @EBikeBuilder_  11 วันที่ผ่านมา

      @@patrickoneill1011i think usually rx or tx gets wired to the display, i saw that in one of the two flipsky wiring diagrams where they show the TFT screen wiring diagram. So this PAS wiring scheme might conflict with how other things are wired in vesc, but that’s how they had it set up in the VESC pas so i still have my wires going to rx and tx. But you can wire the PAS to any GPIO pin you want on the VESC and then change the script to read the PAS signal from those other pins . So where things are wired can be changed. But its a matter of figuring out where everything gets wired by convention and is already in use by other things like your display. And then using those available gpio pins for the PAS ans other stuff you want to add