RCCrawler Forums

RCCrawler Forums (http://www.rccrawler.com/forum/)
-   Electronics (http://www.rccrawler.com/forum/electronics/)
-   -   Open source ESC and firmware (http://www.rccrawler.com/forum/electronics/607034-open-source-esc-firmware.html)

Alka 03-10-2019 08:55 AM

Open source ESC and firmware
 
Hi ,

In case there are some people who like diy electronics. Here is a cheap brushless speed controller I made that works decently well at low rpms for crawlers. There is also firmware that is open source, also has car modes and quad modes. Here is a little video of it with a 17 dollar brushless 3650 inrunner on a hgp402. Cost of the ESC in parts is about 10 dollars.
I started it because good speed controllers cost too much for me but I still wanted drag brake and good low control for sensorless motors. Plus I can't stand speed controllers that put out audible pwm frequency. I like to just hear the gears clacking!
https://youtu.be/grsFjtRrNT4

EDIT added brushed mode : Will be pushed to GITHUB here https://github.com/conuthead/f051bld...rsion2Sept2019

JatoTheRipper 03-10-2019 09:18 AM

Re: Open source ESC and firmware
 
Awesome! Very cool project!

Frank211 03-10-2019 11:41 AM

Re: Open source ESC and firmware
 
I did not know esc's didn't have to make noise, I learn something new everyday. What a trip TO ME. Cool job.

Alka 03-10-2019 07:15 PM

Re: Open source ESC and firmware
 
Thanks, the firmware is still a little rough. I am still learning myself about stm32.. I want to try a nice motor on a good chassis. The hg p402 I have has really rough gears and the motor is probably not the best for crawling but it does ok. I can't really change pinions to a smaller size to get a better gear ratio so I ordered a tenshock 906 1250kv 6 pole motor to play with. I really want to try the Holmes revolver but the budget doesn't quite allow for it right now.
The idea is that this firmware will work on all sorts of cheap commercial quad esc's and just about any motor to give a decent experience.

This is the link for the firmware source..
https://github.com/conuthead/f051bldc

Hydrocarbon92 03-11-2019 12:52 PM

Re: Open source ESC and firmware
 
Alka this is some great work! I considered something similar but it's more than I want to tackle. I'm curious, would this be compatible with the cheap "blue pill" STM32's (STM32F103C8)?


Quote:

Originally Posted by Frank211 (Post 5916890)
I did not know esc's didn't have to make noise, I learn something new everyday. What a trip TO ME. Cool job.

The noise is from the PWM frequency used, generally it's audible because a lower frequency aids slow mosfets (reduces heat). The issue is mostly because ESC producers use craptastic mosfets. There exists modern $2 mosfets that handle 175 amps - and are limited mostly by the case design! Even the p-channel style, which generally can't handle as much power, can be had for under $2 for 100A+. Most ESC's still use a linear regulator for 5v power that was cutting edge 40 years ago, to give an idea how un-evolved some designs are due to cost.

Alka 03-11-2019 01:37 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by Hydrocarbon92 (Post 5917214)
Alka this is some great work! I considered something similar but it's more than I want to tackle. I'm curious, would this be compatible with the cheap "blue pill" STM32's (STM32F103C8)?

The noise is from the PWM frequency used, generally it's audible because a lower frequency aids slow mosfets (reduces heat). The issue is mostly because ESC producers use craptastic mosfets. There exists modern $2 mosfets that handle 175 amps - and are limited mostly by the case design! Even the p-channel style, which generally can't handle as much power, can be had for under $2 for 100A+. Most ESC's still use a linear regulator for 5v power that was cutting edge 40 years ago, to give an idea how un-evolved some designs are due to cost.

You could make it work on the cheap bluepill processors but would need a different sense method..
This is a back emf sensing firmware, there are a couple of different ways to do it.. you can use MCU's that have built in comparators, this is the way most atmega8 and stm32f051 and f3 esc's sense back emf ( comparing phase voltage to neutral voltage ). Without a comparator to do it efficiently you would have to use the ADC ( analog input) and read the voltage of the phases. This works just as well at low speeds but not as well at very high rpms as it takes much more time and overhead. The blue pill stm32f1 series does not have built in hardware comparators and so must use the adc. This is just fine for the e-rpms that most in-runners work at though.
When it comes to the f103 vs the f051 i would choose the f051 for speed controllers because its cheap and has comparators.

you are spot on about the mosfets.. every year they get better but some esc's are still using very old very slow mosfets. I have been using toshiba fets with less than 1mohm rdson. They don't even get warm enough to warrant a heatsink on a crawler.

Alka 03-11-2019 02:47 PM

Re: Open source ESC and firmware
 
There are a couple of minor limitations but there is no reason hardware wise why you can't use one brushless ESC to control Two brushed motors. Could be useful for those moa rigs?

JatoTheRipper 03-11-2019 03:28 PM

Re: Open source ESC and firmware
 
There should be way more excitement about this especially on a DIY site like this. Please, keep up the hard work!

HumboldtEF 03-11-2019 03:49 PM

Re: Open source ESC and firmware
 
Very cool, a bit outside of my wheelhouse so I dont know what I would do with it.

I sent a link to my brother who should be very interested in this.

Alka 03-11-2019 04:12 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JatoTheRipper (Post 5917286)
There should be way more excitement about this especially on a DIY site like this. Please, keep up the hard work!


Thanks, it not very accessible right now. since you have to make your own hardware too. I will work on getting it working on a cheap readily available ESC so you can just flash the crawler-oriented firmware to it.

Meanwhile i will just use this thread as a place to post updates and videos on it as it progresses.

Natedog 03-11-2019 04:45 PM

Re: Open source ESC and firmware
 
Great job, love it, watched your video too! Agree with the mosfet info too. :)

Alka 03-30-2019 07:22 AM

Re: Open source ESC and firmware
 
A Tenshock 906 1250kv motor arrived in the mail yesterday ! I would still love to try the firmware on a Holmes revolver but this is the most i can afford for now. The 906 is much better suited for the tall gearing of the hgp401 than the cheap 2300kv 4 pole motor that was in there before.


I did a quick video this morning trying to climb a nice muddy hill.


https://youtu.be/m0jtybQw0z4

edit: how do you embed a video so you can see the video instead of just the link?

JohnRobHolmes 03-30-2019 07:57 AM

Re: Open source ESC and firmware
 
Nice work. I assume the hardware uses basic zero cross detection with comparators?

JeepinOR 03-30-2019 08:27 AM

Re: Open source ESC and firmware
 
RC + RC Nerds = freakin rad. Nice work. Will be watching; would love to see the ESC up close, parts list, if you're willing to share.

JohnRobHolmes 03-30-2019 08:38 AM

Re: Open source ESC and firmware
 
The github has all that, or will

Alka 03-30-2019 08:55 AM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JohnRobHolmes (Post 5923434)
Nice work. I assume the hardware uses basic zero cross detection with comparators?

Yes this uses comparators, this was really designed to work on basic quadcopter esc's and the most common hardware. The adc works too for the same but there is no benefit without changing the bemf sense divider.

There were a number of things I was trying out. The bemf detection with comparators is pretty decent but needs a lot of filtering at the low end, once the speed gets very low some open loop driving is neccesary for smoothness.
I have tried a couple other methods that are more promising for the low end but more limited for very high erpm, I haven't really been focusing on them as the hardware is more specific.

.. slightly better is bemf detection during off time but not using a voltage divider ( just a diode to clamp bemf beyond the pin range). This is very sensitive but uses adc so its becomes tricky at high e-rpm, also you would not be able to obtain 100 percent duty cycle without switching the divider back on. I have an example with a prop on youtube but this is very raw.

The other promising methods of bemf detection is to use the embedded op-amps on the stspin32f0 chips kind of like comparators. The output of the op-amps is routed straight to an input pin and can then be read digitally. It seems to have the sensitivity of the adc but the high speed of the comparators.

Also tried foc but the cost goes up by a few dollars per board and the setup is more complicated.
The other two versions are available for testing but not open source yet.

Alka 03-30-2019 09:01 AM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JeepinCA (Post 5923441)
RC + RC Nerds = freakin rad. Nice work. Will be watching; would love to see the ESC up close, parts list, if you're willing to share.


The schematics and gerbers and all that for this esc are all in this post . You will need the freeware version of diptrace to open the files.
I made the esc at first for use in qudacopters but the test version was way to big so they got moved to crawlers and trucks.
If you get diptrace I can give you a number of different variants depending on the size, current voltage and features you want.

https://www.rcgroups.com/forums/show...051-and-MP6531

There a lot of other stuff there on my blog on rcgroups. If you click on my name from that page you'll see all the posts ( even a speed loop controlled foc version ) . I am really behind in putting stuff up there. I thought making the firmware would be a simpler task than it was !
The goal of the git page is to eventually have all the stuff there, with some instructions.

Alka 03-30-2019 01:58 PM

Re: Open source ESC and firmware
 
Hey JohnRobHolmes! you just hit 20K posts! keep up the good work. Many a youtube search has landed me on your vids. Your technical advice has always been spot on!"thumbsup"

durok 03-30-2019 09:06 PM

Re: Open source ESC and firmware
 
This thread is givin' me a semi...

:badger:

(way over my head, but I can tell that something seriously cool and forward-thinking is going on)

JohnRobHolmes 04-01-2019 11:30 AM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by Alka (Post 5923425)
A Tenshock 906 1250kv motor arrived in the mail yesterday ! I would still love to try the firmware on a Holmes revolver but this is the most i can afford for now. The 906 is much better suited for the tall gearing of the hgp401 than the cheap 2300kv 4 pole motor that was in there before.


I think your efforts are enough to trade you a revolver for some questions I have "thumbsup"

JatoTheRipper 04-01-2019 12:05 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JohnRobHolmes (Post 5924017)
I think your efforts are enough to trade you a revolver for some questions I have "thumbsup"

Hell yes! Nice move! "thumbsup"

Alka 04-01-2019 02:25 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JohnRobHolmes (Post 5924017)
I think your efforts are enough to trade you a revolver for some questions I have "thumbsup"

You can ask as many questions as you like! that goes for people without motors to give away too! If you have a bare metal technical question or want to dive into understanding or creating your own brushless ( or brushed ) firmware or hardware feel free to post here or pm me.

JohnRobHolmes 04-01-2019 03:05 PM

Re: Open source ESC and firmware
 
Now I just need to learn diptrace. Downloaded it earlier, I’ll try to dive in tomorrow.

JohnRobHolmes 04-01-2019 03:26 PM

Re: Open source ESC and firmware
 
I’m pretty dang excited right now. My plans of formally schooling for programming got derailed this semester by a broken leg. This is a fresh breeze in my sails, I can learn a lot from looking at an existing project!

Voodoobrew 04-01-2019 03:57 PM

Re: Open source ESC and firmware
 
Formal schooling is no match for truly loving what your doing and researching it yourself imo.

JohnRobHolmes 04-01-2019 06:44 PM

Re: Open source ESC and firmware
 
Formal schooling is good when the subject is too complicated to figure out though. Anything to get me out of the office helps, my day at the shop is a peppering of questions every few minutes.

elRayRay 04-01-2019 07:19 PM

Re: Open source ESC and firmware
 
Very excited about the developments in this thread and what it may mean for the future of Holmes Hobbies speed controllers.

Voodoobrew 04-02-2019 04:02 AM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JohnRobHolmes (Post 5924134)
Formal schooling is good when the subject is too complicated to figure out though. Anything to get me out of the office helps, my day at the shop is a peppering of questions every few minutes.

I think the trick is to break it down and deal with one thing at a time, this is easy for me but I don't know if its the same for everyone. Also I get pretty reverent results from google, again not sure if everyone has the same experience. To be fair I cant say I have ever tried anthing as complex as wiring an esc. But I don't consider anything I know to be complex, and I know a few people think i know some complicated things, there is lots of perspective involved. Usually its only hard until you understand it.

Alka 04-02-2019 04:45 AM

Re: Open source ESC and firmware
 
That was the route that I took. St micro has tons of example firmware that teaches you how to deal with each peripheral one at a time. First get Pwm going on one channel. Then multiple channels. Then add in a timer to change which channels are getting pwm at which times. Now you have open loop control. Then add in a comparator and see if you can use that to find zc's while spinning the motor by hand. Then use that comparator inerrupt to change the channel for you. When you have the comp changing your channels for you now you can deal with the input and regulating power. Bldc control can be built up slowly like this. I recommend getting on of the 10 ohm gimbal motors to learn on. If something goes wrong the resistance is too high to smoke your controller or motor yet you can still work with full power to the ESC.

https://letanphuc.net/tag/stm32f0-tutorial/

That site helped me a lot, very clear tutorials and a video for each one too. Each peripheral that needs to be used is pretty much covered.

Quote:

Originally Posted by Voodoobrew (Post 5924215)
I think the trick is to break it down and deal with one thing at a time, this is easy for me but I don't know if its the same for everyone. Also I get pretty reverent results from google, again not sure if everyone has the same experience. To be fair I cant say I have ever tried anthing as complex as wiring an esc. But I don't consider anything I know to be complex, and I know a few people think i know some complicated things, there is lots of perspective involved. Usually its only hard until you understand it.


Alka 04-03-2019 07:23 PM

Re: Open source ESC and firmware
 
Mini-review of he hg-p402. I got this thing a couple of years ago now and my first impressions were.. "man this thing is a piece of junk" oh well i will let my kids play with it and bash around with it until it is no more. It has had a fair amount of abuse geared more like a basher truck for a 5 year old to play with. I still think it feels and sounds like every turn of its gears are going its last but it is still going.. steering is the worst I have ever used though, have to do something about that soon. Broke one driveshaft and the other is very twisted but for now it is holding on.. You need to locktite everything or it will slowly disintegrate in front of your eyes on the trail. For the price I am pretty happy.. lots of fun can be had with it! after two years I was looking online at another one just the same even knowing its faults...Going to save for something better I think though..

Anyway here's another video of the progress. This is about as slow as I can go with this standard design and still have decent torque. New hardware designs are on the way. JRH has got me thinking..
https://youtu.be/dCZOd3YfV7Y

JohnRobHolmes 04-03-2019 08:16 PM

Re: Open source ESC and firmware
 
And you’ve got me waking up at 4 am thinking about hardware right now, lol! Im keeping up with the information better than I thought I would. It’s still a lot to process, but breaking it down Into individual periferals with a header file for each makes it easier by far.


I’ve been poking around in diptrace. I’m going to start with the two layer boards that you have but I can see where 4 layer or two board designs would really help compactness. Long term hardware goal would be power boards with integrated drivers and then brain boards with just brains and a regulator.

Vizual54 04-07-2019 01:17 AM

Re: Open source ESC and firmware
 
This is really cool. I was reading the whole Hobbywing Axe thread the other week and was thinking that someone should start a open source project. A quick Google search and I ended up in this thread :)
Unfortunately I'm no electronics engineer so I can't help much with circuit board design. However I'm a developer and writing some code for this project would be really cool. One feature ive been thinking about is some way to change modes or profiles on the ESC on the fly. Preferably via an extra pwm input.
Say that you have the possibility to setup different profiles on the ESC for example for different types of terrain or maybe crawl or bash profiles. This could be setup with Bluetooth via an app on the smartphone or maybe usb on a laptop.
With a switch from the remote you could then change between the different modes/profiles.

Alka 04-07-2019 11:54 AM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by Vizual54 (Post 5925534)
This is really cool. I was reading the whole Hobbywing Axe thread the other week and was thinking that someone should start a open source project. A quick Google search and I ended up in this thread :)
Unfortunately I'm no electronics engineer so I can't help much with circuit board design. However I'm a developer and writing some code for this project would be really cool. One feature ive been thinking about is some way to change modes or profiles on the ESC on the fly. Preferably via an extra pwm input.
Say that you have the possibility to setup different profiles on the ESC for example for different types of terrain or maybe crawl or bash profiles. This could be setup with Bluetooth via an app on the smartphone or maybe usb on a laptop.
With a switch from the remote you could then change between the different modes/profiles.

Awesome! this is the kid of thing we need. There are actually 4 different vehicle modes on the firmware now. And eeprom is working , all we need is to get some serial coms working and we can probably 'easily' use Bluetooth adapters to change settings.
The code is messy right now. It is a learning project for me so you might laugh at the it.. any tips you have are welcome. Check out the GitHub link in one of the posts above. If you pick up a one of the cheap stm32f051 nucleo dev boards you can load up the firmware and help add in communication functions.

self-future 05-03-2019 10:13 AM

Re: Open source ESC and firmware
 
Wow, this is super exciting. I always wonder why rc forums don’t cater to this kind of thing. Someone at rccrawler seriously needs to make a section for open source projects like this and also mechanical design. Maybe experimental would be a good classification?
I love tuning and a printed body, but this is another level that we should all aspire to!
Definitely going to keep up with your projects!

JohnRobHolmes 05-13-2019 07:41 PM

Re: Open source ESC and firmware
 
1 Attachment(s)
Just one more software to learn. Just one more. spent a little time in diptrace today making this masterpiece of a design. seems pretty similar to kicad the way the schematics set up nets and then it is used to build the layout and ensure everything is connected proper.

Alka 05-16-2019 08:46 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JohnRobHolmes (Post 5934507)
Just one more software to learn. Just one more. spent a little time in diptrace today making this masterpiece of a design. seems pretty similar to kicad the way the schematics set up nets and then it is used to build the layout and ensure everything is connected proper.

Haha, nice pcb ! I particularly like the parallelogram board outline. I bet manufacturers would love that!

I tried kicad but I like the mouse interface in diptrace makes sense more to me.. Adding new parts and footprints is pretty simple too.

How do you post pictures on this forum? I looked at the FAQ and I have no such albums link in my control panel. Tried creating an album and was denied. Something about permission.

HumboldtEF 05-16-2019 11:15 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by Alka (Post 5935304)



How do you post pictures on this forum? I looked at the FAQ and I have no such albums link in my control panel. Tried creating an album and was denied. Something about permission.


You need to purchase a star to have access to an album I believe. Some apps like tappa talk allow you to post pictures https://uploads.tapatalk-cdn.com/201...519d47fd9e.jpg Just making sure that works.
You can also use a free image hosting site like Imgur, once you host an image they provide links that can be inserted into your posts.



Sent from my iPhone using Tapatalk

Alka 09-30-2019 07:00 PM

Re: Open source ESC and firmware
 
Added a brushed mode today, RC car and Crawler modes. Crawler uses full active braking , hold brake and instant reverse. Car mode requires double tap to reverse and coasts to stop.

https://www.youtube.com/watch?v=fZAhT9Cs9Sw

link for the code updated on the first post.

JatoTheRipper 09-30-2019 07:06 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by Alka (Post 5966401)
Added a brushed mode today, RC car and Crawler modes. Crawler uses full active braking , hold brake and instant reverse. Car mode requires double tap to reverse and coasts to stop.


So awesome! Nice work.

Alka 09-30-2019 07:14 PM

Re: Open source ESC and firmware
 
Quote:

Originally Posted by JatoTheRipper (Post 5966402)
So awesome! Nice work.


Thanks, it can control two brushed motors at the same time too, there is a separate channel that can be used for the second input. Both motors share the same middle mosfets so the drawback is both have to be going the same direction at the same time ( but they don't have to be going the same speed). Maybe its useful for dual motor crawlers ? otherwise the second channel can control the drag brake strength.


All times are GMT -6. The time now is 09:33 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO ©2011, Crawlability, Inc.
Copyright 2004-2014 RCCrawler.com