This is one of those projects that turns out to be a good thought exercise.

You have a Pixycam, an Arduino uno, and a lcd screen. (Lucky you - you also have a computer, and usb cords to hook the electronics up and program with!). You need to know the distance of "something" from where you are sitting.

Looking around you - you find, a ruler and some colored construction paper - a little glue, and thin card board.

Well you could use the ruler to find the distance - that is true - but where is the fun in that! :-)

Being an electronics kind of person, you think - How can I use the Pixycam to give me a distance!

That's what this instructable is all about. :-)

Ok, so really, "We" (meaning me and members of the Automation Technology Club I attend) have been thinking about doing some distance detection using some pretty simple parts, and trying to keep the cost low. With as little hardware, and parts as we can. Mainly we are wanting some longer ranges for some of our robotic projects.

In terms of hardware, this is pretty simple, in terms of cost - it's not the cheapest option. In terms of setting up the Pixy - well it can get tricky. In terms of is this good for a robotic project (?) Well from my few attempts, I'd say no. But it maybe good for other things. And again, it's good to start thinking. Use this as a thought exercise :-)

Curious about how it works - but don't care about my build? Jump ahead to Step 4.

Let's get started -

Step 1: The Electronics and Miscellaneous Parts

From a hardware stand point, this fairly simple build. What makes it even better the Pixycam was made with the UNO in mind. (Of course you can use it with other micros)

Electronics Hardware:

Arduino Uno (1)

PixyCam (1) http://www.cmucam.org/

Parallax 1602 Serial LCD - https://www.parallax.com/product/27977 (The code has some control codes in it for this display, any serial LCD that just uses standard ascii should work without too many changes to the code). I was going to use a cheap I2C display, but turns out with the pixy library, and the libraries needed for that type display - I ran out of memory - so I went simple. I had the Parallax Serial LCD from a project years ago, I haven't used it much since then. But this seemed like the right project for it! And since it doesn't need a library it doesn't use up valuable space.

Other things you may need (or want):

sisors, Glue, thin cardboard, different color construction paper, something to mount the camera and arduino too.

Some wires for the display, maybe some screws/nuts, screw driver. That is about it.

I used 2.5 inch PVC pipe connectors for mounting - this was a bit of over kill, but worked out great. PVC is pretty easy to cut holes in as well with just some simple tools.

(In fact, I used a screw driver, and a self taping screw to make holes in it - didn't have access to my drill, so needed to go real simple here.)

Software -

Arduino IDE 1.6.9 is what I used. It should work with other versions of the IDE thou.

PixyMon - http://www.cmucam.org/projects/cmucam5/wiki/Pixy_R...

Arduino Pixy Library - http://www.cmucam.org/projects/cmucam5/wiki/Latest...

Setting up the PixyCam was one of the hardest parts, I am going to go over some of the basic stuff, but you really need a good understanding of how this camera works, and the different modes. And how to tweak it for your colors. (I've got a very basic understanding of myself, and I have read the wiki a few times.)


I wish it could solve my physics numericals ?

About This Instructable




Bio: I am a Ham Radio operator, computer geek, currently a service tech, robotic hobbyist. I've been "playing" with microcontrolers for the last several years ... More »
More by kd8bxp:UPDATED: Snake Vision Robot using two MLX90614 No Contact Temperature Modules Using a PixyCam (CMUcam5) to Get Distance of a Known Object Obstacle Avoidance Robot using TI Launchpad MSP432 
Add instructable to: