Color, Perception, and Evolution

A while back, I was looking at a small tomato plant out on my porch. A tiny tomato had been growing. For a while, it had been as green as the stem. But it had turned bright red, and rather quickly – transitioning all the way over to the opposite side of the color wheel. It was shouting “eat me!” (not in the rude way).  And doing it as plainly as a traffic light distinguishes stop and go.

I thought, how oddly convenient… Why does the color change so drastically? It’s like it knows that I want to eat it, and it is blatantly letting me know that it’s ready!

Does the tomato also want me to eat it? I guessed that it could be a strategy for spreading its seeds – either through me or some animal spitting the seeds out somewhere.  Or… pooping them out.  And maybe somewhere far away. That’s how evolution works.

Then I thought about what color is… It is really just a perception that we have as a human beings, and not an “absolute reality”. Color is simply an interpretation of the wavelength of light, which is a completely linear thing that the human eye and mind have mapped into kind of a circular color wheel, with “opposite” colors like red and green.

This linear spectrum, just a range of numbers:

Gets mapped to this:

So, did human vision evolve to be able to detect changes in fruits and vegetables like this? Did it evolve to make ~685 nm (red) and ~530 nm (green) so obviously visibly distinct from each other, for the purpose of enabling the vision-bearer to easily find edible fruits and vegetables out in the forest?

I looked some things up online.

It turns out that the answer is that animals and fruit-bearing plants actually co-evolved for this to happen. The idea of fruits and vegetables being eaten by animals is beneficial for both. I thought that this was super-cool. Yes, plants evolved to make the ripeness of their fruits and vegetables obvious to primates and other animals. And, what I thought was maybe more interesting, is that we humans (as primates) have evolved to see red as red and green as green likely because of this exact situation with the tomato plant on my porch.

(Well, I guess not this exact situation. Primate evolution didn’t happen on my porch. But, you know what I mean.)

There are, of course, other theories about why fruits and vegetables are so conveniently-edible. Kirk Cameron’s friend makes some good points in this video about bananas:

…but I’m going to go with Wikipedia on this one. Co-evolution.

You may have heard at some point that dogs only see in “black and white” or grayscale. Well, this is actually not true at all.  Dogs can in fact distinguish color, in addition to being able to perceive brightness.  But, while humans see three primary colors (red, green, and blue), dogs can only see two: yellow and blue.  Humans are called “trichromats”, and dogs are called “dichromats”.

If color is just a “perception thing”, then how can we know what dogs see, versus what humans can see? Well, you may remember learning about “rods and cones” in our retinas. Cones are the cells responsible for detecting color. Science-folk have dissected eyeballs, and found that humans have three different types of cones, and dogs only have two.

A dog’s color spectrum looks like this, compared to a human’s:

Human’s view
Human colorline
Dog’s view
Dog colorline

To a dog, red and green look pretty similar.  So, a dog would not be able to see the ripeness of the tomato on my porch as easily as you would.  Primates rule, dogs drool.

This is kind of like color-blindness in humans. I had a friend in college who was color blind. In our electronics lab, I always asked him to pick out the resistors, because I’m a jerk.

What I think is cooler, is that there are animals that can actually see more colors than humans. Some fish, birds, reptiles, and insects can see a fourth color, in addition to red, green, and blue. The fourth color sits in the ultraviolet part of the spectrum. What does this fourth color look like?

I have no idea!

(Note that the answer is not “ultra violet”. That’s not a color.)

But, there are some cases of humans that may know what it looks like.  Look it up… It’s called “tetrachromacy”.

Of course, none of us really has any idea what colors look like to other people. Is how I perceive a 685 nm wavelength the same as how you perceive a 685 nm wavelength? No idea. Weird. But that’s a whole other topic that I’ll leave that for someone else’s blog.


Next time you are in the forest, foraging for fruits and berries, think about it. The fact that they stick out from the brush is not a coincidence!


Efficient Living

A Guide

By Brian Dolan

I work as and tend to think like an engineer, placing a high value on efficiency.  Below are some habits that I have formed over the years, which I think can be of value to others.

  1. Only take the trash out if you have some other reason to leave your apartment.
  2. Only get gas for your car if you have some other reason to be driving by a gas station.
  3. Always shop online rather than in person to save on gas and time, and to avoid meeting any new people.
  4. Never throw anything away – put it out on Craigslist for free so that someone else can use it.
  5. Spend money only when absolutely necessary.  For example, if at a nice restaurant, do not order the steak. Get the pasta.
  6. When making iced tea from a powder mix, you can avoid using a spoon and thereby taking up unnecessary space in the dishwasher. First, put the iced tea mix into the pitcher. Then, put a very small amount of water into the pitcher. Then swizzle around the water and powder until it forms a small amount of homogenous sludge. Next, put the remaining amount of necessary water into the pitcher and swirl around some more.
  7. Avoid making yourself dinner and use only frozen meals. This saves on time and dishes.
  8. When you need to replace something that is old or broken, delay as long as possible. For example, your computer. If this is done many times throughout your lifetime, in the end, you will have bought less computers, overall.
  9. Do not allow useless junk to pile up around your apartment. This way, when it comes time to move, you will not have to get rid of that junk at the last minute, or worse yet, move it. But, don’t ever move. That would be inefficient.
  10. Don’t ever buy soda. Aside from making you fat, it costs more than water. Plus, you have to carry it from your car up to your apartment.
  11. If you are making tacos, and you have an old, gross tomato, do not buy a new, better tomato. The old one will do, and you already paid for it. Also, don’t bother to make tacos.
  12. You can get more work done at work if you don’t take a lunch break. Just keep working.
  13. If you have lots of money in the bank, don’t spend it. Just keep it in the bank.
  14. Avoid personal conversations at work. These take time away from your ability to work. If you end up in a personal conversation where the other person is talking, use that time to think about the topics that are important to you.

I believe that these simple tips from my own lifestyle can help you to lead a happy, fulfilling life, and put you on the path to becoming an amiable older gentleman.

Mint Tin Hero

A friend at work proposed a friendly competition between a few co-workers: to make something cool out of a Trader Joe’s green tea mint tin.  Anything – whatever our creative hearts desired.  The prize?  Nobody cared – we’d figure that part out later.


I thought it would be fun to do something electronic with it – maybe even squeeze an Arduino in there.  But it would be tough – the tin was pretty tiny.  And it had a clear plastic screen on the cover.  I had to figure out what to do with that…

After a night of brainstorming, and then another week or so of indecision, I settled on making a Guitar-Hero-like rhythm game, involving a single sensor, an LCD screen, and a small speaker for playing some cheesy music.  I play drums, and I was kind of thinking of the whole mint tin as a drum, with the plastic screen acting like a drum head.  The other side, made of metal, would host the LCD screen and speaker, facing the “player”.

(Product endorsement: Don’t worry about eating through all the mints before you start this project – they’re actually quite good…)



  • Arduino chip (ATMEGA328P), with an already-programmed bootloader (can rip out of an Arduino board, or purchase separately online)
  • Hitachi HD44780 compatible 8×2 character LCD module
  • 20 mm piezo disc w/ wires attached (bare, no plastic casing) (ebay is a good resource)
  • small 4Ω speaker w/ wires attached (taken from another device)
  • small 10 KΩ trimmer potentiometer (Jameco 1967512)
  • battery holder for CR2032 (Jameco 355434)
  • 2x CR2016 button cell batteries
  • small slide switch (Jameco 161817)
  • female headers (Jameco 308567) (will need 10 recepticles, but you need to cut these up – get extra)
  • 1 MΩ resistor
  • 2x 100 Ω resistors
  • solid-core wire
  • wire-wrap wire
  • small pieces of duct tape and clear tape
  • Trader Joe’s green tea mint tin


  • Arduino board with the chip removed, used for programming the Arduino chip on the mint tin board
  • jumper wires
  • hammer / nail or something to puncture the tin
  • scrap piece of wood
  • nibbling tool (Jameco 18810)
  • good soldering iron / solder
  • hot glue gun / hot glue
  • wire strippers / snippers
  • “helping hands” soldering aid (not necessary, but recommended)




The schematic, Fritzing layout, and Arduino code can be downloaded here.

1. Solder some of the main components on the circuit board.

mint_tin_hero_layoutIt’s tough to cram all this stuff on a tiny PC board.  This project might test your soldering skills and/or patience.  But, as with many things, if you’re getting frustrated, it’s always best to walk away and come back later.  (I definitely had to do this a few times…) 

Anyway, if you take a look at the layout of the board, you’ll see that there are a lot of overlapping wires and such.  The red lines are the positive (~5V) wires, the black lines are the negative (0V) wires, the gray lines are the solder lines running on the underside of the board (where the little metallic circles are), and the other colors are just other signals.

(Note that some of the components in the diagram don’t perfectly represent the “real-world” parts – e.g. the LCD screen shown is a 16×2, rather than a 8×2, but bear with me…)

DSC_0005The easiest way to start off is to get some of the big components on there: the Arduino, the battery holder, and the switch.  Just dab some solder at the corners of the Arduino to hold it in place.  Make sure it’s oriented the way shown in the diagram.  

The power supply for this circuit is a bit of a hack.  Usually, you don’t want to run power directly from the batteries – normally, you’d want to have a 5V voltage regulator.  Instead, we’re hooking up an unregulated 6V supply (two 3V batteries) right to the digital circuit.  Blasphemy!  It turns out that the batteries actually don’t supply enough juice to support a voltage regulator, and the Arduino and LCD module can handle the 6V ok (actually more like 5.8V).  So, there you have it.  Sorry if I’ve offended anyone.

2. Cut up and attach the headers.

You will need to cut up some of the headers for use on the board.  You can cut them with wire snips – I would recommend just cutting directly through one of the holes, effectively “wasting” a hole between pieces.  You need 2 3-hole headers placed next to each other to make a 3×2 header.  This will be used for loading your code onto the Arduino later on.

The other 4×1 header, in the upper left of the diagram, is not necessary if you are using an Arduino chip with the bootloader pre-loaded on it (e.g. a chip pulled off of an existing Arduino board).  I was using a chip that did not already have the bootloader configured on it, so I needed this header to program it.

DSC_0006This part is a little tricky: to connect one component to another, you need to “drag” the solder around from hole to hole on the underside of the board.  This can be a little frustrating, and a “helping hands” tool definitely comes in handy here.  Try connecting the leftmost pins of the 3×2 header to the Arduino pins directly next to it.  I found that a good way to do this was to get a good amount of solder on both the Arduino pin and the adjacent header pin, and then put the soldering iron tip right between the two holes, and then lift straight up in order to leave a connecting line of solder between them.

3. Solder in most of the other components and wiring.

Using the technique described above, solder in the two resistors on the left side of the Arduino (a 1 MΩ and a 100 Ω).

Also solder in the wiring on the left side of the Arduino.  Hold off on the potentiometer for now (if you already put it on, it’s not a big deal).  The bottom of the board is a “ground line” – there is solder running across the length of the board, all connected to ground.  This will require a bit of dragging solder around.

The right side of the Arduino is a little tricky, because there will be will be some wires that DSC_0010extend through the board in order to connect to the LCD module.  When you strip these wires, leave a good inch or two of stripped wire poking out the back.  You will later need to thread all of these wires (and actually one resistor) through the holes in the LCD module.

There is one little “<” shown in gray in the diagram on the LCD pins that you may want to use wire-wrap wire for – see the potentiometer section below…

(NOTE: The image above and a few others in this post are not 100% accurate.)

4. Solder on and hook up the potentiometer.

I kind of screwed up when designing the board, and thought that I could get away with not using a potentiometer to control the contrast of the LCD screen.  In my original version, the screen ended up being way too dark to play the “Mint Tin Hero” game.  So, I put the little potentiometer in there as an afterthought.

Because the board is so tight on space, I think that even if I had originally planned on it, it would have been pretty difficult to wire up all the appropriate connections to the potentiometer.  So, I ended up using some very tiny wire-wrap wires to connect the potentiometer to where it needs to go: ground, ~5V, and the Vo contrast pin on the LCD module.

The output of the potentiometer needs to connect from a wire-wrap wire to a single solid core wire sticking through the board to the Vo pin of the LCD module.  This was a little tricky, and you might have to get creative with the wires and soldering here.

If you get past this part, you can consider becoming a surgeon.  Stripping the ends of the wire-wrap wire can be a little difficult.  I made little “hooks” with the stripped parts of the wire and hooked them around the solid-core wires and such sticking out of the back of the board with tweezers, and soldered.  You can do it!

If someone figures out a better board layout or way of getting the potentiometer connected, please share!

5. Solder on the speaker and piezo.

Just solder these on where the diagram shows.  They will be dangling off the board for the time being…

6. Connect the LCD module.

This section is called “Connect the LCD module”, but don’t actually do that yet.  First, check, then double-check, all of your work!  Once the LCD module is on there, it covers up your soldering, and there’s pretty much no getting it off.

DSC_0016If you are completely satisfied that all the connections look solid, and everything is connected as in the diagram, then cut a piece of duct tape to cover all the soldering and wire-wrap work on the underside of the board (aside from the wires that are sticking out for connecting to the LCD module).  This will prevent unwanted electrical contacts.

Now, use some pliers to make sure that all the stripped wires sticking out are as straightDSC_0017 as can be.  Once they are, start sliding the LCD module onto your board.  Try to get it as far down as it will go.

Once it’s all the way down, solder that sucker!

7. Glue on the speaker.


Use the hot glue gun to glue the speaker to the duct-taped section of the board just below the LCD screen.

8. Almost there! Cut up the mint tin!

To start cutting away at the metal side of the mint tin, you can punch a hole through it with a hammer and nail.  Use the scrap piece of wood so you don’t destroy your mom’s nice countertop.  You can do this a few times if you want.  Be careful – the tin isn’t very sturdy.

Use the nibbler tool to make a nice, neat cutaway area for both the LCD display and the speaker.  I don’t have any good dimensions to give you; just estimate the best you can.

Once the mint tin is ready, you can squeeze the module in there and stick the piezo DSC_0026sensor to the clear plastic screen of the tin with a piece of tape.

9. Software…

You can write your own code for this project, or you can download it at the top of this post.

The code has programmed into it two songs: just two that I like, which I thought had simple, well-defined melodies and rhythms.  In the hopes of avoiding copyright prosecution, I’ve left the artists and titles out of this blog post, but you might be able to figure out what they are by listening.  And if that doesn’t work, you can always read the comments in the code.  If you feel like programming in your own songs, you can!  But it’s definitely time-consuming the way I have it set up…

The trickiest part of the coding for this project was reading the piezo sensor input while still controlling the display and music.  In addition to controlling both things at once, the code has to “debounce” the sensor input, and be careful about registering only one hit each time the user taps the back of the mint tin.  Then the code tries to decide if the registered hit is “good” or not, according to the closest beats in the song.

The other tricky part was dealing with the fact that the Arduino only has 2 KB of RAM.  I had to do a special trick to keep the music and strings in flash memory, and only read them out into RAM when necessary.

The code uses the LiquidCrystal library for controlling the Hitachi HD44780 compatible LCD module.  There are a couple of custom-drawn characters in the code, too.

10. Keep your fingers crossed and try it.

DSC_0015To load the software on, you have to connect the mint tin hero board up to your Arduino-less Arduino board (which in turn will be connected to your PC over the normal USB cable for loading software, but don’t connect to your PC yet).  Follow the diagram for the 2×3 header for the TX, RX, RESET, Vcc, and GND signals, and hook these up to the Arduino-less Arduino board.

With your mint tin hero board off (switch away from the outer edge of the board), connect the USB cable to your PC, and attempt to load the software.  Keep your fingers crossed…

If everything went well, you should see the LCD screen light up with “Mint Tin Hero!” displayed!  Congratulations!  (Well, you know, “congratulations” if it worked…)

You can disconnect the jumper wires and put in the two CR2016 batteries with the + side facing you.  The battery holder is meant to hold a single CR2032, so this is a hack – you want to make sure the that the little tab on the side of the battery holder is touching only the outermost battery’s + side, and not touching the inner battery at all.  You can flip the switch again and turn it on.

Final Thoughts

If you decide to try this project, I’d love to hear about it.  Good luck!