Light Up Raccoons

A little coin cell powered raccoon with capacitive sensing to light up its eyes

Similar projects worth following
A small trinket I made where if you press the belly of the raccoon artwork, the LEDs in its eyes light up briefly. It is powered off a CR2032 coin cell with an ATtiny85 running the show.

With the power optimizations made, none of my units have needed a battery change in the year that they've been in the hands of friends and family!

My sister prepared the artwork for me.

I wanted to make a small circuit gift for some friends and family. My main consideration was that it had to be flashy and easy to explain so my non-engineering mother would be able to show it off, so blinking lights it was. As for a nice design though I decided to go for a raccoon since some of my friends really like them and its a nice homage to my home of Toronto. Combining the two I got this idea for a raccoon with illuminated eyes.

To get it to work I didn't want to have to buy any new chips since there was still a drought of most microcontroller I was used to using, so I decided to use the ATtiny85s I had laying around that seemed to have very good low power consumption and the potential to do some capacitive sensing! To get the system running required a minimal amount of code really, although it took me a while to really get the power consumption as low as I could without greatly sacrificing functionality.

The circuit is quite simple, and the board my first attempt at PCB art. I think my sister's artwork came out quite nicely after I imported it into KiCad.

Assembly was easy and programming required little reconfiguration on the final boards.

KiCad Project of corrected raccoon board

Zip Archive - 364.40 kB - 02/02/2023 at 03:03


Arduino sketch with the modified TinyCapLib included

Zip Archive - 3.64 kB - 02/02/2023 at 03:00


  • 1 × ATtiny85 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 2 × LED Fiber Optics / Emitters
  • 1 × 100nF Capacitor
  • 1 × 1uF Capacitor
  • 2 × 330 Ohm Resistor

View all 7 components

  • Look Ma, I'm on the Newsletter!

    Savo02/23/2023 at 06:20 0 comments

    As part of my entry in the Low Power Challenge I ended up getting a shout out in the Hackaday email newsletter for February 15th!

    I dig the title

    Needless to say this made me really proud! I look forward to seeing how the competition goes and am enjoying checking out the other submissions for ideas on how to improve things for this project or others going forward.

    When I shared this with my family my sister was quick to point out that it wasn't entirely my project as she had drawn the art, alas, I'm the one that did the other 80% of the work.

  • Reflections

    Savo02/02/2023 at 01:29 0 comments

    I started this project in November of 2021, and wrapped it up when I got my boards at the start of March 2022. I handed the raccoons out and they were well received by everyone. I actually had a friend offer to pay for one, so that was the first time my hobby netted me some revenue!

    A completed raccoon board
    A completed raccoon board

    Since then I had fixed the issue with the programming port and uploaded the revised version on my GitHub. I tickle the one I keep on my desk pretty regularly and yet it, or any others from its litter, have needed a battery replacement (I've asked!). So I'm proud that my work into reducing power has paid off and I got to share a little bit of my hobby with people along the way.

    I originally wrote this up on my website but re-uploaded it here to enter the Low-Power Challenge. It's been nice to look back on what I wrote and touch it up where needed.

    Hopefully you like this project too!

  • Final Touches

    Savo02/02/2023 at 01:19 0 comments

    With one board complete as a proof-of-concept, it was time to progress to the final stages.

    Tuning the Code

    Since the capacitance of the boards belly pads was different to the jumper wire I used for prototyping I had to adjust the threshold values a bit to match. This took a few trials but nothing too bad, just about 20 minutes all in all.

     Similarly I had to decide how often to have the raccoon check the pad for changes in capacitance. This needed me to weigh the responsiveness of the system to how long they'd last on their batteries. In the end I found that having them check every other second was generally responsive enough. Using some rather simplified math with generous assumptions, the estimated life was found.

    Where P was the portion of time that the ATtiny85 was active (checking capacitance. I didn't bother to include the time the eyes are on since I assume that this will be a very marginal occurrence, perhaps no more than five times a day so it can be neglected. By checking once every second, the P would be about 0.01 since the check would taken 10ms itself on average. The idle current was treated as 4.5 uA, the active current 7.2 mA.

    Doing the math this gives a rough average current of 76.5 uA, which using the reference 340mAh for a CR2032 cell would give about 185 days on a single battery. Less than the year I wanted, so I halved the check frequency which would almost double that lifespan!

    Mass Assembly

    I assembled nine boards of the ten I ordered (one was lost to my ATtiny harvesting when I had issues with power).

    Several completed boards.
    Several completed boards.

    A group of raccoons is called a nursery or a gaze. I however feel that gang is more fitting for the little thieves.

    All but one of these boards have been handed out as gifts by now.

    Making a Stand

    In addition to the board I wanted to make a small and simple stand to hold the boards upright for people. I wanted to make it small so I could send it easier, while also being easy to manufacture and later assemble. I decided on laser cutting some parts from 1/8" (3.1mm) thick plastic, since I have a few friends that can arrange this for me.

    My final design was a set of four interlocking pieces that the board simply slides into. Two parts hold up the board, and the other two are used to hold them 50mm apart. This was my first time using FreeCAD so it took me a bit longer than I would have if I was using SolidWorks or Inventor, but I think the results are nice anyways. Might need to brush up on how to make nice drawings though.

    Part to hold the circuit boards upright
    Part to hold the circuit boards upright
    Part to space the two holders
    Part to space the two holders

    I made one round of prototype parts to see if the width of the slots was just right. They were a bit loose so I narrowed them and the results were just right as shown below. (These final dimensions are reflected in the drawings above.)

    The assembled stand
    The assembled stand

    Final Result

    With the stands designed, I just needed to have my friends cut more pieces for me and I was able to start handing them out!

    Raccoon standing proudly, ready for a new home
    Raccoon standing proudly, ready for a new home

  • Testing the Finished Boards

    Savo02/02/2023 at 01:09 0 comments

    Once I had assembled my first board I began to test it to make sure there weren’t any issues stemming from my assembly nor the design itself. The initial power applying test passed, current was drawn at about 10mA when 5V were applied, which was what I expected for a blank ATtiny85, so no obvious shorts or non-functional components.

    Programming Issues

    Since the board passed the basic power-on test I went to try and upload some basic code to the ATtiny85 using my ATMEL-ICE in system programmer. I plugged it into the header but failed to get it to work or even recognize that it was connected to a system, it didn’t even tell me that the target was powered which it certainly was!

    After some poking around I decided to double check the connections, since they tend to be the culprit of most electrical issues. Sure enough, it was! It turns out that my connections were prepared correctly on the schematic, so each signal was on the correctly numbered pin - however, I had accidentally selected a pin-socket, not a pin-header for the footprint so the pins were mirrored.

    The mirrored layout used on the manufactured boards
    The mirrored layout used on the manufactured boards (as viewed from the back side)

    Below is the proper layout, note how number-for-number they match properly. It is a good thing that I was using a proper programmer (I had got my ATMEL-ICE a few weeks before I started this) and not supplying power on these mirrored connections before I figured this out, otherwise I would have likely fried the ATtiny chip.

    The proper layout of connections
    The proper layout of connections

    This was quite annoying since I needed some intermediate connectors between the programmer and the board to route the signals properly. If this was a through-hole header I could have simply put the header on the opposite side and that would have corrected this issue too.

    Initially I used some M-F ribbon cable jumpers to re-route the signals between the programmer header of my ATMEL-ICE and the raccoon. This seemed to work, but only partially. The board/chip would be recognized, but any attempt to write any code to it would result in failure since the ATtiny would fail to respond with the correct device signature. I found the cause to be the excessive length of my programming wiring (roughly a combined 35cm from end to end) from some forums online. Since I did not have shorter M-F jumpers to use with my proper programmer, I opted to use my ol' reliable Arduino as an ISP system which would have a shorter wire length, which worked!

    Using my Arduino as an ISP
    Using my Arduino as an ISP

    Even though I could continue using the Arduino as an ISP, I wanted to use my programmer since it was safer and would also make it easier for me to ensure that the power draw was what I expected since the board could not potentially draw power from it instead of from the monitored power supply. Since I didn’t have some shorter M-F jumpers I made a F-F adapter using two 2x3 pin-sockets soldered end-to-end which would then allow me to use my short M-M jumpers to mirror the signals between board and programmer. This solution worked and I kept it for the remainder of my development process.

    The adapter setup to mirror the connections for the ATMEL-ICE.
    The adapter setup to mirror the connections for the ATMEL-ICE.

    Power Draw Issues

    Once I was able to reliably upload code to the raccoon boards I went ahead to check the power draw of the boards met what I was expecting, roughly 5uA at 3V, when in deep sleep. After uploading my previously prepared code to the microcontroller, I started monitoring the power draw and… it was off the charts! The maximum draw was supposed to be roughly 10mA when the LEDs were on, but this board was drawing over 20mA with them off!

    This honestly scared me, since this was way above what I expected. However I tested it and the system worked, reacting to my finger as expected, just gobbling up way more power than expected. The power draw seemed to vary over time, rising and lowering to the tune of several mA, which struck me as odd since its behaviour was constant. So I left it to run for a while...

    Read more »

  • Board Assembly

    Savo02/02/2023 at 00:58 0 comments

    This was the first time I had ordered gold-plated boards (ENIG process), and damn were they more expensive, a scratch over triple what I usually pay per board. I think the cost was worth it though when I saw and held them.

    The boards as they arrived.
    The boards as they arrived.


    Assembling the boards was pretty basic, I just hand-soldered everything in place. In order to bring the DIP8 package for the ATtiny85’s close to the board I cut the leads a bit shorter with side cutters.

    The assembled circuitry on the rear of the raccoon. Note: the wires were used for power delivery during programming.
    The assembled circuitry on the rear of the raccoon. Note: the wires were used for power delivery during programming.

    A minor side note, but I really like the look of parts on these gold-plated boards before soldering.

    The ATtiny85 placed but not soldered
    The ATtiny85 placed but not soldered

    Plating the Belly and Eyes

    Since we wanted the belly and eyes to be silver I had to hand coat them with solder. This was easier than expected although the belly cooled quickly so the soldering iron would leave “ripples” of solder as it moved across the surface, like a paint brush.

    Hand soldered. Note the ‘brushes’ on the belly.
    Hand soldered. Note the ‘brushes’ on the belly.

    I found that if I applied hot air as I moved the iron I could prevent the rapid cooling and result in a smoother belly plating. The effect is quite similar to Hot Air Solder Levelling (HASL) typically done for cheaper boards.

    Hot air used with soldering iron to result in a ‘smooth’ belly.
    Hot air used with soldering iron to result in a ‘smooth’ belly.

    I was a bit torn between the entirely hand soldered or air levelled belly coat. In the end, I hand soldered bellies for the ones I handed out since it was easier and I felt there really wasn't that perceptible a difference.

  • Board Design

    Savo02/01/2023 at 18:30 0 comments

    In addition to this being my first power-conscious project, it would also be my first foray into PCB artwork. Luckily I wouldn't need to make the art myself, my sister handled that.

    Schematic Design

    As mention in my first project log, the circuit is pretty simple, other than a handful of passives and LEDs it's really just an ATtiny85. When I started making the board I considered using an ATtiny1617 since I also had a few of those around and they had hardware peripherals for capacitive sensing as opposed to the hack that allowed the ATtiny85 to work. I believed that it could squeeze even more life out of the batteries, although I never tested this since the ATtiny85s performed just fine.

    The completed schematic for the raccoon board (PDF version: Colour / BW)Schematic for the raccoons

    Board Design

    I am not an artist, luckily I was able to enlist the help of my sister to make me the artwork I was looking for. I gave her these requirements:

    • Cannot exceed 100mm x 100mm
    • Limited to the palette available for my PCBs, based on the PCB production limitations.
      • Lighter black (copper fill under solder mask)
      • White (silkscreen)
      • Silver (solder on exposed copper/gold)
      • Gold (plated copper)
      • Black (solder mask over no copper)
    • The tummy needed to be filled with copper.
    • Need a specified outline

    With these she produced the following image for me to use. Originally a vector image then I converted it to a bit-map. The base image prepared, with a green outline.The base image, with a green outline for the edge cut.

    The reason I originally had her prepare it as a vector image was to make use of Gerbolyze for putting the art in place. However the problem with Gerbolyze I found was that it is meant for non-functional art, which means it will maintain a clearance around any functional parts of the system, not acceptable for me since I wanted the raccoon’s stomach to be connected as a capacitive sensing pad.

    So I moved to using KiCad’s built-in bit-map to component utility. This allowed me to convert individual PNG files into the polygons and use them in any layer, e.g. “top silk screen” or “bottom solder mask”. To use it I broke down the art into the layers each feature needed to be on.

    The polygon used for the stomach as a capacitive sensing pad.
    The polygon used for the stomach as a capacitive sensing pad.
    The areas that needed copper other than the stomach.
    The areas that needed copper other than the stomach.
    The areas that needed solder mask removed, for gold and/or silver.
    The areas that needed solder mask removed, for gold and/or silver.
    The white silkscreen component.
    The white silkscreen component.
    The raccoon’s outline.
    The raccoon’s outline.

    With them all converted, I got the following render of the board. Looked sweet! Note that in KiCad I couldn’t selectively set the pads that would be coated in solder so they would render silver alongside the gold, hence why it is all gold.

    The render of the art in KiCad (with LEDs already in place for the eyes).
    The render of the art in KiCad (with LEDs already in place for the eyes).

    Look, it has a little belly button!

    Functional Layout

    With the art in place I had to do a bit of routing for the electrically functional parts. Since I wanted the art undisturbed (except for the eye LEDs), I had to try my best to do all the routing on the back that I could. I was successful in this thanks to some very windy traces, vias are used to deliver power to the eyes with them emerging at the LED pads where the LED will cover them.

    The layout of the rear (circuit) side
    The layout of the rear (circuit) side

    The uninterrupted front view

    The layout of the front (art) side
    The layout of the front (art) side

  • Power Saving Code

    Savo02/01/2023 at 18:15 0 comments

    With the capacitive sensing and LED driving code complete, my focus shifted to the meat of this project: power saving. I wanted this system to operate off a coin cell battery so it could be put on display wherever someone wanted without needing a power connection and I didn't want people to have to change the battery more often than once a year or so.


    I first began by trying to have the system idle using the delay() function for ten seconds between checks. I hooked up my multi-meter to monitor the power supplied to the system and began to monitor. For reference, I planned to use CR2032 batteries, which provide 3V with a capacity of around 340mAh.

    Current draw when using delay() to idle for 10 seconds at a time. (5V, 8MHz)
    Current draw when using delay() to idle for 10 seconds at a time. (5V, 8MHz)

    With the ATtiny85 running at its default 8MHz internal clock at 5V, the current draw averaged about 7.2mA. This would kill a CR2032 in just under 48 hours. Although not super relevant to the project, it was odd to see a noticeable saw-tooth pattern to to current draw as it steadily increased during the delay() call. I wonder why that was.

    With this (horrible) baseline I went about doing two simple things. First I lowered my supply voltage to match the expected 3V it would have in system (instead of 5V), and then lowered the clock of the microcontroller from 8MHz to 1MHz. These corresponded to a 33% and 75% reduction in power draw, down to about 1.4mA with both in effect.

    Then I began to change my code to save power. First I started by following the recommendation in the data sheet (Section 7.4.6) to drive unused pins rather then leaving them floating. If left floating they will hover around half the supplied voltage and thus constantly toggle the digital input buffers between states, drawing power. This is shown in the plot below, where the unused pins are driven low for the leftmost (oldest) section and right most, but left to hover in the middle. This saved me roughly 1mA!

    The difference in current draw when unused pins are driven low (start and end) compared to them being left floating (middle).
    The difference in current draw when unused pins are driven low (start and end) compared to them being left floating (middle).

    Idling at about 1.4mA of draw, meant that the system would last about 10 days. Still far off the several months I needed, let alone the year I wanted. I knew the ATtiny could do better since they advertised a sleep current of only 1.8uA at 1MHz and 1.8V. So I started looking into how to properly disable peripherals and put the microcontroller into sleep modes, rather than just using delay().

    Power Management Library

    Using the AVR power.h library helped me disable power to peripherals that I wasn’t using to save power, by using "__power_all_disable()" and "__power_all_enable()". I also wrote to some of the power management registers myself where it seemed the the power library didn’t have an effect.

    // Reduce power use by disabling peripherals
    ACSR |= _BV(ACD); // Disable analog comparator
    DIDR0 = _BV(AIN1D) | _BV(AIN0D); // Disable digital input buffers on analog pins (we don't need digital in)
    PRR = _BV(PRTIM1) | _BV(PRTIM0) | _BV(PRUSI) | _BV(PRADC); // Timers, universal serial interface, ADC

    These lines of code shaved off a several hundred uA, bringing the system down to about 800uA idle current consumption.

    Sleep Library

    The final frontier of power reduction was getting the microcontroller to sleep properly. In deep sleep basically everything inside the ATtiny is shutoff with the exception of the watchdog timer and some of the input systems so that the microcontroller can be brought back into action. Since I wanted the raccoon to check periodically, every couple of seconds or so for a touch event I wanted to use the watch dog timer to pull the microcontroller out of the deepest sleep.

    To put the ATtiny into sleep I used the AVR sleep library. I would simply set the sleep mode in my setup with just "set_sleep_mode(SLEEP_MODE_PWR_DOWN)" so the ATtiny would go into the deepest of sleep when prompted. To put the microcontroller into sleep mode, I just needed to call "sleep_mode()",...

    Read more »

  • Capacitive Sensing Firmware and Circuit

    Savo02/01/2023 at 17:57 0 comments

    Once I had settled on the idea of the capacitive sensing circuit board art, I looked into how to achieve capacitive sensing ideally using the ATtiny85s I had laying around. After some research I stumbled upon the TinyTouchLib by cpldcpu (Tim) which accomplishes that exactly that.

    To make use of it was pretty straightforward, I simply had to change the pin allocation in the library's files and use the following code in my main file. First to initialize the capacitive sensing system:


    Then as part of my main loop to see when the pad was touched (start of contact, not held) and then turn on the LED for a short period.

    if (tinytouch_sense() == tt_push) {
      digitalWrite(eyesPin, HIGH);
      digitalWrite(eyesPin, LOW);

    Without getting too into the weeds, the way the library works is that it charges the ADC's hold capacitor to the supply voltage, and then it connects to a pin. Once connected to a pin the charge on the hold capacitor is shared between itself and that pin based on the new, larger, capacitance. Once this is done, an ADC reading is taken and the changes in this ADC reading over time are interpreted as changes in capacitance that correspond to contact.

    The test hardware was simple, just the ATtiny on a breadboard connected to an LED with current limiting resistor and a jumper used as the "pad" for contact. After some tweaking of constants related to the contact threshold, the code was finished. This was one of my few projects where the code was fully tested before I made the final system!

View all 8 project logs

  • 1
    Plate the board with solder
    • Plate the desired pads you want silver with solder. I personally wanted the belly and area around the eyes silver so I did those.
    • Use a soldering iron to heat up the pads and a hot air rework gun to help level the surface if that's the effect you want. Without the hot air gun the solder may cool quickly leaving a sort of "brushstroke" effect on the surface
  • 2
    Assemble the components
    • I personally started with the LEDs on the front since they didn't really make it the raccoon rock much when working on the back.
    • I found that cutting the DIP leads right where they narrow was about ideal for putting the ATtiny85 package flush with the board.
    • Use solder paste for the programming leads so it can be easily removed later. I used normal lead-free solder on the rest of the components.
  • 3
    Program and tune the board
    • Tuning the capacitance thresholds is a bit of an iterative process.
    • Since I used the SCK pin for sensing I had to disconnect the programming harness to properly assess if it was detecting my finger. Otherwise the parasitic capacitance of the wire may have made it hard to discern if it was my finger or the wire influencing the capacitance observed

View all 5 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates