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

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…


(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!

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.

6 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?


  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.


    • 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 !!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: