Sudoku Solver Arduino
Sudoku Solver Arduino
by TechKiwiGadgets
Play, Create and Solve Sudoku puzzles using this This project includes a 3D printed case with only
easy to build Arduino based project. seven components including a USB rechargeable
battery so is does not require a high degree of
Simple to use with a touch screen and stylus the unit electronics experience to complete.
comes preloaded with Sudoku puzzles to play, a help
feature to highlight incorrect values and an automated
Years ago, just for fun, I wrote an excel macro to solve Sudoku Puzzles on a desktop computer. It occurred to me
that this could be incorporated into an Arduino Touch Screen device. The perfect fit for this was an Arduino Uno
and a compatible 2.8 inch TFT touch screen shield.
Arduino Uno R3
2.8 inch TFT Touch LCD screen
Li-Po Rechargeable Battery 600mAh 3.7v (30mm x 50mm x 6mm maximum physical dimensions)
TP4056 Lithium Battery Charger Board Micro USB
Hookup wire
Access to a 3D printer with a minimum 160mm x 70mm x 30mm build capacity
3.3K 1/8 watt resistor
Small SPDT Switch ON-Off Miniature Slide Toggle Switch
https://youtu.be/qILoUzuI6ak
The 3D case was printed with White PLA with each Supports: Enabled
part oriented so that Lid and Base are facing upwards
using the following settings Nozzle Temperature: 210 Degrees
Layer Height: 0.2mm The 3D Model Files are located here on Thingiverse
with the touch screen stylus inserts into a cavity
Speed: 40mm/s under the Arduino PCB and can be removed by
sliding out with your finger.
Nozzle Diameter: 0.4mm
The best place to start is to connect the Arduino Uno with the TFT screen and test the screen. I have subsequently
found there are various screens available that have different drivers or settings so here is my recommended
approach.
Carefully align the Arduino Uno and TFT screen pins and ensure they are oriented correctly. In the picture
provided, you can see the correct alignment including the noticeable gaps in the Uno and TFT screen pins that
help with alignment.
The code requires the following three libraries to be loaded into the Arduino IDE to enable it to work
TFT LCD Screens come with different control chipsets and touchscreen setups. I had quite a challenge with this
particular model getting it working and had to make a number of configuration changes before I could get it working
satisfactorily.
Fortunately, Adafruit has provided a variety of options to deal with these challenges however you may find some
issues you may have to deal with.
Test that the colours and touch locations of the touch screen are consistent with the video and pictures provided.
If the screen is not working then you may need to change the screen type in the code to ensure
correct operation.
If the touch locations are incorrect then row 218 of the code provides test coordinate data which can
be used with Row 39 min/max settings for touch accuracy.
If the colours are incorrect check they can be changed after row 60 of the code
If the orientation of the screen is in portrait then row 105 in code can be adjusted
I have also included a version of code for the standard ILI9314 display
Download
https://www.instructables.com/ORIG/FJW/ZFXY/K30YC3NF/FJWZFXYK30YC3NF.zip
…
Lithium Polymer batteries require a current limiting Make sure all joints are well soldered and any
charging circuit to avoid overcharging and damage. exposed joints are insulated so that there is no
The standard TP4056 is set to allow up to 1Amp of chance of shorting them to other components.
charge current into a 3.6v battery.
Test the battery is charging correctly by connecting
This needs to be changed to below 600mA for this the unit to a USB charger through the USB port on
battery and so the existing surface mount resistor the TP4056 board. If working correctly the RED LED
needs replacing with a 3.3K resistor. should light indicating the unit is charging.
*** NOTE: This is important as connecting to a USB When the battery is fully charged the RED LED
port without considering charge current will damage should go out and the BLUE LED should light.
the battery and possibly cause an electrical fire. ***
If the charger does not operate like this then you need
Fortunately, this is a relatively painless process of to troubleshoot the issue and resolve before
heating the surface mount resistor and then pulling off proceeding.
with pliers.
3. Install the Slide Switch
Then soldering the 3.3K resistor from GND terminal
to Pin 2 of the TP4056 IC. Further discussion on the Solder hookup wire to the slide switch as per the
technique can be found here circuit diagram and then position the switch into the
case and ensure it seats correctly. Use a tiny amount
of hot glue to fasten the switch in position firmly within 6. Mount the components into the Case
its mounting position.
Carefully arrange the Arduino and Screen in the
4. Connect the Charger to the Arduino Uno Case. Position the Battery, wiring and switch and
close the lid to check there are no obstructions.
Using a soldering Iron carefully connect the Arduino
Uno Ground Pin and 5V pins to the output of the Check that the screen is mounted squarely in the unit
TP4056 PCB by checking the full display can be seen when
powered up through the lid aperture.
5. Mount the Battery Charging Circuit
Use hot glue to fasten the Arduino Uno into the
Position the TP4056 PCB in the lid of the case as per correct final position.
the photo provided. Connect a USB plug into the
PCB to hold it in position and check that it is charging Carefully apply hot glue to fasten the case in place.
correctly. Use hot glue to fasten the TP4056 PCB to Now you are ready to play Sudoku.
the LID while ensuring the USB socket is not covered
in glue.
There are four buttons on the Sudoku Solver that As you progress you can use the Help button to
have different functions which can be used to Play, validate any changes.
Create, Learn and Solve Sudoku Puzzles
3. Help Button
1. Home Button - Create or Solve Puzzles
This will progressively check all squares in the puzzle
This is a blank Sudoku screen enabling you to and highlight for half a second any conflicts in RED.
progressively change all locations and create your Very useful when you are unsure of changes.
own Sudoku Puzzle. It can also be used to manually
enter an unsolved puzzle that you want to validate 4. Solve Button
with the "Help" button or solve using the "Solve"
button. This button will attempt to apply 4 formulae to solve
the current Puzzle in the Solver. It has proven to
2. Play Button solve all "Easy", "Medium" and up to and including
most "Hard" level rated Sudoku puzzles. It will not
There are 5 preloaded Sudoku puzzles in the code completely resolve all Sudoku puzzles however it will
that are of varying degrees of difficulty from easy to give you a good start. Which is good because we
difficult which means you can instantly get started on dont want to take all the fun out of the game!
solving a puzzle.
Now over to you to solve some Sudoku Puzzles!!!
The Solve button will instantly resolve 4 out of 5 of
these puzzles however not the 5th!!
https://youtu.be/va1_v-QfxsY
Very neat :D!! I am a big fan of Sudoku. Thank you for sharing :)
Hey Ive just put the link in for this. Let me know if you need any assistance
This is super clever! What program did you design the case in?
Thanks was ms 3d builder. In hindsight Id use a better 3d design tool to get better definition in the
stl.