Jump to content
jayjay23

Firmware

Recommended Posts

Ok, found it (here: https://www.mikrocontroller.net/topic/304369)

We have libgcc included since the very beginning and I recently added libm (for math stuff, like trigonometric functions), those libs

should be taken from /thumb directory, it just didn't caused problems yet as we seem to not use anything from libgcc.

  • Upvote 1

Share this post


Link to post
Share on other sites

I'm just checking this: http://electronics.stackexchange.com/questions/149387/how-do-i-print-debug-messages-to-gdb-console-with-stm32-discovery-board-using-gd

In the hope I can get a faster debug output that also doesn't interrupt program flow, as stopping with a breakpoint while I2C transfer is at some 'waiting for the MPU' state, and that state arrives during breakpoint (of course the MPU is not halted :-)) the state may go away and will never be reached again as the flow is broken.

With above code I already can transfer characters from the running chip to OpenOCD (but it's also horrible slow, at least the flow is not broken).

  • Upvote 1

Share this post


Link to post
Share on other sites

@jayjay23 I am thinking on Bluetooh. Using an Arduino with Bluetooth - just connecting 3 pins to the board: gnd, vcc 3v3 and PS Signal. All this pins are available on headers on the board.

The communications could be kind of slow (I am thinking on 10ms per byte) but to/from both sides and with Bluetooth :-)

This could also open up the app possibility :-)

Edited by electric_vehicle_lover

Share this post


Link to post
Share on other sites

For later this is fine, search for HC-05, this is a ready all in one bt module for just a few euros and all you need to do is connect power and serial Rx/Tx.

This is what I've seen in another bluetooth wheel (china).

Share this post


Link to post
Share on other sites

I have a question, with the balancing code does it need detailed information from the motor control section? Or is the balancing function removed from the BLDC functions?

For example if you had one MCU for the gyro and unicycle functions, and another purely for BLDC tasks would you only need to send throttle, break and reverse commands to the BLDC section, with the primary MCU using the gyro + rpm data from the BLDC mcu to balance the unit?

Or does the balancing function require tight integration and rely on current sensing data from each phase etc. 

Share this post


Link to post
Share on other sites

@lizardmech: Simple DIY projects I've seen that already work, only use the angle as input and a motor control value (not further egulated) as output,

if angle is not achieved the output is adjusted accordingly. More advanced algorithms, that should result in more stability under different environmental parameters

use a speed (rpm) and/or torque (voltage/ampere) feedback that is also PID regulated. In which case there is a back channel, but with common parameters, so from design point of view these parameters if normalized could be passed through a well defined interface and if a motor driver does not support it you could in worst case rely again on just a undefined motor control value and a simple algorithm with just one PID loop.

  • Upvote 1

Share this post


Link to post
Share on other sites
On ‎12‎/‎18‎/‎2015 at 3:29 PM, electric_vehicle_lover said:

That's why OpenSource is so important!! -- on my development, I saw my board making smoke, literally and I were able to quick turn off thanks the power supply. One mosfet were in short-circuit. But also the circuit were in a short circuit even if the new mosfet were ok. After about 2h I found that R33 (from the next image) were burned and open circuit.

r33_burned.png.3bf6d7e358aac8456f0c80676


Using the osciloscope to compare the signals I could understand the gate of mosfet were at 2V while it should be at about 15V. I do not have the schematic for this controller but I followed the schematic from KU63 controller of electric bicycles and it seems to be equal :-) -- cheap chinese controlers ;-)

KU63 schematic is here as "OpenSource" from another user (Albert van Dalen) <3 !! http://www.avdweb.nl/Article_files/Solarbike/Motor-controller/China-BLDC-motor-controller-36V-250W.pdf
OpenSource is really important for us to be able to repair our own devices!! And I am learning a lot!! <3
http://www.avdweb.nl/solar-bike/electronics/ku63-motor-controller.html

I am not familiar with this Mosfet as I have been retired from Electronics Engineering for many decades, but if the Q18 gate is active HIGH for turn-off, try using a ~220nf  "Speed-Up"  Capacitor across R33 to sweep out the C19 'Turn-On' charge for faster turn-off.

Share this post


Link to post
Share on other sites

I have yet another (stupid? :P) question: How do you determine the correct commutation sequence for a motor? Simple trial & error or is there some more sophisticated way? I have made a fairly simple BLDC-controller using the e-bike schematic, and after some guesswork, got it to work with low-frequency (0.5-1Khz) PWM:  http://forum.electricunicycle.org/topic/2193-headache/#comment-25425

Now, the problem I'm currently facing is the jerkiness of the motor... I think I might have some parts of the commutation sequence wrong, but is there another way to find out the correct sequence than trial and error?

Share this post


Link to post
Share on other sites

I were looking at possible delays on the circuit for the mosfets. I took the delay time because the will be needed for the bipolar PWM dead times. For what I read until now, we will need bipolar PWM to have break/regen.

Please see here the oscilloscope images: https://github.com/generic-electric-unicycle/documentation/wiki/MicroWorks-18km-h-controller-board

Share this post


Link to post
Share on other sites
16 minutes ago, electric_vehicle_lover said:

@esaj why don't you join us? -- you can buy for cheap the full complete working boards and motor/unicycle. We are gathering a lot of detailed information about the motor and all the components of cheap generic EUC!!

Thanks for the invite, not sure how much of use I'd be though, as I have no experience with the ARM-architecture/toolchain, nor do I have any decent electronics tools (no bench power supply, no oscilloscope... just a cheap multimeter and batteries ;)). Although I do mean to get those some time, so maybe I'll join you later on.

  • Upvote 1

Share this post


Link to post
Share on other sites

You know, we will need an Android app to control the firmware/system :-)
I guess that later we will adopt the MicroWorks 30km/h (MCM4 board and KingSong 14??) due to the bluetooth and possible improvement of generics to the 30km/h. Would be great if you could help on the Android app -- maybe we could even adopt the same protocol of original Gotway/KingSong and extend it for our custom commands, this way we would be compatible :-)

Edited by electric_vehicle_lover
  • Upvote 1

Share this post


Link to post
Share on other sites
25 minutes ago, electric_vehicle_lover said:

You know, we will need an Android app to control the firmware/system :-)
I guess that later we will adopt the MicroWorks 30km/h (MCM4 board and KingSong 14??) due to the bluetooth and possible improvement of generics to the 30km/h. Would be great if you could help on the Android app -- maybe we could even adopt the same protocol of original Gotway/KingSong and extend it for our custom commands, this way we would be compatible :-)

That would work, alternatively if you want to use a different protocol, it's fairly easy to extend the protocol system of current Wheelemetrics... the architecture already has "autodetection"-feature (it actually handles King Song and Gotway protocols a bit differently, as KS protocol doesn't send the correct odometer-value).

Share this post


Link to post
Share on other sites
4 minutes ago, electric_vehicle_lover said:

In terms of the app, Gotway and KingSong are really different or they share many things? -- if they share, could they be done by the same development team?

The protocol is nearly identical, near enough that their own apps probably work between each other (for the models using SPP-profile, probably not for the newer models using Bluetooth LE)... there're very slight differences in the data headers, and their apps work interchangeably, because they don't check those at all, unlike I did :P. Also, the KS data doesn't contain the odometer-value at all, so you'd probably see "funny" numbers with the Gotway app (or nothing at all). The commands themselves are simply ascii-characters sent to the wheel.

Share this post


Link to post
Share on other sites

I see that boards have almost similar schematics, the firmwares are also maybe similar on some EUCs and so the app. Maybe Gotway and KingSong buy the development from another company that does all the development and so they reuse the technology - maybe this company is IPS (I am thinking this after what I did read over the web). Do you have an opinion?

Share this post


Link to post
Share on other sites
1 minute ago, electric_vehicle_lover said:

I see that boards have almost similar schematics, the firmwares are also maybe similar on some EUCs and so the app. Maybe Gotway and KingSong buy the development from another company that does all the development and so they reuse the technology - maybe this company is IPS (I am thinking this after what I did read over the web). Do you have an opinion?

The story I've heard goes that King Song reverse engineered Gotways' firmware (at least partially) to build their first models, maybe same for the hardware-side... But I don't know if it's true. Don't know if they buy the hardware and/or software development from outside or if they do it themselves these days...

Share this post


Link to post
Share on other sites

Well, anyway, I think this great because such companies may take advantage of our firmware and so that will be better also better for us.
I just asked Jane Mo from GotWay for free samples of the 30km/h board, to help of the development of firmware. The firmware for GotWay MCM4 seems to be dangerous right now due to the hard face plants :-( :-(

  • Upvote 1

Share this post


Link to post
Share on other sites
On 12/25/2015 at 9:01 PM, electric_vehicle_lover said:

I just asked Jane Mo from GotWay for free samples of the 30km/h board, to help of the development of firmware.

Based on the pictures I saw MCM4 (800W) uses different controller boards than the 30km/h ones that microworks sells (for 500W motors also used in MCM2s). Their reps told me they currently don't sell 800W motors or matching controllers... @electric_vehicle_lover it would be great if we could purchase MCM4 motor + controller combos via Jane Mo (not only the controllers).

  • Upvote 1

Share this post


Link to post
Share on other sites

I talked with Jane Mo and she told me that GotWay don't sell spare parts (also they are not provide free samples for support the development of firmware and app). She also told me that MicroWorks is a "copy" - maybe that means that they copy the GotWay unicycles they sell (??).

So, I will turn to MicroWorks. They almost sell a complete EUC in parts (just missing the plastic structure/shell).

My option will be to upgrade as @jayjay23 already did: buy a generic and upgrade the motor + the board. Generic EUC: 350€ + upgrade motor 500W 30km/h + board with bluetooth: 225€ (this prices includes shipping and taxes to Portugal). This board will be great for the development of firmware, but I plan to do that just after having firmware for the generic.

In future, I hope to be able to 3D printed the plastic structure/shell, mainly to design with space for battery upgrade, lights and other mods. I am really near with 3D printing industry and right now the print parts are kind of fragile and also there isn't cheap printers with big build area to print an EUC shell - all this will improve in 2016, I hope :-)

GotWay M5 with 3D printed shell:

gotway_m5_3D_printed2.jpg.4644d91d3bc30fgw5_assembled4.jpg.980463892131e26ea3472

http://www.wheelers.fr/gotway-m5-avec-sa-coque-3d-printed/

 

Edited by electric_vehicle_lover
  • Upvote 1

Share this post


Link to post
Share on other sites

Hey @electric_vehicle_lover nice Informations.

I'm on Christmas vacation so sadly i cant develope atm :/ 

This is a bit offtopic i know but hope thats ok ;) i like your idea and also want to upgrade after i got my insurence (stupid laws).

To the 3d printing stuff ... Me and a friend of mine are building a CNC mill / 3d printer Combo with a work area of width=500*length=500*height=250 mm so that would probably work. Its self constructed and around 1000/1500€ total.

But im not quiet sure if PLA or ABS are a good choice in terms of strength.

 

Merry belated Christmas everybody ;)

  • Upvote 1

Share this post


Link to post
Share on other sites

About the firmware, I have now more information about complementary PWM and braking/regen. I will continue working on the motor control.

Edited by electric_vehicle_lover

Share this post


Link to post
Share on other sites

@Restless ABS is better for sure. Other more expensive filaments like Nylon or even PC that is used on the riot shield of police. I think EUCs have a shell of ABS + PC. King Song Shell Strength Test (I think is ABS+ PC):

I know very well RepRap project and OpenSource and DIY 3D printers :-)

Edited by electric_vehicle_lover

Share this post


Link to post
Share on other sites

I probably buy a complete MSuper to use for this project and the next evolutions of this project.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×