Open Authenticator

An Open Source TOTP based hardware authenticator using ESP32.

Public Chat
Similar projects worth following
An Open Source TOTP based hardware authenticator using ESP32. In layman's terms, this does what Google Authenticator or Authy does.

I was always amazed at these small devices. My dad uses these to log into his work laptop, I couldn't understand how can it generate a code without being connected to any network.

I fired up google and tried to search about it, and surprisingly it used a pretty amazing concept. It had a shared key with the server and then it did some computation on the shared key and current UTC time to get a 6-digit number. So, the remote device just had to be accurate at timekeeping. It uses a algorithm called TOTP (Time based one time password), it's been standardized and there's no point in getting into the details, here's the standard if anyone wants to take a look. You can read this article on for more layman-ish approach to the whole algorithm.

First Prototype

Coming back, so I decided to implement this using ESP32, because I had a devkit lying around, and the OLED and RTC libraries were solid, and I could use WiFi to get accurate time, which is absolutely need to generate the codes, here's a picture of the first prototype.

It worked fine, I used to generate a secret key from here, and then flash the esp32 with the new key and boom, it generated codes I wanted to (It was not as easy as it sounds, I had to spend days putting together a firmware to do it, and it was start of Covid-19 Lock down so I had a lot of free time).

Second Prototype

I wanted to take this to next level, make something like those RSA key id devices, but more configurable and not exactly use and throw like those and ESP32 was the right tool for it. So, I designed a PCB for the same. It was a long process, I had to handle my summer internship, finally by October I finished designing it and after getting it reviewed and rerouting again after two weeks, my PCB was ready to be ordered.

Thanks to guys at OSHpark, I got these PCBs for free, you can order it from here.

Order from OSH Park

Thanks to PCBway for sponsoring the PCBA of final prototype.
You can checkout the project on PCBway here:

Details of the device

  • Small form factor of 82mm x 42mm
  • Uses ESP32-WROOM-32D module
  • Uses 128x64 0.96" inch OLED module
  • Uses DS3231 RTC with battery backup (CR2032) for timekeeping
  • Powered by 3.7V 300 mAh LiPo battery
  • Uses MCP73831 for charging LiPo battery
  • Uses TPS63001 Buck Boost Converter IC for efficient 3.3V power supply, with input range from 1.8V - 5.5V
  • Uses TPS22919 Load switch to control power to OLED and RTC chip
  • Autoselect power source, i.e., battery or USB
  • USB Type-C for charging only (no data pins connected)


Schematics of the PCB

Adobe Portable Document Format - 182.60 kB - 01/21/2021 at 16:16


  • Finally time has come !

    Vedant Paranjape06/12/2021 at 09:33 0 comments

    After a long time, I feel great to say that. The design is done down to perfection. Here are some snaps with gorgeous yellow looking 3D Printed case.

    This case was designed using Fusion 360, it was super easy to get started. Soon this will launch on tindie for all those interested stay tuned :P

    3D files of the case will be open sourced soon, after a few finishing touches.

  • A Update on progress of this project

    Vedant Paranjape05/07/2021 at 12:27 0 comments

    A project log after so long, I was busy with academic commitments, so I couldn't log here. Sorry for the delay :)

    I am done with the firmware and going to launch on tindie for small quantity. Currently working on the 3d-case, here's some spoiler for you.

    Also, I have finalized logo for Open-Authenticator, let me know if you like it.

  • Testing the Final Design

    Vedant Paranjape03/15/2021 at 07:10 0 comments

    After I received the board, soldered the passive components on it. Checked for any shorts, there weren't any. Connected USB and flashed the firmware onto it, and it booted fine, except for one problem. The OLED was all white like this. I was not sure what the issue was.

    I rechecked all the solder joints, and it seemed fine. Likewise, I was puzzled as to what went wrong. So, just started fiddling with the reset button and power switch, and then by some random action it started working.

    Upon further investigation, I realized that there was some issue with the reset circuit. So, according to the data sheet, we need to hold the RES pin low while on power up to execute the reset on OLED, and then pull it high thereafter.

    So the core problem was that the RC Circuit on the reset. The value of capacitor and resistor was too small, so the time required for charging the cap was too small, as a result RES# pin was pulled low for only

    The Relevant circuit is C14 and R17, they form an RC circuit. So, after rumbling through the stock I had a dozen 310k resistors, plugged it into the equation.

    I hoped 31 ms might be enough to gracefully reset the OLED, and on testing it actually worked fine this time. Updated the schematics and board design on GitHub after this.

  • Fabrication of the new designs

    Vedant Paranjape03/03/2021 at 10:05 0 comments

    It's been a month since I had ordered PCBA for final prototypes from PCBWay, and finally they are being assembled. I was sent some snaps to verify, overall the board looks good, surprisingly even the silkscreen is decent enough. I still didn't like the HASL finish board, uneven pads are clearly visible, can't blame the manufacturer, the process itself is to blame.

    Some components are not soldered, as I have those in excess with me, didn't want to spend money on them when I can solder them at home relatively easily.

  • Finalizing the PCB design after a working prototype

    Vedant Paranjape02/01/2021 at 09:46 0 comments

    After getting the orders from OSHPark and assembling the board, I wrote simple apps to test all the functionality and it works like a charm. But there are certain issues in the current design, some of which to begin with are, using a OLED module, directly soldering battery wires, dirty looking silkscreen, no mouting holes, etc.

    As you can see, how thick it was. Almost like a brick. It is okay for a prototype but for a professional design, big no no. So went forward with using a OLED display panel rather than a module.

    Even the battery connector was awful, so swapped it with a JST-PH 2 pin connector. Moved the USB-C port further. Even the routing was a bit awful, fixed it and made the board look much better. Here are the final renders of the board.

    PCB render with 3d model

    PCB render without 3d models

    Thanks to PCBway for sponsoring this design, you can check out the project on PCBway site and order the PCB from there

  • Assembling the prototype boards

    Vedant Paranjape01/23/2021 at 15:08 0 comments

    After all the tools arrived required for soldering, it was time for some action. I started with applying solder paste on the board, since I didn't have a stencil, I used sewing needle to apply paste on to the pads, it was a cumbersome process and I had to wipe the board twice, but once I got the hang of it, all went good

    I was a bit worried about TPS63001 regulator, as it was the smallest with WSON package. Next I placed components on it one by one, and then turned on the makeshift reflow oven. Preheated it till it reached 100 C and then placed the board on sand, and let it cook for some time.

    As soon as the temperature reached 185, the solder started turning silvery, I let it be as such for a few minutes to make sure all joints were soldered appropriately. Then turned it off and let it cool for half a hour. Here's the final board, there were several bridges here and there, I removed all the visible ones using flux and solder wick.

    Solder bridges are visible if you look closely, check on the RTC chip, USB terminal and the WSON regulator (there's a small bead). These were easily fixed, but there was a demon sitting on the ESP32 and worst part is that it was not visible to the bare eye and hence I missed it. What followed was 2 days of hell debugging, as to why the ESP32 wasn't getting flashed. It went into boot mode, but as soon as bootloader was flashed it failed to write to the flash chip, reason being a solder bridge shorting pins in the bottom row. I had to clean it up and boom, it worked like that.

    Now, that ESP32 was working, I checked the other peripherals, buttons, battery charger and OLED worked fine. But the RTC just won't work, apparently reason being solder bridges on ESP32 side. But little did I know this, eventually found a short, SDA and SCL pins were shorted. So I removed the chip and replaced it, also removed the pull-up resistors, still it won't work, finally it clicked, the ESP32 side was shorted. The solder joints were invisible to eye, nevertheless, fixed it and it worked great. So, it took 3 days just to get working, only if I had used a stencil it would have been much better.

    Quickly developed a basic app, to test working of the RTC and OLED. It displayed the time and battery voltage that was read from the voltage divider.

    Yeah !! I assembled a 2nd board and this time, I got it running it just 2 hr.

    Follow my project for more updates :)

  • Selecting a makeshift Reflow oven

    Vedant Paranjape01/21/2021 at 17:07 0 comments

    As some of you might know, I am still a student and I have to manage costs of all these equipment/parts on a pocket money. Before doing this project, I was sure I won't be able to reflow soldering as I didn't have the skill nor did I have the money to buy costly reflow over or hot air guns. If the lockdown wasn't there I could just visit Lab in my university and my work would be done. I started looking for a cheap way to do it, and realised that reflow soldering is pretty straight forward. I thought I can simply heat the board to 190 C and it would work fine, and found a few lads doing this on youtube too.

    The tools used in these are pretty cheap, so basically I used a induction cooktop, old pan and some sand. I also bought a infrared temperature gun to have a crude temperature control. Please check below to see it in action

View all 7 project logs

Enjoy this project?



nerdu wrote 06/08/2022 at 12:54 point

please add power to this device. and a month working time on one charge

  Are you sure? yes | no

dugujuan wrote 10/03/2021 at 00:18 point

Hi,nice to meet you 

  Are you sure? yes | no

Xasin wrote 10/02/2021 at 22:47 point


This idea is really cute, and I was thinking of doing something similar with an upcoming project of mine (more as a side-idea, but it still involves generating a TOTP token)

Did you write an ESP IDF component to generate the token?
And does it perhaps use the secure ESP storage to prevent readout of the token (which would be a bit unnecessary for something like this, but certainly a fun practice in security :>)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates