DIY Electric Bike Battery Box With Card Access

1,288

17

2

Introduction: DIY Electric Bike Battery Box With Card Access

About: Year 12 Student

Building an electric vehicle has been something that I have been wanting to do for a while but had never really got round to it. Lockdown gave me the time to try and build one.

I decided on building an electric bike as it seemed to be a good, well documented place to start. It would also be helpful for getting me to school and back.

In this Instructable I will explain my process for building the battery/speed-controlling box, hopefully you will get something out of it!

Note: although my Instructable talks about specific parts (the parts I used for my box), I will also talk about how they could be swapped out for others.

Supplies

  • Arduino Uno
  • 24 volt battery
  • Speed controller
  • Throttle
  • 24 volt motor
  • RFID MFRC RC522 module with card
  • 5v relay
  • Step down buck voltage regulator
  • Switch/s
  • 0-50v voltmeter
  • Connectors, wires and solder
  • 3d printer

Step 1: Component Overview

Arduino - Powers and monitors the RFID scanner and relay.

Voltage regulator - Makes sure that the Arduino is getting the correct amount of voltage from the battery.

Electronic speed controller (ESC) - Takes the power from battery, combines it with info from the throttle to supply the correct amount of power to the motor.

Relay - Electromechanical switch that is controlled by the Arduino.

RFID MFRC RC522 Module - Senses a card using RFID technology.

Battery - supplies power to the speed controller and Arduino.

Voltmeter - Allows for monitoring of the batteries voltage. As lithium ion batteries drop in voltage depending on how charged up they are, this allows you to tell how much ride time you have left.

Switches - For turning it on and off (you can also add bypass switches for the RFID Arduino circuit).

Step 2: Choosing the Battery

For this application I would recommend the use of lithium ion battery packs. I have outlined some of the reasons below. The main factor for me was that I wanted this pack to be relatively small so that I could fit it in my backpack while at school.

Pros:

  1. High discharge rate.
  2. Smaller and lighter than alternatives (e.g. lead acid).
  3. Available in different sizes.

Cons:

  1. Can be damaged by running them flat.
  2. More expensive (although this all relative).

Regarding the voltage required from the battery, I went for a 7s4p (7 cells in series, 4 in parallel) 24v battery. I chose this, as motor I was using was 250w 24v (the legal UK limit). The battery could also discharge at least 11 amps (volts * amps = watts).

I got my battery of Aliepress as they were more available and cheaper. This did, however, mean that I had to wait for a significant number of weeks for shipping.

https://www.aliexpress.com/item/33013996613.html?spm=a2g0s.9042311.0.0.68814c4dCVyDB9

Step 3: Choosing the Speed Controller

The speed controller is used to control the power output for the motor.

Finding a speed controller is fairly easy. You just have to make sure that it is designed for the right voltage and amperage you will be using.

The one I bought came with the motor and a throttle.

Step 4: Card Access

This project uses an Arduino to control the RFID scanner.

The Arduino can be coded to accept certain cards.

When the correct card is placed onto the scanner, the Arduino sends out a signal to the relay (electromechanical switch), which then allows electricity to flow to the motor.

Turning off the box or touching the scanner again will turn the relay off again.

This is discussed further in the code section.

Step 5: Powering the Arduino

The Arduino then powers the relay and RFID module.

The Arduino can be powered through 5v into it's Vin. To get this from the battery we can connect it in parallel with the battery. The problem is, the battery will be supplying 30-20v (depending on how charged up it is). To solve this problem we can use a voltage regulator.

This utilizes a step down buck converter circuit.

I have attached pictures of 2 variants. The first has buttons and a LED segment display to allow you see and monitor the input and output voltages easily. The second variant is cheaper but does not have this display so you have to use a voltmeter on the output end to see what you are getting. The little screw on the top of that blue box allows you to adjust the output voltage to 5v.

Note: these are able to handle the amperage that the Arduino part of the circuit draws however make sure to not connect them the wrong way round as they do not have any diodes and get damaged by negative polarity (I learnt this the hard way).

Step 6: Circuit Design

The picture above explains where everything is connected.

Things to clarify:

- Each three of the switches has a different purpose:

  1. Turns whole circuit on/off (top left)
  2. Turns Arduino part of the circuit on/off (top right)
  3. Overrides the relay

The last two switches aren't technically necessary but I included them as an override to the Arduino override circuit, in case anything were to go wrong while cycling. These switches can be buried deep within the battery box, however, so it is unlikely anyone while be messing with them.

When I have a voltmeter on the circuit diagram, I am not talking about a large one with lots of different settings, I am talking about the small seven segment display ones that can be purchased for a couple of pounds (pic attached). Again, this is used to measure how charged up the battery is.

Step 7: Designing and Printing the Case

To design the case I used Fusion 360 as it is free to download and quite intuitive. Although your case will have to be different depending on the sizes of the parts that you get, I do have some points to bear in mind.

  • If you want the case to be located in the middle of the frame, make sure that it is not too wide otherwise you will hit it with your legs when pedaling.
  • Make sure the on/off switch and voltmeter are in easily accessible places, ideally on the top.
  • Try to design it so that it is removable; make sure that the throttle and motor cables are easy to connect and remove from the box (xt60 connectors seem to work well for this). Making the box removable means that it is easier to charge and if you are leaving your bike somewhere you can take the box with you as it is otherwise at risk of being stolen.
  • I recommend the use of magnets if you want to have removable panels or storage compartments as hinges and joints are more likely to break.

Step 8: Code

Connect up RFID Arduino pins:

  • Gnd - Gnd
  • 3.3v - 3.3v
  • 9 - RST
  • 10 - SDA
  • 11 - MOSI
  • 12 - MISO
  • 13 - SCK
  • Unconnected - IRQ

This tutorial gives a good overview of how to use this RFID module: RFID Tutorial

Connect up the Relay Arduino pins:

  • 5 - 5v
  • Gnd - Gnd

The code I created is attached.

To summarize what is going on in the code:

  1. It checks the RFID scanner.
  2. If the correct card is present and the relay is off, it turns the relay on (switching on power to the motor).
  3. If the correct card is scanned again and the relay is on, the relay is turned off.

Step 9: Wiring Up the Rest of the Circuit

Once everything is printed you can then solder the circuit together and glue the 3d-printed parts together using Superglue. Make sure you double check the circuit before connecting it up as 24v+ can lead to some serious sparks and potential electrocution. Also, try not to glue your fingers together.

Step 10: Finished!

Slide it onto your bike and ride away!

Bikes Challenge

Participated in the
Bikes Challenge

Be the First to Share

    Recommendations

    • Pets Challenge

      Pets Challenge
    • Fandom Contest

      Fandom Contest
    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge

    2 Comments

    0
    ChristianBG
    ChristianBG

    Reply 9 months ago

    Thank you!