Easy Geocache Gadget Cache Not a Birdhouse

Want to build a birdhouse smart cache with a red herring twist? Follow along!

Inner Circuit Inner Circuit

I know, it's been a while.  I haven't been doing too much building lately, but have recently come up with an idea I haven't seen before.  It all started when I learned about capacitive sensing.  Basically, you can make a sensor that works when some gets near it.  They don't even have to touch.  Here is my first prototype:

Sure enough, as I swipe my hand near the foil (I'm not touching it!), I can get the LED to signal by turning on.  Here's a Fritzing diagram you can test with.  This pins used are slightly different than the video, but it matches up with the code below it.

Capacitive Sensing Test

Capacitive Sensing Test

This is a simple circuit with just a few short lines of code.

The circuit starts at pin 8 and goes through a 1 MΩ resistor to get back to "ground" at pin 12.  When I put my hand near the foil, I'm giving the electricity another path to ground.  As long as that path is less than1 MΩ, the electricity will ground through me.  I can read the voltage coming in past the resistor to determine if it's coming through the resistor or not… or rather an Arduino library can.  The bigger the resistor, the bigger the distance my hand could be from the foil.  This is safe with 5V of electricity, but I'm sure it could be dangerous with larger amounts.

As I did tests, it didn't work 100% of the time.  I think the humidity in the air and the general conductance of my skin varied too much.  With gadget caches, you need to make sure they work as close to 100% of the time as possible, so grounding through air wasn't an option.  However, actually touching the foil worked EVERY TIME.  So, there was my basic idea – make the geocacher touch metal part(s) to get to the geocache.

So, how to get the geocacher to touch the senor?  I thought I'd go for some misdirection.  When they open the birdhouse geocache, the first thing they'll notive is a 5-character lock at the back.  It can have letters or numbers.  The cache will require batteries.  Installing the batteries lights up an LCD display, which displays a message like "The combination is: P3LX".  This will (hopefully) cause some confusing, because there are 5 characters on the lock.  There are also 4 LED light bulbs under the main LCD display.

Let the Confusion Begin!

Let the Confusion Begin!

The outside of the cache will have seemingly innocent text, like the GC code and name of the cache, spray painted on the outside of the cache.  The trick to this cache is that next to 4 of the letters there are bare screw heads.  By touching each of these screw heads in order (P, 3, L, and X), the cache container will be revealed.  It turns out the batteries weren't really needed for the LCD display, but instead used to sense when the screw heads are touched, and then to fire off a servo to release the cache container.

Building the Container

I actually drafted this container out on graph paper first.  I had to fit the LCD screen and the preform cache container into the shape of a birdhouse, along with all of the Arduino parts.  This was a chance for me to try another "project" with the CNC router I got for Christmas.  I took those drawings, and created precise vector illustrations of each part in Adobe Illustrator, and then imported them into a program called VCarve Desktop.  This program lets me take the vector illustrations and turn them into cutting instructions for the router.  You can see some photos and a video below.

My CNC can only handle about 20×24 inches at a time, so I cut the pieces out of two 1×2 foot half inch thick boards. Here's a short video of the machine in action. The actual cutting took about 15 minutes.  Warning: the video is a bit loud.

Of course, these pieces could also have been cut on a table saw.  Once all the pieces were cut, I sealed the edges and put exterior paint on everything.  After they were dry, I started with a partial assembly of the wood which would also allow me to manipulate the electronics into place.

Wiring the Components

Once assembled, I was able to put the "face plate" on the cache. This is where the LEDs, LCD screen, and main circuit board are. I like to put them here because it makes for easier removal and repairs if needed.

A few new tricks here!  I'm using the analog pins as digital pins.  So, instead of calling them with A0-A8, you can just continue after the last defined digital pin, and call them using D14-D22.  This was handy, because I'd run out of digital pins otherwise.  I've also popped off the top rail of the breadboard to conserve space.  I used a caliper to measure the LCD screen, so it fits in there almost perfectly, with a couple screws and hot glue holding it in tight.

I color-coded 8 of the wires (two groups of four).  This way, I can match up which touch sensor corresponds to which LED.  The LEDs are sharing one common ground – you can see the LED grounds are soldered to a bare copper wire in the middle photo.  Everything is fairly well grouped, but I had to sneak in the servo at pin #6 – it has to be PWM controlled, and that pin seemed the easiest to use without causing too many wiring issues. The 470 μF capacitor is in there because the servo was being jittery. The capacitor helped clean up the PWM signal to the servo for a nice smooth motion.

You may also notice a wire going from A7 to the positive line. This is another new feature – I'm using it to measure the voltage and make sure it's enough.  I thought about measuring the voltage directly off the battery, but if it's too much (like a 9V battery), it will burn out the Arduino board.  So, I'm just measuring the voltage off the power booster.

Programming the Arduino

With all this wired up, it was time to program!  Here's what I can up with:

Nothing too odd here.  I'm using an array for both the touch sensors and the LEDs to make the code a little easier to read.  The "230" threshold value on line 23 was determined by testing.  If nothing is touching the wire, it reads 10 or less.  If you touch the wire AND ground, it reads in the thousands.  The readings were very different between powering the cache with a USB cable vs. batteries.  How did I test this, you ask?  I set up a debugging mode that can be started if you touch all 4 screws at once.  If you do that, the screen flips over to show readings from the 4 touch sensors as well as the voltage off the power booster.  I've never had a debugging mode before, and I hope it helps if (when) there are issues in the future.

Debug Mode - note the reading of 250 from touching the bolt next to the "3"

Debug Mode – note the reading of 250 from touching the bolt next to the "3"

The debug mode also helped with the threshold for the capacitive sensor.  I initially tested and wrote the code with the circuit connected to my laptop via USB.  When I switched over to using AA batteries, the numbers were VERY different.  After some additional testing, I realized that this was because the USB cable offered a proper ground to the actual earth (through the laptop's ground plug going into the wall outlet).  When using the batteries, the ground only went back to the battery.  To compensate for the difference in grounding, I ended up increasing the resistors from 1MΩ to 2MΩ, which gave a better indication when a metal screw was being touched. I actually soldered two 1MΩ together (using 8 total), since I didn't have any 2MΩ in my kit.

Another note is that I only connect the servo when I want to use it, to avoid extra power draw and any servo twitching. It turns out that myservo.read() just returns the last position it was set to. The first time you power the circuit and read the servo position, the value isn't accurate. In my case, the servo always returned "93" when I read it the first time, so I put that check in there on line 151 to minimize bouncing on start-up.

The Final Result

So, here's the cache. I'm spinning it around to show the locations of the screws, and then go through touching them in order until the servo files, releasing the preform cache container. My thanks to geocacher djwhouse for the dispenser mechanism – that was completely his original idea.

This is another idea that I think can be used in a variety of cache styles. To make it harder, you could add an extra character to the combination, so that it has the same amount as the red-herring lock. You could also remove the LEDs so you do not indicate progress to the geocacher. If you don't want to use a servo (they can be troublesome), consider having the lock actually open to get to the log – when a geocacher finishing touching all the letters in the first "combination" a new combination could appear on the LCD screen for the actual lock.

If you end up using capacitive sensing in your smart cache, please let me know! I had a great time experimenting with it.

ortonfactere.blogspot.com

Source: https://geocaching.hyliston.net/2018/08/06/a-touching-smart-cache/

0 Response to "Easy Geocache Gadget Cache Not a Birdhouse"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel