Update: Brain Box
Okay time for an update. I have been working very hard at getting this all running, with all the features I would like and it is turning out better than I had hoped for. I am seriously running into memory limits of the hardware, but the feature set is very rich.
For the Alpha prototypes I will only be making a version with an 8x2 LCD designed for my friction drive. Later I might do other varients, with hall/pot throttle input, 16x2 display, etc.
Here is the description of the Alpha BrainBox:
Main Features:
- LCD display
- button throttle
- fuel gauge: battery used, distance remaining, voltage etc
- normal bike computer stats: trip time, dist, speed max/avg, total dist, time etc.
- eBike computer stats: wh, average watts, wh/km etc.
- limits power via PID control loop,
- controls friction drive engagement/disengagement
- enforces minimum speed
- can enforce maximum speed, to stay legal, or improve efficiency
- can perform cruise control (PID speed control)
- datalogging to microSD card, trip summary and live data (~20Hz or less)
- speed, volt, current, and temp sensors
- user programmable on the bike via single button
Inputs:
- button throttle
- wheel sensor
- voltage/current sensor
- temperature sensor
- mini USB
Outputs:
- 8x2 LCD display in a compact enclosure
- ESC throttle signal
- SD datalogging
Button
- all programming and throttle functions performed by the single button
- throttle button allows selection of two user settable power levels, and cruise control while riding
- (ie. normal power, hold this speed, and turbo boost)
Display
- battery fuel gauge, speed & distance displayed when in motion
- when at rest can scroll through all other stats: dist travelled, dist remaining, Ride time, wh used, Batttery Voltage, Average Speed, Max Speed, wh/km, average power [watts], Temp [Celcius], Trip #, Total Dist, Total Time, Total kWh.
SD Datalogging - two different log files are created for each trip
(1) trip summary stats
--- automatically recorded to SD
--- same stats as those displayed on LCD
(2) trip live data readings automatically recorded at user settable data rate, ie. 20Hz or less
--- data file includes header with all user settings, software version, file name
--- data fields recorded are currrently: Time (secs),Watts,Throttle PWM,Throttle Mode,Speed,Distance Travelled, Calculated Distance Left, Ride Time (Mins),Battery (wh),Batttery (Volts), Temp (Celcius)
--- filename is automatically incremented for each trip
Menus:
- entered by holding down the button during startup
- allows adjusting power levels, speed limits, PID control loop parameters for power and speed, battery settings, log rates, wheel size, ESC throttle min/max, sensor calibration.
- allows resetting to default values if you stuff it up when tweaking
Wiring:
- currently I have hard wired everything I can.
- button throttle runs into the display enclosure mounted on the handlebars
- a single cable runs back to the shrink-wrapped uC that then has connection to ESC, battery sensors, wheel sensor, temp sensor
- this allows the uC, battery sensor, SD card, and USB connection to all be safely housed in the battery bag out of the elements.
- in the future I may change this to make quick removal of the battery possible.
Pictures
Here is a quick look at one of the units all wired up, on and off the bike.
View attachment 2
Here are all the connections from left to right
wheel sensor, temp sensor plug, battery volt/amp sensor, main uC with ESC throttle connection poking out the top, button throttle
View attachment 1
This is a close up of the Brains Box, at the left of the picture you can see the ESC throttle connection and the micro SD card slot, at the right is the mini USB port. At the bottom is the voltage/current sensor with Anderson PP45s, but deans T connectors work even better.
The main thing remaining for me is to decide on how I handle the battery gauge. Currently it is set to automatically reset the battery meter if the voltage goes above a threshold (checked when you first turn it on), then just uses watt-hours to judge battery capacity. I am trying this as I wanted it to automatically reset itself, and not require the user to reset it like a CA. But this is not foolproof. Another method would be to use the battery voltage (assuming LiPos) as I am only really using it for a crude battery capacity display, all power/efficiency calculation are performed on the more accurate wh used.
I have purchased enough parts to make 20 of these, and will soon be making them available. I will finalise the price once I know how much time they take me to put together, it will be in the ball park of a CA, but obviously with a lot more features.
- Adrian