Math Teaching Game
My younger brother is in 3rd grade and is falling behind in his Math class. He has a very short attention span and so, I've been trying to find fun and engaging ways to have him practice, And so, this project came to life.
In this instructable I will show you how I made this fun and engaging project.
Please note that there is a lot of room for personalization and it is greatly encouraged, hopefully my relatively simple demo will give inspiration and life to many more creative ideas.
Most importantly, have fun. :)
Supplies
Electronics
- ESP 32 dev module ( This is the microcontroler I am using ).
- ESP 32 I/O sheild ( optional ).
- Joystick Module
- Speaker
- MAX 98357A ( used for audio ).
- MG90S ( servo motor ).
- HX1838 ( IR Recieverr kit with remote ).
- LED strip ( any kind with data should work, I am using a 12 long strip for this project ).
- Battery pack
Other Supplies
- Some cardboard box sufficiently large to house the electronics
- Box cutter or Scissors
- Paint
- Hot glue gun
- Baking paper
- Tooth pick or Stick
Note that all Other Supplies are compleately optional.
In addition the Joystick is only used as a button but I don't have a regular button so feel free to use a button if you have one.
Circuit
Circuit
- Joystick Module - I/O 19
- MAX 98357A
- LRC - I/O 25
- BLK - I/O 26
- DIN - I/O 22
- MG90S ( servo motor ). - I/O 23
- HX1838 ( IR Recieverr ). - I/O 15
- LED strip - I/O 17
Note that the speaker connects to the MAX 98357A.
Also note that every module should connect to 3.3v and GND ( ground ).
You may choose pretty much any I/O pins, if you choose different I/O pins than the ones I chose you will need to edit the code accordingly, ( I have left comments in the relevant places ).
ESP32 Code
download the provided code and mp3 files.
you may also, find mp3 files to use for sound effects ( correct.mp3, wrong.mp3, win.mp3 ). or use the provided ones. If you do choose to use your own, make sure to give them the same names as above.
Note that MathCode.ino should be on the same level as a folder named data which contains the mp3 files, all of which should be inside a folder named MathCode. ( I would upload the folder as is but it is unfortunately not supported by instructables ).
Wifi
In the code change the ssid, and pass, variables to your network id ( name ) and password respectively, then upload the sketch and open the serial monitor. A message confirming you are connected to the network should be printed.
IR Reciever
Depending on your hardware the signals coming from your IR Remote may differ from mine, therefore, to ensure your remote preforms as intended, upload the software to your board and observe the serial monitor. then, press the buttons on your remote and write down the codes printed in the serial monitor.
Then, you will find in the code, the cases refering to each code, make sure to set the codes according to the values you got.
Sheets
For this project I am using 2 google sheets. Go ahead and create two empty google sheets.
One of them will store problems and solutions, and the other will store a point balance.
In the balance sheet set the A1 cell to 0. This will be the balance of the user.
Make
For this project I used make.com
If you are not familiar with it there is no need to worry it is quite simple and user friendly.
I have 2 scenarios running, the first is Get Problem. This scenario is responsible for getting a problem and solution from the problems google sheet, sending the problem to a phone and the solution to the ESP32 when requested via a webhook.
The second is Update Balance. This scenario is responsible for updating the balance in the balance google sheet and returning it to the board, when a request is made it should have a value which represents the number of points to add.
You may need to connect your google account to make.
Also, I chose a telegram bot to deliver the problems to a phone, however you may use any type of service.
Make Scenario - Get Problem
First, we create a Custom webhook node, click Add -> Save -> Copy adress to clipboard. Then paste into your browser. This url will be the one make.com listens to so you will need to place the url in the arduino code provided in the appropriate place, there is a comment referencing where to paste your url in the code.
Second, create a google sheets - Get Range Values node and connect it to your problems sheet. then select the range A1:B1.
Third, create a router node.
Fourth, add a Telegram Bot - Send a Text Message or a Reply node, to set this up i recommend following https://www.make.com/en/help/app/telegram-bot this guide, send the problem as a message.
Fifth, create the Webhook response node, in the Body section enter the solution cell.
Make Scenario - Update Balance
First, we once again create a Custom webhook node, as in the last step copy the url to you clipboard and paste it into the relevant part in the arduino code, however this time before pasting it into the browser, append the string "inc=10" to the url. This will configure the webhook such that it expects an inc value.
Second set up a google sheets - Get a Cell node, connect your balance google sheet, and select the cell A1.
Third, set up a google sheets - Update a Cell node and connect your balance google sheet, select cell A1. In the value feild enter the sum of the value and inc.
Fourth, set up a Webhook response node and respond with that same sum of the value and inc.
Problems
At this point you should be set up to test your device by entering problems manually to the google sheets.
Run your two scenarios on make and if you are using a mobile hotspot as a wifi point turn that on too.
Turn on your ESP32 and try it out.
Now if you'd like, you can use your favorite programming language that supports the google sheets API to pereiodically generate problems and put them in the problems sheet for you.
For this project I used a python script that generates order of operations problems. Feel free to use the provided python code as a template or as is.
Note that you will need to set up the google sheets API, and create your own credentials.jason file which is the only file not provided.
Build a Box
Find a box that is sizable enough to contain the parts.
Then, cut some holes to fit your speaker, servo motor, IR reciever, LED strip and Joystick.
For the LED strip I recommend placing it about an inch inside the box away from the hole and using parchment paper to diffuse the light for a nice effect.
Customize
If all went well, you should have a working version of the project but why stop here?
Fell free to customize your problems, point system, rewards, pysical appearence, etc...
I hope you enjoyed this project if you decided to make it, regardless thanks for taking the time :)
Dylan.