Maintanence

How do you unlock a Bafang e-bike display when you have forgotten the secuirty pin?

If you find this article useful and you would like to support the work we do as an All Ability Cycling charity please consider sending us a small domain via our PayPal Charity fund page.

So I wanted to upgrade my Bafang ebike display to the new full colour DPC-14 version, but at arround £85 + shipping , its was a bit on the pricey side. Luckily what should i spot on eBay but a second hang one for a much more acceptable £25 delivered.

Whats the catch? well its working fine but the owner has forgotten the 4 digit pin needed to unlock it… hrm  ever one for a technical challenge I take a punt and buy it…

140

(not the actual controller)

This model display has a remote controller with three buttons that are used to select modes and increase or decrease the power assist,but before I can look at any of those functions I had to find a way to get past the security pin..

As there are only three buttons the way you enter the pin is a bit unusual. When the screen starts you are presented with 0000 and have 10 seconds to attempt to  enter a valid pin. You must use the up  and down buttons to select each digit in turn and the mode button to move onto the next digit. When the final digit is entered if its correct the screen is unlocked. If not it’s reset to 0000 again and you get a second try. a slow process by hand.

Now I tried all the usual obvious numbers I could think of ( 0000, 1234, 8008 etc), but after about an hour of getting sore fingers I decided to bring out the technology and build a device to help.

What I needed was a way to automate the pressing of buttons. The quick hack I decided to use was to use an Arduino microprocessor and a set or relays to interface with the existing switches. I then needed to write a simple program to start at 0000 and manually click each switch in turn to simulate entering each pin in turn. After a few attempts and tweaking the code I could enter any pin in about 5 seconds.
So I should be able to try every combination within a couple of days if I leave it running. I can wait that long, but how will I know if it’s successful?. I mean I won’t spend 2 days looking at the screen so even if it does get the right combination. It will just carry on merrily pressing buttons. At this point I was a bit luckily. The screen lock had a black background but after looking at videos of working displays I could see that once you get into the main screen the background was white. If I could detect this screen change I would know if the pin was correct or not.

So into the parts bin I go and pull out a light sensor (LDR) by linking this to the Arduino. I now could read a light level of the screen and if that reading was high enough I could assume the screen was white and therefore the pin was correct raise the alarm and stop trying.

As this was a quick hack I sent the pin being tried and the light level to a pc where I could log it into a file to check later.

So off it went…

Ok it took a good  24 hours, but sure enough .

Ping 9100, and I’m in!

First thing I do is turn off the pin option! happy days.

Update: here is the Arduino .ino file I hacked together in a hurry if you want to build this. warning very hacked code with plenty of room for improvement!  password-checker.zip

Hi, I am one of the trustees of Empowered people. As well as looking after this website, I am also an ebike builder, modifier, hacker, and general bike mechanic. I have been involved with the Charity since 2015 and participate in as many rides as I can with my wife Catherine on the 'Bike Train' if you look around the website you are sure to find me in the background somewhere.

9 comments on “How do you unlock a Bafang e-bike display when you have forgotten the secuirty pin?

  1. Hi, brilliant use of arduino.
    I have the same issue but on my own bike.
    Are you able to share your ino file?

    Like

  2. Man, this post of yours was a life saver! Forgot the password on mine (DPC-18 display) and your quick and dirty code was the perfect starting point to do similar for mine, since the code input sequence is a little bit different on mine. Thanks! If you or somebody else is interested, I could send the file via email.

    Like

    • Manish Shrestha

      I am having same problem with mine DPC 18 , was playing with the display and forgot the pass code …. would you be able to post the code you made for yours, I will try to unlock mine ,,,,, please help !!

      Like

    • Yves Lacombe

      I’m no expert and have a hard time unerstand how you did this. How did you connect your display to your computor to download the Arduino .ino file.  

      Like

  3. Hi,
    I have brand new e bike with M5 Lcd,
    I cant seem to enter security pin setting to set a pin up,
    When the e bike came the lcd was already configured to ride with decent pas settings,
    But i want my own security pin for security obviously?
    Anyone have the answer ?
    Yes i have tried the press up and down buttons, this just takes me into P settings 1-20
    Many thanks

    Like

  4. Is it possible to fix this issue by changing the meter to a different brand or different model ?

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.