0% found this document useful (0 votes)
115 views

Hidden Maze Mapper - Arduino Project Hub

Uploaded by

Phops Freal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

Hidden Maze Mapper - Arduino Project Hub

Uploaded by

Phops Freal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Sign In (https://www.hackster.io/users/auth/arduino?

current_site=arduino&setup=true&redirect_to=%2Fprojecthub%2Ffredrikstridsman%2Fhidden-
maze-mapper-95ca8c)

Hidden Maze Mapper © MIT


(http://opensource.org/licenses/MIT)

Ever got stuck on that super difficult hidden maze puzzle? Fear no more and
build yourself an automatic mapping device!

magnetometer (/projecthub/projects/tags/magnetometer)

sensor (/projecthub/projects/tags/sensor)
serial communication (/projecthub/projects/tags/serial+communication)

511 VIEWS 0 COMMENTS 2 RESPECTS

COMPONENTS AND SUPPLIES 

Arduino UNO & Genuino UNO


(/projecthub/products/buy/41?
× 1 
s=BAhJIhMzMzQ5NjIsUHJvamVjdAY
( (/proj (/projecthub/prod
6BkVG%0A)
/ ecthu ucts/buy/41?
p b/pro s=BAhJIhMzMzQ5
(/projecthub/pro
r ducts NjIsUHJvamVjdAY
ducts/buy/41?
o /buy/ 6BkVG%0A)
s=BAhJIhMzMzQ5
j 41?
NjIsUHJvamVjdAY
e s=BA
6BkVG%0A)
c hJIhM
t zMzQ
h 5NjIs
u UHJva
b mVjd
/ AY6B
p kVG%
r 0A)
o
d
u
c
t
s
/
b
u
y
/
4
4
1
?
s
=
B
A
h
JI
h
M
z
M
z
Q
5
N
jI
s
U
H
J
v
a
m
V
j
d
A
Y
6
B
k
V
G
%
0
A
)
Seeed Grove - 12-bit Magnetic
Rotary Position Sensor / Encoder ×
( 2 
(AS5600)
/ (/proj (/projecthub/prod
(/projecthub/products/buy/72606
p ecthu ucts/buy/72606?
?
r b/pro s=BAhJIhMzMzQ5
s=BAhJIhMzMzQ5NjIsUHJvamVjdAY
o ducts NjIsUHJvamVjdAY
6BkVG%0A)
j /buy/ 6BkVG%0A)
e 7260
c 6?
t s=BA
h hJIhM
u zMzQ
b 5NjIs
/ UHJva
p mVjd
r AY6B
o kVG%
d 0A)
u
c
t
s
/
b
u
y
/
7
2
6
0
6
?
s
=
B
A
h
h
JI
h
M
z
M
z
Q
5
N
jI
s
U
H
J
v
a
m
V
j
d
A
Y
6
B
k
V
G
%
0
A
)

ABOUT THIS PROJECT 

Oh, did I buy more stuff again


I purchased a few magnetic position sensors some time ago with the intention of using
them in another interesting project. Due to lack of time and inspiration that project is
still on hold. While cleaning up my desk the other day I saw the sensors and figured out I
should at least try them out. I never tried anything similar before, so new learnings
ahead!

Found a "problem" to solve!


In a parallel universe there are a lot of people interested in puzzles of all conceivable
kinds. One type of puzzle is the hidden cylindrical maze. There are many
implementations of these, ranging from cheap 3D-printed (example
(https://www.thingiverse.com/thing:2825763)) to exclusive machined metallic ones (like
REVOMAZE (https://www.revohq.co.uk/)). Due to the complexity of some of these
puzzles the solver will need to go beyond memory and start mapping the puzzle. The
mapping can be done in great many ways, most typically pen and paper together with
measuring rotation and translation.
As a puzzle and maker geek I saw an excellent opportunity to build an automated
mapping device!

Maze Mapping

The end result in all its glory...


I started out with OpenSCAD and though I was going to make a nice 3D-printed holder
for the puzzle and the magnetic encoders. It was fun for a little while, but then I got into
the devil in the details when figuring out how to encode the translation of the shaft.
Lego to the rescue! After a short excavation of the lego piles I found what I needed
instead.

This was a dead end

The CAD time was not completely in vain, I still needed small holders for magnets. You
see, obviously the magnetic encoders need to have the magnetic field be perpendicular
to the sensor. All small magnets I own are cylindrical and magnetized with North on one
face and South on the other. 3D-printer to the rescue!
 PREVIOUS • •
NEXT 

The Lego build was a simple ramp with a little sensor-car!

The sensor car!

The 3D-printed magnet holders distance the 8mm magnet 1mm from the sensor when it
is touching and this seems to work just fine. Now just put it all together:
 PREVIOUS • • •
NEXT 

Well, that was the whole build. Almost. There are of course a few more things to do...

The electronics & Arduino code


The Magnetic Rotary Position Sensor (https://www.seeedstudio.com/Grove-12-bit-
Magnetic-Rotary-Position-Sensor-AS5600-p-4192.html) uses I2C interface and is easy to
interface with. Plenty of example code available on the internet. But, there was a but.
To have to identical encoders connected I would need a I2C mulitiplexer as there is no
way to change the address of them and the Arduino only has one I2C bus available.
Bummer.
2 of these you want! And then you'll want some more!
:-)

Since I own no such multiplexer I started looking at building one, but then I figured there
must be a way to do I2C on regular GPIO pins? Yes, you can. SlowSoftI2CMaster
(https://github.com/felias-fogg/SlowSoftI2CMaster) to the rescue! 10 minutes later I
was reading both sensors from the Arduino Uno.
Electrical connection is too simple for a diagram. 3.3v and GND to both sensors, A2/A3 to
one and A4/A5 to the second (picked the Ax pins just because the default I2C pins are
A4/A5). Maybe there should be a pull-up resistor somewhere, but hey-it-works-tm. :-)
The code is on the Arduino is simple enough. Read the sensors, print on serial:

#include <SlowSoftI2CMaster.h>

SlowSoftI2CMaster si1 = SlowSoftI2CMaster(A4, A5, true);


SlowSoftI2CMaster si2 = SlowSoftI2CMaster(A2, A3, true);

#define I2C_7BITADDR 0x36 //AS5600

#define RAW_ANG_HI 0x0c


#define RAW_ANG_LO 0x0d

void setup(void) {
Serial.begin(115200);

if (!si1.i2c_init()) Serial.println("I2C init 1 failed");


if (!si2.i2c_init()) Serial.println("I2C init 2 failed");
}

int readAngle(SlowSoftI2CMaster si) {


if (!si.i2c_start((I2C_7BITADDR<<1)|I2C_WRITE)) {
Serial.println("I2C device busy");

Software on the Computer


I made quite a hack of a visualisation software on my laptop. In short it works like this:
Arduino outputs lines on serial port like "Sensor1=1234 Sensor2=456". Values are
raw sensor values 0-4095.
I read the serial data into a regular file by "sudo cu -l /dev/cu.usbmodem14101 -s
115200 > /tmp/cu_out.txt" (this works on MacOS)
I have a Java program to which I pipe the file as input. The program takes each
reading and converts into screen coordinates and paints the most recent reading in
red and all historic readings in green.
This program is so poorly written that I will save you all from the code. There is
threading. I used AWT for the laughs. Coordinate system transformation is
completely confused. Anyone with any coding experience should be able to write
this better straight away or be able to learn to do so. I will not share this code.
Sorry.

This is how it looks. Note some misalignment


happening bottom left. The lego car is not 100% aligned
with the axis of the maze and the tyres slip sometimes
when rushing the solve.

Learnings
The "Grove - 12-bit Magnetic Rotary Position Sensor / Encoder (AS5600)" is
awesome!
I2C is easy to use, but addressing of similar devices can be problematic. If you
wanna I2C, get yourself a breakout board with a multiplexer!
I learned how to read from the serial port on my Mac! One simple command and I
had the data in a file ready to be consumed by any program written in any
language. Zero complexity with weird serial port libraries etc. Debugging with "tail -
f". Beautiful!

CODE 

The Arduino code Arduino   (/PROJECTHUB/CODE_FILES/444907/DOWNLOAD)

Compile and run on Arduino

CUSTOM PARTS AND ENCLOSURES 

M
a DOWNLOAD (HTTPS://HACKSTERIO.S3.AMAZONAWS.COM/UPLOADS/ATTACHMENTS/1113611/MAG_HOLDER_DNE
g
n
e
t
h
o
l
d
e
r
O
p
e
n
S
C
A
D

 mag_holder_DnETVrBSDa.scad

M DOWNLOAD (HTTPS://HACKSTERIO.S3.AMAZONAWS.COM/UPLOADS/ATTACHMENTS/1113612/MAG_HOLDER_KQJP
a
g
n
e
t
H
o
l
d
e
r
S
T
L

This Sketchfab 3D model has not been published yet.

SCHEMATICS 

S
c
h
e
m
a
t
i
c
DOWNLOAD (HTTPS://HACKSTERIO.S3.AMAZONAWS.COM/UPLOADS/ATTACHMENTS/1113608/IMG_2357_QWVDGL
s
COMMENTS 

Please log in (/projecthub/users/sign_in?


id=334962&m=project&reason=comment&redirect_to=%2Fprojecthub%2Ffredrikstrids
man%2Fhidden-maze-mapper-95ca8c%23comments) or sign up
(/projecthub/users/sign_up?
id=334962&m=project&reason=comment&redirect_to=%2Fprojecthub%2Ffredrikstrids
man%2Fhidden-maze-mapper-95ca8c%23comments&source=popup) to comment.

Be the first to comment!

AUTHOR
(/projecthub/fredrikstridsman)

Fredrik Stridsman (/projecthub/fredrikstridsman)


3 PROJECTS 57 FOLLOWERS

FOLLOW (/PROJECTHUB/USERS/SIGN_UP?ID=515423&M=USER&REASON=FOLLOW&REDIRECT_

PUBLISHED ON

May 3, 2020

 RESPECT PROJECT (/PROJECTHUB/USERS/SIGN_UP?ID=334962&M=ARTICLE&REASON=RESPECT&...

 WRITE A COMMENT

 Share

MEMBERS WHO RESPECT THIS PROJECT

(/projecthub/hague)
and 1 other

SEE SIMILAR PROJECTS


YOU MIGHT LIKE

SIMILAR PROJECTS YOU MIGHT LIKE

(/projecthub/samhorne/2016-halloween-laser-maze-2128f6?
ref=similar&ref_id=334962&offset=0)
2016 Halloween Laser Maze (/projecthub/samhorne/2016-
halloween-laser-maze-2128f6?ref=similar&ref_id=334962&offset=0)
Project showcase by Sam Horne (/projecthub/samhorne)
14,336 VIEWS 8 COMMENTS 32 RESPECTS

(/projecthub/musridhorj-yantof-yudanarkoaa-trid/shortest-path-of-line-maze-curved-
and-zig-zag-track-264459?ref=similar&ref_id=334962&offset=1)
Shortest Path of Line Maze - Curved and Zig-zag Track
(/projecthub/musridhorj-yantof-yudanarkoaa-trid/shortest-path-
of-line-maze-curved-and-zig-zag-track-264459?
Project showcase by Team MusridhoRJ YantoF YudanarkoAA TriD (/projecthub/teams/...
4,820 VIEWS 8 COMMENTS 19 RESPECTS

(/projecthub/AnuragVasanwala/windows-10-iot-core-ultrasonic-distance-mapper-
d94d63?ref=similar&ref_id=334962&offset=2)

Windows 10 IoT Core: UltraSonic Distance Mapper


(/projecthub/AnuragVasanwala/windows-10-iot-core-ultrasonic-
distance-mapper-d94d63?ref=similar&ref_id=334962&offset=2)
Project showcase by Anurag S. Vasanwala (/projecthub/AnuragVasanwala)
60,522 VIEWS 23 COMMENTS 157 RESPECTS
(/projecthub/igorF2/arduino-uno-mini-weather-station-31b555?
ref=similar&ref_id=334962&offset=3)

Arduino UNO Mini-Weather Station (/projecthub/igorF2/arduino-


uno-mini-weather-station-31b555?
ref=similar&ref_id=334962&offset=3)
Project tutorial by Igor Fonseca Albuquerque (/projecthub/igorF2)
54,059 VIEWS 28 COMMENTS 109 RESPECTS

(/projecthub/AhmedAzouz/arduino-marble-maze-labyrinth-bd9ea6?
ref=similar&ref_id=334962&offset=4)
Arduino Marble Maze Labyrinth (/projecthub/AhmedAzouz/arduino-
marble-maze-labyrinth-bd9ea6?
ref=similar&ref_id=334962&offset=4)
Project tutorial by AhmedAzouz (/projecthub/AhmedAzouz)
19,236 VIEWS 25 COMMENTS 55 RESPECTS

(/projecthub/MakerRobotics/arduino-robot-poliardo-maze-solver-b41341?
ref=similar&ref_id=334962&offset=5)
Arduino robot PoliArdo - Maze solver
(/projecthub/MakerRobotics/arduino-robot-poliardo-maze-solver-
b41341?ref=similar&ref_id=334962&offset=5)
by MakerRobotics (/projecthub/MakerRobotics)
17,082 VIEWS 2 COMMENTS 57 RESPECTS

(https://www.arduino.cc)
Powered by
(https://www.hackster.io)

You might also like