Back to Technical
Technical
ArduinoC++HardwareLearningRuby on RailsAI

From Rails to Wires: Building My First Arduino Focus Timer

•Zaneta Gebka

I spend most of my working days thinking about models, APIs, databases and whether a piece of code is going to become somebody else's problem six months from now.

Years ago, during the pandemic, I bought a Raspberry Pi, Arduino and a few more things. I did some small projects, but then I was lacking free time and forgot about it for years. Just life happened. I bet all of you know.

But for some reason it came back to me a few days ago. I opened that old box and started digging through it to see what was actually there.

I sat there thinking about what useful thing I could make for myself while trying something new.

And then it popped up. Pomodoro!

I started discussing the idea with an AI agent and we ended up with a plan. Since I already had an RFID module, buzzer, screen, Arduino Uno and a breadboard, I decided to make use of them.

The idea was that I, as a user, would tap my RFID card against the reader. Once it recognizes and authorizes me, it starts counting.

50 minutes of focusing on work without using my phone, browsing random things or doing all the other extremely important activities that somehow appear exactly when you are supposed to focus. Then a 10-minute break.

If I need to pause the focus session for some reason, I tap the card again. Another tap resumes it.

No app. Physical actions. A screen with a countdown and sounds when things start, pause or end.

Simple, yet powerful?

The idea

The first version is deliberately small.

It consists of:

  • an Arduino Uno,
  • an RC522 RFID reader,
  • a 16x2 LCD,
  • a buzzer,
  • a breadboard,
  • and a collection of wires, a lot of wires :D

The interaction is simple though.

When nothing is happening, the screen waits:

IDLE
Tap RFID

I tap the authorized card:

FOCUS
49:37

Tap it again:

PAUSED
37:21

Another tap and the countdown continues.

When the focus session finishes, the buzzer makes a sound and the device moves to the break:

BREAK
09:42

After the break, it goes back to IDLE. And if I tap some other RFID card?

Nothing happens.

I wanted the RFID part specifically because starting a focus session should require some physical action. Should FORCE you to make a step, push yourself to the decision "now its the time to focus".

I already spend enough time clicking things on screens. And no Pomodoro app worked for me. I decided I want to try something new.

Starting with hardware when you are a software developer

My experience is mostly in Ruby on Rails and web development, so Arduino was an interesting change of perspective.

Some things were completely new. For example, soldering. That requires some actual skills and keeping an eye on very hot things. It also requires checking whether you accidentally connected two pins together because you used too much solder. C++ was new to me too. Even though I used LLMs quite a lot while writing the code, it was still interesting to see how things are done differently.

Then there was connecting everything.

Which wire goes where? Why does this module need 3.3V while another one uses 5V? What are SDA, SCK, MOSI and MISO? Why does my RFID module say SDA when I'm actually using SPI?

And after connecting everything, there is another thing you don't normally have to do when working on a Rails application.

Compile the code. Send it to the device. Test it. Change something. Compile again. Send it again. Tap the card again.

And debugging?

In web development I can write a test, check logs, inspect a request or look at what happened in the database.

With Arduino, sometimes the debugging process ends with:

Was this wire actually connected correctly?

But you know what?

The first time I heard the buzzer make a sound because of the code I had just sent to the Arduino was cool. And having a chance to change the sound by modyfying frequency and lenght? Fun (of course I spent some time playing with it).

Surprisingly, a lot of it still feels like software

Once the components started communicating, the project suddenly became much more familiar.

The timer has four states:

enum class State {
  IDLE,
  WORKING,
  PAUSED,
  BREAK
};

And most of the device is really about moving between them.

IDLE
  |
  | RFID
  v
WORKING <----> PAUSED
  |
  | focus finished
  v
BREAK
  |
  | break finished
  v
IDLE

That part didn't feel particularly exotic. Something happens, I check the current state and decide what should happen next. I do that in web applications all the time.

The difference is what happens afterwards.

Instead of updating a database record or rendering another component, some text changes on a physical screen or a buzzer starts making noise on my desk. And I think that is one of the things I enjoy most about this project.

The result is very visible. And audible.

AI was useful, but I still wanted to understand it

I cannot say I know C++ and I definitely cannot say I know and remember how to connect all those things together. So yes, I used an LLM a lot.

I could probably have described the entire device, asked it to generate the code and then copied the result. Maybe it would even work. But that wasn't really the point of this project. I wanted to learn something.

So instead, I kept asking questions. Why this pin? What does SPI actually do? Why 3.3V here and 5V there? Why does this variable have to be unsigned long?

It was definitely faster than learning everything only from documentation and tutorials, especially when I didn't even know what I should be searching for yet. But it also left enough space to make mistakes. And there were mistakes.

At one point I had a focus timer where tapping the RFID card stopped the session, but tapping it again happily started a completely new 50-minute session instead of continuing from where I left off. Because of that my focus time was 1h 30m not 50m. Hurts!

Technically, the code did exactly what I told it to do. Unfortunately, that was not what I wanted it to do.

Fixing things like this was probably more useful than getting a perfect solution generated at the beginning. I had to think about what IDLE, WORKING, PAUSED and BREAK actually mean and how the device should behave when something happens in each state.

AI made getting into unfamiliar territory much easier, but I still had to understand the territory.

Where the project is now

At the moment, the prototype can recognize my RFID token, start a focus session, pause and resume it, count down the time, show the current state on the LCD and signal transitions with the buzzer.

After 50 minutes of focus it moves into a 10-minute break and eventually returns to the idle state. It still lives on a breadboard.

Which means calling it a finished device would be a little optimistic. Right now it is mostly an Arduino surrounded by wires, modules and the confidence that I still remember where everything is connected.

The next step is to test it properly and then move away from the breadboard.

That means more soldering.

I am simultaneously looking forward to it and very aware that software bugs are easier to fix when they aren't physically attached to something with molten metal. At least to me.

Why build it at all?

I could have downloaded a Pomodoro app in about thirty seconds. Building this took considerably longer. But that is also the point.

I didn't really need another timer. I wanted to build something outside of the environment I work with every day and learn how software interacts with actual physical components. Just for fun. Even if mostly with AI it was refreshing. And reminded me why I choose programming few years ago.

After years of building things that eventually appear in a browser, there is something very satisfying about changing a piece of code and immediately seeing something happen on the desk in front of me. Something I can touch.

The screen changes. The RFID reader reacts. The buzzer makes a sound.

Sometimes nothing happens and I discover that one wire is in the wrong place.

And somehow that is fun too.

The project is simple. It is not going to change the world and there are definitely easier ways to count 50 minutes. And for sure if I want to spend more time with Arduino that means I need to learn how to properly connect wires without asking LLM for that every time.

But it made me open a box of electronics that had been sitting untouched for years and start learning something completely different again.

For me, that was enough reason to build it. For now with a lot of help of AI, but I have a plan - to create more things like this, and slowly understand more and more, so after time I can say - AI is helpful, but I can do it without it as well. Thats the plan.

I know, I have many plans, but trying different things still keeps me on the side of programming where I am happy with doing it.