Typing Coach (CTAI Howest)

by BaetensJeffrey in Circuits > Raspberry Pi

21 Views, 0 Favorites, 0 Comments

Typing Coach (CTAI Howest)

main.jpg

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:

  1. Raspberry pi 5
  2. Ring light
  3. Screen (OLED or LCD)
  4. Camera
  5. Active cooler
  6. Power supply
  7. Jumper cables
  8. Button

Can do without supplies:

  1. Second ring light
  2. Brightness sensor
  3. RFID

Extra supplies:

  1. USB A to USB A extension cord
  2. Resistors
  3. Soldering iron
  4. Cables
  5. Screwdriver
  6. Screws
  7. Wood
  8. 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.

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:

https://code.visualstudio.com/docs/setup/windows

Change the Build for Your Setup

back_view.jpg
top_view.jpg
under_pole.jpg
button.jpg
oled_ring.jpg
rfid.jpg

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.

Make Sure What You Made Is High Enough

Schermafbeelding 2026-06-18 210319.png

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:

  1. +3V3 | +5V
  2. SDA 1 | +5V
  3. SCL 1 | GND
  4. GPIO 4 | GPIO 14
  5. GND | GPIO 15
  6. GPIO 17 | GPIO 18
  7. GPIO 27 | GND
  8. GPIO 22 | GPIO 23
  9. +3V3 | GPIO 24
  10. GPIO 10 | GND
  11. GPIO 9 | GPIO 25
  12. GPIO 11 | GPIO 8
  13. GND | GPIO 7
  14. GPIO 0 | GPIO 1
  15. GPIO 5 | GND
  16. GPIO 6 | GPIO 12
  17. GPIO 13 | GND
  18. GPIO 19 | GPIO 16
  19. GPIO 26 | GPIO 20
  20. GND | GPIO 21

Each component the pins I used (from my bill of materials):

  1. Brightness sensor:
  2. VCC = +5V
  3. SCL = SCL 1
  4. DAT =SDA 1
  5. GND = GND
  6. ADDR = GND
  7. OLED:
  8. GND = GND
  9. VCC = +3V3
  10. SCL = SCL 1
  11. SDA = SDA 1
  12. Button:
  13. V = +3V3
  14. G = GND
  15. S = GPIO 17
  16. RFID:
  17. SDA = GPIO 8
  18. SCK = GPIO 11
  19. MOSI = GPIO 10
  20. MISO = GPIO
  21. IRQ = nothing
  22. GND = GND
  23. RST = GPIO 25
  24. 3V3 = +3V3
  25. Ring light 1:
  26. DI = GPIO 14
  27. 5V = +5V
  28. GND = GND
  29. DO = nothing
  30. Ring light 2:
  31. DI = GPIO 20
  32. 5V = +5V
  33. GND = GND
  34. 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.