Alan B
100 GW
5/2016 Edit - picking up this design and renewing this thread on page 6, there's a lot of good stuff that is still (mostly) applicable on these earlier pages. The Grin PhaseRunner was developed after this effort was started but is an excellent example of what can be done with a small 6 FET controller so that will be used as an example and existence proof of what is possible in a small form factor. In a sense the PhaseRunner is a combination of ideas from Justin that descended from his 2008 controller combined with controller technology from ASI, a controller manufacturer that Grin partnered with. Now returning to 2010's thread, with updates.
Recently I was reading the thread of Justin's 2008 ebike trip across Canada [links in the references section below]. He built his own controller and had some interesting features. Every time I read about someone who built their own controller I think about things that I would like to have in my own controller. Things that would be easy to do if we had source code. Hacking the hardware is nice, but I want access to the software as well.
I see others have built controllers, or are in the process. There are many aspects of this we can share even if we are developing different units.
I would like to focus my effort on building a simple commuter controller. Something to get started with - some hardware and software - and get some experience. Rev 0. Start simple and improve. Even if I don't build this, I want to collect information here, and links to data regarding building your own small ebike controller that will be useful as a reference to others.
Scale the requirements to get things moving for this prototype. Not to take away from the "Best Controller" project at all, but this could be a testing ground which will be faster to prototype real hardware and software.
I'd like to see something that would be useable on a bike with common motors we already have. So we can swap it into our systems for some real world testing and development. Get that homemade controller grin going!
I suggest some simplified "prototype requirements" like:
The prototype should be useful, not a tangle of wires on a bench. It should be able to run on a bike with a common motor at reasonable voltages and currents. The actual capability would come out as the detailed design evolves, but something along the lines of existing controllers. Something reasonably easy to attain on the first try.
Use readily available through hole parts for this prototype. Designed so people with moderate soldering skills can make it. Easy to repair and mod. [Note that hobbyists have developed techniques to work with surface mount devices (aka SMT or SMD) using standard soldering tools, and the availability of low cost hot air tools makes it possible to use them on DIY projects.]
Limit the PCB to one that we can readily get in small quantities at reasonable cost. Keep the unit compact. Significantly smaller than infineons. Use a free design tool that is easy to learn and make a public open schematic and layout so folks can make their own version of it with their own improvements. One such solution I'm aware of that works this way is expresspcb. There are undoubtedly others, let's pick one. Their 2 layer plated through miniboard is 3.8 by 2.5 inches and costs $51 for three boards and they turn it around in a few days. They have free software for schematics and pcb design that takes a couple of minutes to learn. It is 1.25 ounce copper, so plan for bare wires to be added to support reasonable current, but again this is not a mega controller (yet). It is the baby that can grow up later. And the folks who want to use external really big FETS can wire them right up to this small board, so that might be a viable "big controller" approach as well. (edit - have switched to OSH Park, much more flexibility (any size board), and free/low cost DipTrace layout software that is easy to learn and quite capable).
We can get creative and put some parts on the backside of the board if needed, but keep it serviceable. One (or a few) small pc board(s). Leave the fancy master CPU till later, just do the motor control board. A compact (six) FET unit. Standalone capable, or can be integrated into a larger multiboard system later on. (as you will see below this changes slightly as the design evolves and two boards are proposed).
Use FETs that are readily available, through hole, low cost and fit on the board - constrain by space but keep it simple to start. Not a huge number of them. How many will fit on this board? We want to keep the price moderate, we may be blowing some of these boards up as we try out software ideas, etc. I'd rather blow up smaller numbers of FETS while testing just from a practical standpoint, even if it means testing at lower current. (edit - go with six TO220 FETs, AOT290L (low cost, good performance, good availability) as used in the PhaseRunner)
Voltage - again, what is simple, will fit, and will be useable by most as a test platform for the controller technology (not the performance edge of bike motors). Perhaps not a switching regulator on this first prototype. Add that later? Unless someone has a small footprint trusted design in hand. (edit - 100V parts, 80V max operating)
Use a micro with open and easy to use high level software tools. This probably means the Arduino/AVR since other suggestions either are surface mount only or don't have free high level tools and large libraries of useful example software for the hobbyist. Choose the most capable fairly common through hole chip with the best hardware for motor control that is well supported for the purpose (app notes, sample code, etc) and low in cost. (edit - ATmega64M1 has the Power Stage Controller that is well suited to the project goals, and it can be configured as an Arduino, however it is only available in SMT).
Scale other requirements back to what is essential to make it operate on a bike. Throttle, ebrake. Detectors for sensorless control if they will fit (this will be an important software development area). Toss the things that are not really needed like 12V outputs, etc. This is a platform for developing experience and software. To do that well it needs to be run on the bike. It should be easy to reprogram without necessarily removing it from the bike. A jack on the board that can be brought out with a cable. (edit - Note that I was originally considering CANbus to be too complicated and expensive, but this has changed so I am reconsidering that choice. Consider CANbus interface on RJ45).
Extra inputs/outputs as available for other things. What does the chip have room for? Like a skilled woodworker, find the "grain" and work with it. Do what is easy and put off what is hard and nonessential for a future model.
Then we make a few and get started. Once some hardware is out there this project might really take off. Share some software. Write some code, rewrite, throw it out and write it again once the issues are better understood.
Anyone interested in collaborating on this? At least sharing portions of the design tradeoffs and choices.
Consider a user I/O "Terminal" to mount on the handlebar and perform useful features. This can [possibly] be done with an off the shelf unit, so it is not a major part of this project. I add it here because it may have impact on the controller as the two work in synergy. Functions such as speed, current, power, etc monitoring and control can be handled by this unit and the controller working together. Initially it would be little more than a debugging tool for the controller, later it can evolve as far as wanted to be the controls for the controller as well as the ebike's readout system. (edit - another CANbus node).
References
Justin's Trip across Canada by Ebike:
https://endless-sphere.com/forums/viewtopic.php?f=29&t=7134
Building the Best Controller thread:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=20731
Oldswamm's Economical Hi-Amp Controller thread:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=22728
Another controller build thread found 11/30/2010:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=23205
Justin's 2008 Controller (images)
https://endless-sphere.com/forums/viewtopic.php?p=1022564#p1022564
Grin/ASI Collaboration: the PhaseRunner (influenced by Justin's 2008 controller)
https://endless-sphere.com/forums/viewtopic.php?f=31&t=65031
Open Source STM8 Controller Firmware Project
https://endless-sphere.com/forums/viewtopic.php?f=30&t=87870
Recently I was reading the thread of Justin's 2008 ebike trip across Canada [links in the references section below]. He built his own controller and had some interesting features. Every time I read about someone who built their own controller I think about things that I would like to have in my own controller. Things that would be easy to do if we had source code. Hacking the hardware is nice, but I want access to the software as well.
I see others have built controllers, or are in the process. There are many aspects of this we can share even if we are developing different units.
I would like to focus my effort on building a simple commuter controller. Something to get started with - some hardware and software - and get some experience. Rev 0. Start simple and improve. Even if I don't build this, I want to collect information here, and links to data regarding building your own small ebike controller that will be useful as a reference to others.
Scale the requirements to get things moving for this prototype. Not to take away from the "Best Controller" project at all, but this could be a testing ground which will be faster to prototype real hardware and software.
I'd like to see something that would be useable on a bike with common motors we already have. So we can swap it into our systems for some real world testing and development. Get that homemade controller grin going!
I suggest some simplified "prototype requirements" like:
The prototype should be useful, not a tangle of wires on a bench. It should be able to run on a bike with a common motor at reasonable voltages and currents. The actual capability would come out as the detailed design evolves, but something along the lines of existing controllers. Something reasonably easy to attain on the first try.
Use readily available through hole parts for this prototype. Designed so people with moderate soldering skills can make it. Easy to repair and mod. [Note that hobbyists have developed techniques to work with surface mount devices (aka SMT or SMD) using standard soldering tools, and the availability of low cost hot air tools makes it possible to use them on DIY projects.]
Limit the PCB to one that we can readily get in small quantities at reasonable cost. Keep the unit compact. Significantly smaller than infineons. Use a free design tool that is easy to learn and make a public open schematic and layout so folks can make their own version of it with their own improvements. One such solution I'm aware of that works this way is expresspcb. There are undoubtedly others, let's pick one. Their 2 layer plated through miniboard is 3.8 by 2.5 inches and costs $51 for three boards and they turn it around in a few days. They have free software for schematics and pcb design that takes a couple of minutes to learn. It is 1.25 ounce copper, so plan for bare wires to be added to support reasonable current, but again this is not a mega controller (yet). It is the baby that can grow up later. And the folks who want to use external really big FETS can wire them right up to this small board, so that might be a viable "big controller" approach as well. (edit - have switched to OSH Park, much more flexibility (any size board), and free/low cost DipTrace layout software that is easy to learn and quite capable).
We can get creative and put some parts on the backside of the board if needed, but keep it serviceable. One (or a few) small pc board(s). Leave the fancy master CPU till later, just do the motor control board. A compact (six) FET unit. Standalone capable, or can be integrated into a larger multiboard system later on. (as you will see below this changes slightly as the design evolves and two boards are proposed).
Use FETs that are readily available, through hole, low cost and fit on the board - constrain by space but keep it simple to start. Not a huge number of them. How many will fit on this board? We want to keep the price moderate, we may be blowing some of these boards up as we try out software ideas, etc. I'd rather blow up smaller numbers of FETS while testing just from a practical standpoint, even if it means testing at lower current. (edit - go with six TO220 FETs, AOT290L (low cost, good performance, good availability) as used in the PhaseRunner)
Voltage - again, what is simple, will fit, and will be useable by most as a test platform for the controller technology (not the performance edge of bike motors). Perhaps not a switching regulator on this first prototype. Add that later? Unless someone has a small footprint trusted design in hand. (edit - 100V parts, 80V max operating)
Use a micro with open and easy to use high level software tools. This probably means the Arduino/AVR since other suggestions either are surface mount only or don't have free high level tools and large libraries of useful example software for the hobbyist. Choose the most capable fairly common through hole chip with the best hardware for motor control that is well supported for the purpose (app notes, sample code, etc) and low in cost. (edit - ATmega64M1 has the Power Stage Controller that is well suited to the project goals, and it can be configured as an Arduino, however it is only available in SMT).
Scale other requirements back to what is essential to make it operate on a bike. Throttle, ebrake. Detectors for sensorless control if they will fit (this will be an important software development area). Toss the things that are not really needed like 12V outputs, etc. This is a platform for developing experience and software. To do that well it needs to be run on the bike. It should be easy to reprogram without necessarily removing it from the bike. A jack on the board that can be brought out with a cable. (edit - Note that I was originally considering CANbus to be too complicated and expensive, but this has changed so I am reconsidering that choice. Consider CANbus interface on RJ45).
Extra inputs/outputs as available for other things. What does the chip have room for? Like a skilled woodworker, find the "grain" and work with it. Do what is easy and put off what is hard and nonessential for a future model.
Then we make a few and get started. Once some hardware is out there this project might really take off. Share some software. Write some code, rewrite, throw it out and write it again once the issues are better understood.
Anyone interested in collaborating on this? At least sharing portions of the design tradeoffs and choices.
Consider a user I/O "Terminal" to mount on the handlebar and perform useful features. This can [possibly] be done with an off the shelf unit, so it is not a major part of this project. I add it here because it may have impact on the controller as the two work in synergy. Functions such as speed, current, power, etc monitoring and control can be handled by this unit and the controller working together. Initially it would be little more than a debugging tool for the controller, later it can evolve as far as wanted to be the controls for the controller as well as the ebike's readout system. (edit - another CANbus node).
References
Justin's Trip across Canada by Ebike:
https://endless-sphere.com/forums/viewtopic.php?f=29&t=7134
Building the Best Controller thread:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=20731
Oldswamm's Economical Hi-Amp Controller thread:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=22728
Another controller build thread found 11/30/2010:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=23205
Justin's 2008 Controller (images)
https://endless-sphere.com/forums/viewtopic.php?p=1022564#p1022564
Grin/ASI Collaboration: the PhaseRunner (influenced by Justin's 2008 controller)
https://endless-sphere.com/forums/viewtopic.php?f=31&t=65031
Open Source STM8 Controller Firmware Project
https://endless-sphere.com/forums/viewtopic.php?f=30&t=87870