Electric Mini Bike

/media/uploads/mfoster44/minibike.jpg

Description

The goal of this project was to create a brushless electric mini bike using a recycled hub motor and add features to make it street legal and easy to use. We used an MBED and a relay board to control the devices on the bike. The MBED measures battery voltage as well as speed and displays it on the uLCD screen. Auto headlights was created using a photo-resistor to measure the light and decide when to turn the lights on.

Demo

Components

mBed Pinout

Power

PinRelay Board
VIN5V
GNDGND

Inputs

Pin #Component
p5Brake switch
p6Left blinker switch
p7Right Blinker switch
p1536V Battery Voltage
p16Photoresistor
p17RPM from Motor controller

Outputs to Relay board

Pin #Component
p21Rear Right Blinker
p22Rear Left Blinker
p23Front Right Blinker
p24Front Left Blinker
p25Headlight

LCD

Pin #Component
p9TX
p10RX
p11RST

Note: The 5V from the relay board was used to power LCD and Ground goes to GND.

Code

Import programmbed_bike

4180 Electric Bike

- RTOS used to control monitoring and lighting threads
- Blinkers and brakes controlled simultaneously with a mutex lock
- Information displayed on uLCD screen

Hardware Setup

/media/uploads/mfoster44/electrons.jpg

Push Buttons How to setup Pushbuttons

Using the Relay Board The relay board is controlled by connecting its logic pins to the logic ground. Since the mbed is 3.3V logic and the relay board is 5V, transistors must be used. A 2N3904 was used for every control signal going to the relay board.

/media/uploads/mfoster44/transistor_.png

The relay board also needs 12V from the converter to drive the relays.

Motor Controller The Motor Controller has readily available documentation on the internet for how to wire.

/media/uploads/mfoster44/motorcontroller.jpg

All of the security functions were ignored, power was wired directly to battery, and the "Electric Locks" was wired to the key switch.

Battery Monitoring A simple voltage divider circuit was used to scale the 36V down to a measurable 3.3V signal. 10M ohm resistor used on the top end and 2 1 M ohm resistors in parallel on the bottom side.

/media/uploads/mfoster44/voltage-divider.png

LCD Screen /media/uploads/mfoster44/lcd.jpg

Wheel Mounting

/media/uploads/mfoster44/hubmotor.jpg Tire is deflated to install and then re-inflated to allow them to not slip. /media/uploads/mfoster44/drivemechanism.jpg

Possible Improvements

Throttle Control: Currently, the throttle is controlled by a 5v potentiometer connected straight to the motor controller. We tried reading the potentiometer in to the mbed and using PWM to output to the controller the desired speed. The motor controller became very glitchy and did not cooperate with PWM. The analog out pin only goes to 3.3V, so we did not bother testing that. Some sort of DAC converter could be used to convert the PWM signal to an analog voltage which might satisfy the controller. This would allow us to include more features in the bike.

Speed Reading: The RPM output signal was measured on an oscilloscope and found to be a 36v square wave PWM signal, but is very noisy. We made a voltage divider circuit using 2 10 Mohm resistors on the top and a 1 Mohm resistor to ground. This gave us a signal we could measure on the mbed, but it was still too noisy and the amplitude was too low. A better filtering circuit would allow the signal to be read much nicer.


Please log in to post comments.