So I have an idea of a habit builder (also I think it would be fun to build)
Essentially, one piece tracks the habit, and one piece unlocks doors (small, in a grid) based on habit trend. Inside each door would be a “prize”.
My question is about the small doors.
-
Is there an example of small unlocking like this I can use to expand to multiple doors?
-
The idea is there might be more doors than pins on the microcontroller. Is there a board I could put inbetween, or a special technique since they are on a grid, to accomplish this?
Read about multiplexing. There are various ways to achieve it, the easiest way is to just arrange it on a grid. Let’s say 5×5. So with 10 pins, you can address 25 doors. For the lock, the easiest would be a solenoid / magnetic lock. You can also use a motor, but that would require a more complex addressing to reverse the rotation for opening and closing
Edit for more clarity about the simple method: Think of every door as a solenoid connected to GND. You only need VCC to open it. You can use relay module to switch the row and column to connect the VCC of the solenoid. But you need to wire every solenoid in “AND” switch configuration so it only turns on if and only if both row and column switch are closed
An easy and cheap way to get more outputs from a microcontroller is to use a shift register such as a 74HC595. Each one has 8 outputs. You can connect the serial data output of one shift register to the input of another and chain together as many as you need.
For driving large numbers of solenoids, multiplexing would probably be the better option though.

