I came across this tile puzzle at a rental cottage and it frustrated most of those in attendance. Boasting “literally billions” of possible combinations I gave it a go and shortly decided swimming and canoeing was more rewarding.
The puzzle is comprised of 16 square tiles with one of 8 patterns on each of their 4 sides. To solve the puzzle one must place these tiles in a 4-by-4 grid with their edges aligned such that the patterns on each side match the patterns on the sides of the tiles adjacent, above and below.
I was curious, however, if the solution entailed some sort of offset layout, or if it was just a standard 4-by-4 edge-aligned grid as the box implied — it’s an optical illusion puzzle after all. So I took to searching online for the solution, with no luck, I again decided swimming and canoeing was more rewarding.
Upon returning home from the cottage the puzzle nagged me, so I set to writing a program to more-or-less brute force the solution, seen below, written in C#. I didn’t feel like programming routes for every possible combination so instead I wrote in some random elements to try while systematically eliminating other factors. I found an image of the tiles online and translated them to numeric representations of their patterns and rotations. After 142,594 attempts of the last iteration of my program it found a solution. I say “a solution” because I ran it again and it found a different solution, both valid. Multiple solutions runs contrary to the packaging, but oh well.
An image of the solved puzzle can be found by clicking here. Hopefully this helps others get on with their summer rentals.
You can find some of these puzzles on Amazon, though they are long out of production.
For my son’s second birthday I decided to introduce him to die-cast cars and what better way than building a drag strip race track with an electronic start gate, timing and race results?
While Hot Wheels does offer a 6-Lane Raceway and a number of other drag strip style tracks, they didn’t have the timing and electronic start gate that I knew an Arduino and some other bits could provide, so I set to work. The basic idea is was have a servo motor open the start gate by pulling down a hinged plate with dowel stoppers to release the cars and a photocell (photoresistor/LDR) pointed at an infrared LED on each track to detect each car crossing the finish line.
Some quick searching revealed a number of projects from which I could draw insight and inspiration, most useful were apachexmd’s Hot Wheels Track Timer and Robby C’s Ultimate Guide to Building a Hot Wheels Race Track. This demystified a number of points, I hadn’t really had any fun with die-cast cars since I was kid myself, turns out there are some oddities.
Tracks
One of the oddities is that Hot Wheels doesn’t offer any long track for sale, all of their tracks are sold in segments a foot or two long that must be connected — the only exception being a vintage 50-foot Track Pak Raceway sold at some point in the 70′s or 80′s which can be found for upwards of $100 currently. Another track option is BluTrack which is sold in many lengths but only in a two-lane configuration for some reason. I decided to buy the readily available Hot Wheels segments in the form of 4 Hot Wheels Track Builder Straight Track kits.
I had some 1/2″ x 8″ pine left over from framing a door I thought I would use to mount the track on. There are a number of methods folks have employed to mount the Hot Wheels track on wood, I decided to use a method mentioned on Robby C’s page which involves using screws to secure a stack of two different sized washers to the wood at intervals.
A small washer below a larger one provides the elevation that the track needs to slide onto the larger washer. The exact washers and screws I used can be seen in the gallery below, be sure to drill pilot holes for the screws and try to keep them straight, the straighter the screws are, the better they will fit in the washer and, in turn, the smaller the bump in the track will be. This method (at least with the sizes I used) does leave ever so slight bumps in the track once it’s fitted, but I felt it was slight enough that it wouldn’t adversely affect the races. I used one of these washer guides for each section of track positioned to sit in the center of the track, except for the finish line track where I placed one at either end.
The track has 4 main pieces (though one I cut into two to make it more modular). These four pieces are a small section of track for the finish line which has the results display attached, the main straightaway, the start incline and a support for the start incline. Following some of the ideas on Robby C’s page again I decided to use hinges to connect the start incline track to its support piece as well as to the straightaway allowing for an adjustable incline. If you use hinges with removable pins it allows for easier disassembly.
I ended up cutting the straightaway into two sections, and I’ll probably do the same with the incline so that I can make the entire track shorter and thus more palatable in the living room.
For the joint between the incline and the straightaway I made sure that no track joints would run across the curve allowing for the longest pieces of track at this joint and thus a smooth transition for cars from the incline to the straightaway.
The flat joints I cut where the tracks connect, this makes disassembly a bit easier, but I’m not sure it was the right choice as some of the wood warped and having a track joint and a wood joint at the same spot may not result in the smoothest run. Experiment with the hinges and see which orientation works best for your setup.
Start Gate
The start gate on this track uses a high torque servo to actuate a hinged plate that has 4 wood dowels inserted into it. The dowels feed up through routed slots in the wood and tracks to hold the cars at the start gate.
The Hot Wheels tracks can be cut easily with a sharp exacto, though it’s difficult to get the corners of cuts perfectly smooth. The track can also be drilled, one method is to drill an appropriate diameter hole at either end of the route you wish to cut and then connect the two holes with a single exacto cut on either edge.
To start the race the servo pulls a stiff wire which is connected to the hinge plate with a small L-bracket, this pulls the dowels back down through the routed slots and releases the cars. The slots I routed in the wood were 1/2″, the track slots were a little smaller than that, somewhere between 1/4″ and 1/2″ as the dowels themselves were 1/4″ diameter and needed some clearance to move smoothly. The dowels are simply friction fit into drilled holes.
It may not be obvious from the video and photos, but I drilled a small hole in the L bracket which fit the wire much better than the large screw holes. This prevented any extra travel of the wire at the hinge plate connection when the servo actuates.
The wire I used to connect the servo to the hinge plate is a malleable steel of some sort, when my son decides to push or pull on the start gate hinge or dowels it will bend this wire rather than stress the servo, after which I inform him that is not how it’s suppose to function and bend the wire straight again. For my setup a run-of-the-mill servo wasn’t strong enough to push and pull the 1/4″ wooden hinged plate so I picked up a high torque servo. If you made a lighter, thinner hinge plate you may be alright with a weaker servo.
Robby C mentions something about this type of drop-out start gate being not as fair as a gate that lifts rather than drops, but I’m not sure why that would be — in any case, my goal was not to create a track fit for the world cup of die-cast racing. A lift gate would have required more fabrication, so I opted for the simpler drop-out.
Finish Line
The finish line employs 4 photocells, also know as photoresistors or LDR’s (Light Dependent Resistors) which sit in an enclosure above the track in holes drilled into a piece 1/2″ piece of wood. These photocells point down through the drilled holes, through larger drilled holes in the enclosure at 4 infrared LED’s embedded in the wood under the track and aligned with holes in the track above. Placing the photocells in holes in the 1/2″ piece of wood keeps them focused on their respective infrared LED underneath without picking up a lot of ambient light.
While the infrared LED’s don’t produce any light visible to the naked eye, they are detected by the photocells and when a car passes over the infrared LED, the reading on the respective photocell drops dramatically and thus the Arudino brain can determine when each car passes the finish line by waiting for the photocell reading to drop.
Embedding the photocells into a piece of wood also allowed me to align that wood with holes I drilled in the track wood for the infrared LED’s before placing the wood, along with the photocells in the enclosure. Once I’d aligned the wood, I drilled holes in it for the photocells, wired up the photocells and placed that entire piece of wood into the enclosure. The holes I drilled in the enclosure were much larger and thus I had room to align the wood with the photocells to the infrared LED’s without having to worry about aligning exactly with the holes in the enclosure.
I wrote a specific Arduino sketch in order to align the photocells which wrote the photocell values to the computer via a serial connection. Since then I have added a debug mode to the race track, pressing both the start race and track reset buttons simultaneously will engage the debug mode where the Arduino will write the photocell values out to the 7-segment race result displays so that I can check the photocell alignments.
One of the issues I ran into was that it seemed the power needed to actuate the start gate servo would draw too much from the rest of the circuit causing the infrared LED’s to dim and trigger the photocells. To get around this I added a 150ms delay to allow the circuit to recover after opening the start gate.
Circuit
None of the electronics used in the project are very complex. I collected various components mostly from RobotShop, SparkFun, Creatron and locally.
These components and their circuits are all connected to the Arduino which runs the sketch at the bottom of this post. If I get a chance to draw one up, I’ll post a circuit diagram.
Car Storage
After purchasing a good starting set of cars to go along with the drag track I needed some way to store the hoard. It seemed likely that a generic storage container would do the trick as long as the compartment sizing matched. I wasn’t all that pleased with the purpose-build die-cast storage containers. A little bit of searching revealed this Creative Options Thread Organizer which fits 48 cars almost perfectly. It’s only half-full in the photo below, with the same number of compartments on the reverse side still to be populated.
Next Steps
While it turned into a race to finish this project in time for my son’s birthday, I had initially intended to integrate a Raspberry Pi to record race statistics and another fun function, but I’ll leave that to everyone’s imagination until I get around to implementing it. The whole setup could also use some Hot Wheels stickers.
Update
I’ve since removed a section from the start incline and the straightaway to reduce the overall size of the track in order to move it to a more permanent location (rather than across our living room). Below is a short video of my son operating the shortened track, he doesn’t seem to mind the change and still enjoys the track quite a bit.
Arduino Sketch
/* Hot Wheels Drag Strip v1.2 */
#include <Servo.h>
#include <SPI.h> // Include the Arduino SPI library
// SPI SS pins
const int displayPinLane1 = 7;
const int displayPinLane2 = 4;
const int displayPinLane3 = 6;
const int displayPinLane4 = 5;
// Photocell pins
const int photocellPinLane1 = 2;
const int photocellPinLane2 = 3;
const int photocellPinLane3 = 4;
const int photocellPinLane4 = 5;
int photocellReadingLane1;
int photocellReadingLane2;
int photocellReadingLane3;
int photocellReadingLane4;
const int photocellThreshold = 4;
// Button pins
const int startButtonPin = 2;
const int resetButtonPin = 3;
const int gateServoPin = 14;
Servo gateServo;
// Servo positions
const int openGateServoPosition = 10;
const int closeGateServoPosition = 30;
int startButtonState = 0;
int resetButtonState = 0;
int raceStatus = 0;
int lane1Status = 0;
int lane2Status = 0;
int lane3Status = 0;
int lane4Status = 0;
int currentPlace = 0;
unsigned int counterLane1 = 0; // These variables will count up to 65k
unsigned int counterLane2 = 0;
unsigned int counterLane3 = 0;
unsigned int counterLane4 = 0;
String displayString;
char tempString[10]; // Will be used with sprintf to create strings
int animationTimer = 0;
bool showPlace = true;
void setup()
{
gateServo.attach(gateServoPin);
gateServo.write(closeGateServoPosition);
pinMode(startButtonPin, INPUT);
pinMode(resetButtonPin, INPUT);
// -------- SPI initialization
pinMode(displayPinLane1, OUTPUT);
digitalWrite(displayPinLane1, HIGH);
pinMode(displayPinLane2, OUTPUT);
digitalWrite(displayPinLane2, HIGH);
pinMode(displayPinLane3, OUTPUT);
digitalWrite(displayPinLane3, HIGH);
pinMode(displayPinLane4, OUTPUT);
digitalWrite(displayPinLane4, HIGH);
// Begin SPI hardware
SPI.begin();
// Slow down SPI clock
SPI.setClockDivider(SPI_CLOCK_DIV64);
clearDisplays();
s7sSendStringSPI(displayPinLane1, "Ln 1");
s7sSendStringSPI(displayPinLane2, "Ln 2");
s7sSendStringSPI(displayPinLane3, "Ln 3");
s7sSendStringSPI(displayPinLane4, "Ln 4");
// High brightness
setBrightnessSPI(displayPinLane1, 255);
setBrightnessSPI(displayPinLane2, 255);
setBrightnessSPI(displayPinLane3, 255);
setBrightnessSPI(displayPinLane4, 255);
}
void loop()
{
animationTimer++;
if(animationTimer > 200) {
if(showPlace == true) {
showPlace = false;
} else {
showPlace = true;
}
animationTimer = 0;
}
photocellReadingLane1 = analogRead(photocellPinLane1);
photocellReadingLane2 = analogRead(photocellPinLane2);
photocellReadingLane3 = analogRead(photocellPinLane3);
photocellReadingLane4 = analogRead(photocellPinLane4);
resetButtonState = digitalRead(resetButtonPin);
startButtonState = digitalRead(startButtonPin);
if(resetButtonState == HIGH && startButtonState == HIGH) {
// Debug mode
clearDisplays();
s7sSendStringSPI(displayPinLane1, String(photocellReadingLane1)+" ");
s7sSendStringSPI(displayPinLane2, String(photocellReadingLane2)+" ");
s7sSendStringSPI(displayPinLane3, String(photocellReadingLane3)+" ");
s7sSendStringSPI(displayPinLane4, String(photocellReadingLane4)+" ");
delay(1000);
} else if(resetButtonState == HIGH && raceStatus > 0) {
raceStatus = 0;
clearDisplays();
s7sSendStringSPI(displayPinLane1, "Ln 1");
s7sSendStringSPI(displayPinLane2, "Ln 2");
s7sSendStringSPI(displayPinLane3, "Ln 3");
s7sSendStringSPI(displayPinLane4, "Ln 4");
lane1Status = 0;
lane2Status = 0;
lane3Status = 0;
lane4Status = 0;
counterLane1 = 0;
counterLane2 = 0;
counterLane3 = 0;
counterLane4 = 0;
currentPlace = 0;
gateServo.write(closeGateServoPosition);
} else {
if (raceStatus == 0 && startButtonState == HIGH) {
// start the race
gateServo.write(openGateServoPosition);
// wait for servo to drop
delay(150);
raceStatus = 1;
} else if (raceStatus == 1) {
// race is running
int carsAcross = 0;
if (photocellReadingLane1 < photocellThreshold && lane1Status == 0) {
showPlace = true;
currentPlace++;
carsAcross++;
lane1Status = currentPlace;
gateServo.write(closeGateServoPosition);
}
if (photocellReadingLane2 < photocellThreshold && lane2Status == 0) {
showPlace = true;
if(carsAcross == 0) {
currentPlace++;
}
carsAcross++;
lane2Status = currentPlace;
gateServo.write(closeGateServoPosition);
}
if (photocellReadingLane3 < photocellThreshold && lane3Status == 0) {
showPlace = true;
if(carsAcross == 0) {
currentPlace++;
}
carsAcross++;
lane3Status = currentPlace;
gateServo.write(closeGateServoPosition);
}
if (photocellReadingLane4 < photocellThreshold && lane4Status == 0) {
showPlace = true;
if(carsAcross == 0) {
currentPlace++;
}
carsAcross++;
lane4Status = currentPlace;
gateServo.write(closeGateServoPosition);
}
updateDisplay(displayPinLane1, lane1Status, counterLane1);
updateDisplay(displayPinLane2, lane2Status, counterLane2);
updateDisplay(displayPinLane3, lane3Status, counterLane3);
updateDisplay(displayPinLane4, lane4Status, counterLane4);
if (lane1Status == 0) {
counterLane1++;
}
if (lane2Status == 0) {
counterLane2++;
}
if (lane3Status == 0) {
counterLane3++;
}
if (lane4Status == 0) {
counterLane4++;
}
}
}
delay(10); // This will make the display update at 100Hz.*/
}
void clearDisplays()
{
clearDisplaySPI(displayPinLane1);
clearDisplaySPI(displayPinLane2);
clearDisplaySPI(displayPinLane3);
clearDisplaySPI(displayPinLane4);
}
void updateDisplay(int displayPin, int laneStatus, unsigned int laneCounter) {
// Magical sprintf creates a string for us to send to the s7s.
// The %4d option creates a 4-digit integer.
sprintf(tempString, "%4d", laneCounter);
// This will output the tempString to the S7S
if(laneStatus == 0 || showPlace == false) {
s7sSendStringSPI(displayPin, tempString);
// Print the decimal at the proper spot
if (laneCounter < 10000) {
setDecimalsSPI(displayPin, 0b00000010); // Sets digit 3 decimal on
} else {
setDecimalsSPI(displayPin, 0b00000100);
}
} else {
setDecimalsSPI(displayPin, 0b000000000);
if(laneStatus == 1) {
s7sSendStringSPI(displayPin, "1st ");
} else if(laneStatus == 2) {
s7sSendStringSPI(displayPin, "2nd ");
} else if(laneStatus == 3) {
s7sSendStringSPI(displayPin, "3rd ");
} else {
s7sSendStringSPI(displayPin, "4th ");
}
}
}
// This custom function works somewhat like a serial.print.
// You can send it an array of chars (string) and it'll print
// the first 4 characters in the array.
void s7sSendStringSPI(int ssPin, String toSend)
{
digitalWrite(ssPin, LOW);
for (int i=0; i < 4; i++)
{
SPI.transfer(toSend[i]);
}
digitalWrite(ssPin, HIGH);
}
// Send the clear display command (0x76)
// This will clear the display and reset the cursor
void clearDisplaySPI(int ssPin)
{
digitalWrite(ssPin, LOW);
SPI.transfer(0x76); // Clear display command
digitalWrite(ssPin, HIGH);
}
// Set the displays brightness. Should receive byte with the value
// to set the brightness to
// dimmest------------->brightest
// 0--------127--------255
void setBrightnessSPI(int ssPin, byte value)
{
digitalWrite(ssPin, LOW);
SPI.transfer(0x7A); // Set brightness command byte
SPI.transfer(value); // brightness data byte
digitalWrite(ssPin, HIGH);
}
// Turn on any, none, or all of the decimals.
// The six lowest bits in the decimals parameter sets a decimal
// (or colon, or apostrophe) on or off. A 1 indicates on, 0 off.
// [MSB] (X)(X)(Apos)(Colon)(Digit 4)(Digit 3)(Digit2)(Digit1)
void setDecimalsSPI(int ssPin, byte decimals)
{
digitalWrite(ssPin, LOW);
SPI.transfer(0x77);
SPI.transfer(decimals);
digitalWrite(ssPin, HIGH);
}
Close to one year after our wedding, my wife Ester and I are, at long-last, sending out thank you packages. Having handcrafted the rustic Edison-style light fixtures for our wedding reception (with some much appreciated assembly line help from my Dad) we had hoped that we would be able to send those same lights to family and friends who not only shared with us and supported us on our wedding day, but support our family on a daily basis. In this way a light which helped to brighten our wedding festivities may continue to brighten, in some small way, the lives of our family and friends.
If you were part of our wedding, or lent your support, a package should be making its way to you. Postage services being what they are, if you have yet to receive a package by August, 2014, please let us know by sending an email to esterandphil [at] esterandphil [dot see oh ehm]. Those of you in Italy and in Australia will receive bulbs appropriately rated for 220-240 volts, while these weren’t in use at our wedding, rest assured that we’ll infuse them with loving and thankful vibes before sending them on their way.
These simple light fixtures were designed, selected from reclaimed barn wood (the Barn Board Store), cut, drilled, sanded and stained by Ester and I with our family and friends in mind — each one unique in character. The modest design allows for a number of use scenarios, it can be placed on a table or desk in virtually any orientation, the socket completing an a-frame support, or it can be wall mounted with the use of a corner bracket or two (not included) so that the light may hang through the hole in the fixture. Some uses require the plug to be threaded through the hole in the fixture, other uses require that the socket be connected to the light bulb through the hole in the fixture.
Lights delivered within North American will be 120 volts (Italy and Australia will be 220 volts). The switch is a 3-way, it will take two clicks to turn on the included bulb, however, should you replace the bulb with a 2-stage bulb (dim, bright) these clicks will toggle the brightness.
Thank you for all of your support, we hope you enjoy this small token of our appreciation. If you would like to share a photo of your light fixture once it’s settled in, we’d be delighted to see it! You can use the upload form below, or send it to esterandphil [at] esterandphil [dot see oh ehm].
This DIY reclaimed lumber chandelier with hanging Edison bulbs is easy and quite self-explanatory, though I will explain somewhat. Here’s what you’ll need,
Parts for Fixture
piece of lumber
2x lengths of chain
4x open/close chain links, to affix the chain to the eyelets you’ll screw to the board
4x screw eyelets, to secure the chain to the lumber
2x screw hooks, to hook the chain to the ceiling *screwed into solid wood joists
one or more junction boxes depending on the size of the wood
one or more hanging lights, cord, socket, bulb (see below)
a cover for the ceiling junction box plastic or otherwise, you may have to cut a notch for the power cable
Once you’ve selected your lumber, drill a hole for each light cord. I started with a spacious zig-zag pattern but it’s whatever you like really. Affix junction boxes to the top-side of the lumber and wire the lights into them. Screw an eyelet into each corner of the top-side of the lumber, at least an inch in from any side.
If the lumber is extra heavy you could consider another length of chain and place two more eyelets to support a chain in the center. If ceiling joist placements allows you could also use four lengths of chain straight up to four hooks instead of the swing system I employed.
Screw the hooks firmly into ceiling joists, hang the fixture and wire whichever junction box is closest into the ceiling electrical. If possible the power cable would be less noticeable if it snaked to the ceiling along one of the support chains.
Once hung you can adjust the heights of the hanging bulbs and coil the extra cable on top, it’s not coiled very neatly in some of these pictures but I have since remedied that. There you have it.
I’ve been seeing these types of steampunk black malleable iron on the net for years; it was only a matter of time before I went and made one. The texture of the iron combined with the warm vacuum-tube glow is quite an amazing effect, and they certainly look easy to make. Previous trips to the hardware store had only resulted in the question of what socket will fit into these types of pipes? I found myself with some spare time this past Saturday, so I went to the local hardware store and laid out 15 or 20 iron gas pipe fittings in the aisle and designed a 4-bulb fixture — roughly designed that is.
While designing the fixture be careful not to screw the fittings together too tightly as they can bind, also keep in mind these fittings will turn your hands black and the sharp threads can easily shred your hands if you slip. This being my first attempt I kept it relatively simple, keep in mind that you will have to thread wiring through all the bends and turns at some point.
I used the largest malleable iron piping I found, which had an inner diameter of 1 inch on the female threaded sections. I then purchased some basic keyless (no switch) brass sockets. These did not fit in the pipes, though I didn’t mind the look of the brass sockets extending from the fixture so I started with that.
The rounded base of the sockets became a problem as when they were wired and threaded into the fixture they lolled this way or that rather than extending straight from the fitting. I tried bulking up the base of the sockets with electrical tape, but they still slipped. I then tried removing the rounded bottom section yet the upper brass part was still too large in diameter to fit in the pipe.
Then I discarded everything but the bare socket with its bakelite base, the middle portion in the exploded image below (not the exact socket, but very similar). These almost fit, I had to crack/shave/cut off some protrusions from the bakelite base. Discarding the brass and cardboard meant that the socket had no protection or isolation for the wiring leads, for this reason I wrapped the hot lead with some electrical tape to isolate it and then ran one wrap of electrical tape around the entire socket. This extra bulk meant I had to twist and fiddle but they still fit in the pipe. If you fiddle so much that you think the electrical tape may have shredded, take it out, replace the tape and start again. It’s better to be safe.
Even though the sockets had no ground lead it was important when wiring be sure to wire all sockets in the same fashion and keep track of which wire is hot as they will all be combined at some point and you don’t want to short the wrong lead to the iron fixture structure.
While threading wire through the fixture you can unscrew fittings but be careful not to twist the wiring too much inside around elbows.
With the sockets wired and the wiring threaded through the fixture the next step was mounting it to the ceiling or wall. The wall mount fitting, pictured right, is not large enough to cover a junction box. For this reason I used a white plastic cover, however screwing the wall mount fitting to the plastic cover would not be strong enough to support the fixture (iron is heavy).
Another problem was that the wall mount fitting’s screw holes would block the plastic cover’s screw holes. I decided to use a steel junction box cover on top of the plastic cover to support the fixture. I drilled a center hole in both covers, two holes to line up with two of the iron mount’s screw holes and ensured that one of the remaining two screw holes in the iron mount fitting lined up with one of the plastic cover’s screw holes. This meant that the iron fitting would not be centered on the plastic cover, but it did allow access to both of the plastic cover’s screws even after the iron fitting was secured.
In this manner the iron fitting could be bolted to the steel cover, through the plastic cover and still allow access to the plastic cover’s screw holes in order to affix the entire assembly to the junction box.
The photo above shows the steel cover which has been drilled, in this photo the white plastic cover has not had the center hole drilled for the wires yet. I’m confident this system would have worked with a full sized junction box, however once I removed the old fixture I realized my desired location had an old-style smaller junction box and this system wasn’t going to work.
As it turns out, mounting to an old-style smaller junction box is even easier as the two junction box mounting bolts do line up with the iron fitting and therefore there wasn’t a need for the steel plate after-all. I put bolts right through the iron mount fitting, the white plastic cover and into the junction box, which allowed the junction box to directly support the weight of the fixture.
If you’re confident wiring fixtures, outlets, sockets and such this should be right in your comfort zone — if not perhaps enlist a friend who is to help out.