Typing Coach (CTAI Howest)
by BaetensJeffrey in Circuits > Raspberry Pi
21 Views, 0 Favorites, 0 Comments
Typing Coach (CTAI Howest)
Do you want to learn how to type properly on a keyboard or do you want to help someone learn? Do you not want to go to boring lesson or you don't have time for that? This product is for you if that is the case.
The typing coach is an ai device that the moment you press a key it checks if you are using the correct finger for that key. If you are not using the correct finger it'll start flashing red at you and keep a steady green light as long as you are doing well.
Supplies
Most important supplies:
- Raspberry pi 5
- Ring light
- Screen (OLED or LCD)
- Camera
- Active cooler
- Power supply
- Jumper cables
- Button
Can do without supplies:
- Second ring light
- Brightness sensor
- RFID
Extra supplies:
- USB A to USB A extension cord
- Resistors
- Soldering iron
- Cables
- Screwdriver
- Screws
- Wood
- Sanding paper (a rough one and a smoother one )
The price should be € 306 if you don't need more supplies then listed in the file below. It can be the prices may change before you start this project because of the economy.
Downloads
Make Sure You Have Every Bit of Software and Hardware
The first thing you need to do is installing everything you need to work on this project or have something that is similar. The software you need is Visual Studio Code and Fusion 360. Make sure you have everything from the Bill of materials or at least everything you need and if you want to use other hardware go ahead but be sure to change the code a bit later on. It can be that you'll need to change the design because it doesn't work for your setup. I used wood to make legs for this build so that could be extra materials you need.
The links for where you can download the software:
https://code.visualstudio.com/download?_exp_download=fb315fc982
https://www.autodesk.com/products/fusion-360/personal-download
Other helpful link:
Change the Build for Your Setup
All files below are to be used with a laptop (15 inch screen). Open fusion 360 or any other CAD program and open the stl files below and change them to your needs or take inspiration from it. Print the files with a 3D printer out of PLA or if you need other material get those. If you want you can make it out of wood or lasercut it. I used PLA to print it because that was the most convenient for me. Then try making an assembly of what you drew because it'll make you better understand your build and less likely to have made a mistake. There are holes missing for screws and the brightness sensor. I forgot to add a hole for the brightness sensor and the other one is because I was using freeCAD or because the holes weren't predictable where they should be. It's always possible to add holes with a drill or just screw the screw through the PLA.
Downloads
Make Sure What You Made Is High Enough
After making the build test with the camera if it's high enough otherwise add something to make it higher. So to activate the camera you should open the terminal (press ctr and ` that's the shortcut) in Visual Studio code (make sure you are in the repository folder shared at the top and make sure you are working on the raspberry pi). Copy [cd RPi] into the terminal hit enter then in the same terminal copy [python typing_coach.py]. Place the structure you build behind the laptop with the pole in the middle of the screen and then make sure you can see the complete keyboard on screen. Place boxes or something underneath to make it high enough and afterwards make the legs as high as that of the stacked boxes. If you are using my design or improved it, add four wooden legs of 180 mm high under the plate on each corner and add them like on the picture. If you changed my design well you'll have to figure something out for the height or maybe even how to test it with the camera.
Cabling
When mounting the sensors and actuators to their designated locations is finished and everything has been soldered. Follow the in map below to see where which cable goes. If two wires need to be on the same pin then make a connection from the raspberry pi to the breadboard with a wire and attach those on the breadboard (+5V, +3V3, GND, SCL 1 and SDA 1). To initialize the two ring lights go to the terminal again and paste [sudo dtoverlay spi1-1cs] and after [sudo dtoverlay spi5-1cs] and then [ls /dev/spidev*] and then spidev1.0 and spidev5.0 should appear.
Raspberry pi pin layout when the USB connections and ethernet connection is towards you:
- +3V3 | +5V
- SDA 1 | +5V
- SCL 1 | GND
- GPIO 4 | GPIO 14
- GND | GPIO 15
- GPIO 17 | GPIO 18
- GPIO 27 | GND
- GPIO 22 | GPIO 23
- +3V3 | GPIO 24
- GPIO 10 | GND
- GPIO 9 | GPIO 25
- GPIO 11 | GPIO 8
- GND | GPIO 7
- GPIO 0 | GPIO 1
- GPIO 5 | GND
- GPIO 6 | GPIO 12
- GPIO 13 | GND
- GPIO 19 | GPIO 16
- GPIO 26 | GPIO 20
- GND | GPIO 21
Each component the pins I used (from my bill of materials):
- Brightness sensor:
- VCC = +5V
- SCL = SCL 1
- DAT =SDA 1
- GND = GND
- ADDR = GND
- OLED:
- GND = GND
- VCC = +3V3
- SCL = SCL 1
- SDA = SDA 1
- Button:
- V = +3V3
- G = GND
- S = GPIO 17
- RFID:
- SDA = GPIO 8
- SCK = GPIO 11
- MOSI = GPIO 10
- MISO = GPIO
- IRQ = nothing
- GND = GND
- RST = GPIO 25
- 3V3 = +3V3
- Ring light 1:
- DI = GPIO 14
- 5V = +5V
- GND = GND
- DO = nothing
- Ring light 2:
- DI = GPIO 20
- 5V = +5V
- GND = GND
- DO = nothing
Collecting Data to Train the Model
So in the file capture_on_keypress.py you see a path in that file like this "~/2025-26-projectone-ctai-BaetensJeffr/RPi/TRAIN/right_index" activate the file by putting [python capture_on_keypress.py] into the terminal. Taking the pictures is easy just put the build in the same position as for testing the camera and then press the keys designated for that finger with the correct posture or let someone that knows how to type properly press the keys. Make sure that you stop the code after you have taken pictures for one class and change the path to the next class, save it and rerun the code again. Keep doing that until you have 1000 pictures in each class or do 150 to 200 for each class and go into the explorer, copy every picture and paste until you have around a 1000 pictures of each class. Now go to the left and select the TRAIN folder where the class folders is in then do a right click and then select the option download. Place the folder where you'll remember where you put it on your pc.
https://github.com/howest-mct/2025-26-projectone-ctai-BaetensJeffrey.git
Annotation and Training
Train your model by putting the folder that you just downloaded into the repository and then Laptop folder/type-2-project-typing-BaetensJeffrey/AI/TRAIN and replace the TRAIN folder in the TRAIN folder with the downloaded one. After doing that go to the hand_landmarks-1.ipynb file and open it. The cells you should run are also marked in the comments.
Place the Model Into the Correct Folder
After training the model copy the files hand_landmarks.plk and hand_landmarks.csv from Laptop/type-2-project-typing-BaetensJeffrey/AI and paste them on the raspberry pi into the folder /RPi/ai folder and Laptop/type-2-project-typing-BaetensJeffrey/AI.
Run the Model on the Gradio
So in the terminal paste [cd RPi] and then paste [python typing_coach.py] test everything out and then you can register and start learning. The start.sh should make the database go online and the website also. Remember this is a project that needs more improvement and is being worked on.