Arduino/ATMega based controller?

Pointy

1 mW
Joined
Apr 27, 2024
Messages
13
Location
UK
Are there any good open source projects based on the Arduino or ATMega MCU's?

I thought it might be a fun project at some point and while I am reasonably fluent digital electronics and designing basic PCB's in Eagle, I have no clue about the motor driver stage. I would imagine the rest is reasonably straight forward as it is just reading sensors and driving a display.

I have designed and built ATMega based devices before, here are 3d models of my resin printer wash and cure PCB/Machine...

w&c.PNG

19.PNG

This is driving a stepper motor for the turntable and small 0.96" OLED display, with 3 buttons for programming and usage.

So I guess the question is would something like an ATmega328 be powerful enough for an eBike controller?

Any links, suggestions or thoughts would be appreciated.


Regards,

Les
 
So I guess the question is would something like an ATmega328 be powerful enough for an eBike controller?
8bit processor at 20 MHz, can work, the popular Kunteng controller uses a similar poor processor.
If you want to do field orientated control @16kHz PWM frequency, the processor will be too slow, I guess.
There is a big "Simple FOC" Arduino community:

You can take a look at @badgineer's project to see how to design a power stage.
 
Last edited:
Thanks for replying.

I did also find a this thread which is also on hackaday. It's a shame that the project was not continued as it looks like the sort of thing I had in mind. At least there is a schematic available for me to mull over.
 
I've conveniently ignored the complicated motor part and am planning to make something that piggy-backs on a VESC:


If you've got experience making PCBs would appreciate any feedback you have
 
I've conveniently ignored the complicated motor part and am planning to make something that piggy-backs on a VESC:


If you've got experience making PCBs would appreciate any feedback you have

Thanks for posting, I will try and take a look when I get a spare moment (which seems to be never at the moment :rolleyes:).

I have, very slowing, been porting the schematic that I posted about in reply #3 into Eagle. I want the controller to be as customizable as possible and maximize available IO pins, so that if like me you don't want a throttle you can use the associated pin for something else. I also am not interested in the BT connection/phone app but I would like to drive an OLED display as well if possible. It would be nice to make it open source, so if anyone wants to help with the PCB design/software, please feel free to chime in.

Regards,

Les
 
Cheers, tbh don't worry too much - am about to send it off to jlcpcb to get some boards made. I've rejigged it enough times now - and although I'm sure that the second I click submit I'll notice a glaring error I'll never find out until I get some made and put some voltage into them :)

Out of interest, why do you want to make the motor controller? There are an almost infinite variety of *ESCs out there that you've got one for almost any purpose pretty much. My plan is to make the controller part and a base framework of software (that I pretty much already have) and then I've got a platform I can use for any bike moving forward. Once I move away from the TSDZ2 I can remove the proprietary torque sensor reading circuitry but keep the rest...

I've just changed the LED driver on my board from using 3 GPIO pins to drive a single RGB LED - to instead having 5v/Gnd/CLK/SDI to drive one or more APA102/SK9822 LEDs, in theory that could instead drive an OLED screen... There are also 2 GPIO pins free in my design at present. Both low frequency though (<10Khz) - one GPIO, one GPIO/ADC.

Going to spend a couple of hours doing something else, then recheck the PCB and hopefully place the order!

All the parts are in stock, will come out about $20 per board for the initial 5 run... really hope i don't realise they are junk before they arrive!

1716829540116.png
Board measures 22x56mm
 
I have, very slowing, been porting the schematic that I posted about in reply #3 into Eagle. I want the controller to be as customizable as possible and maximize available IO pins, so that if like me you don't want a throttle you can use the associated pin for something else.
Ditto - I want a generic controller that I can use for most/all purposes - but most of the boards don't have quite enough IO pins exposed. I moved away from the nrf 52840 dongle for that reason, the arduino ble 33 has many more pins exposed. But still not all... and some are on inconvenient pads on the underside.

In an ideal world I'd do away with the piggy back arduino and put the microcontroller directly on the board but the main thing that stops me doing that is I want to keep the bluetooth and I don't want to get involved in antenna circuit tuning.

I feel the same about the throttle, but I've included space for one on this board as it seems a significant %age of people like to use a throttle - and tbh I'm not getting any younger so maybe one day I'll want to too!
 
Out of interest, why do you want to make the motor controller?

The blunt answer is....because I can! :D

I just love designing/building/programming and I especially like the Arduino environment. Heck, I built that 3d resin printer wash and cure unit and I don't even have a resin printer yet! :rolleyes:

The main problem is lack of time, which is only going to get worse as I start a new job tomorrow.
 
Back
Top