element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
CodeBug
  • Learn
  • Learning Center
  • STEM Academy
  • CodeBug
  • More
  • Cancel
CodeBug
Documents CodeBug Hack-O'-Lantern with Animated Eyes
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join CodeBug to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: spannerspencer
  • Date Created: 26 Oct 2015 2:44 PM Date Created
  • Last Updated Last Updated: 26 Oct 2015 5:33 PM
  • Views 1607 views
  • Likes 6 likes
  • Comments 6 comments
Related
Recommended

CodeBug Hack-O'-Lantern with Animated Eyes

I love Halloween. I prefer it to Christmas these days, for lengthy reasons we won't go into here, but not least of them is the opportunity to scoop out the brains of an unwitting pumpkin.

 

In an effort to best last year's impressive effort (if I do say so myself)...

31035_4976888779549_1263855688_n.jpg?oh=af4057297df7cbe6bb8a899b1bb5e317&oe=5687763A

... I needed to up my game. Technology to the rescue!

 

So join me today in creating a Hack-O'-Lantern that stares right back at you (and into your very soul) thanks to the magic of CodeBug. Two CodeBugs, actually. Here's something to get you in the spirit before we begin.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Prep Ya Pumpkin

I'm not here to tell you how to hack a pumpkin into a Hack-O'-Lantern, but can't resist one or two quick tips.

 

I cut the hole in the top with the knife at an angle, so you get a clean cut but the "lid" doesn't fall back into the pumpkin when you replace it. And a notch somewhere in the lid makes sure it always locates in exactly the right position, so it doesn't look like you've had a machete in there and left Jack scalped. I also thin out the front wall, where you'll be cutting out the face, from the inside. Just makes it easier to add detail to Jack's features when you aren't sawing through 20mm of flesh.

Pumpkin DpetRsGm3y9p4LTHjkw66vzVgnNBN_tum8ZnofzNwjOP56jZGkMIIsQE0AqXxI6hLgGu1z3caIKWOgBaKn6JKw4l5fPD-5ycXr9SUm7MoEe4n7SUppT_DMMXv2Pl7oe_2LwfTk7I9oa1_4f5jYIzcQ_mt9mu2QrX7vJLQzvRaZQDIJwnwdb96mNm1ZNdMiC9irSEMx0XTGiDox_zFZyalbQ6p7v-X4GlIipXevKxned2E4nn0si4kx3NIi4OXxne1_SEPgxdqPB7lj1ZUsxHlYV5bnO4ZrzJOt2vo7u752Ma4K6f41h_z2AE5M7LSV3vNQ18sZA-V2AjtWaZiiLzTW70NaBnAa3yqMLHjB5w26Vs5yoO6XZJ7-ZFmKi2yXKT8QV0H2dNRzGDxCiKO9MPnEBnMThQ-QhXUMc7AqNniPX3P6uK6MQIoE_PkbXYrsBBPjk6ox4vlrOTyIqPuegxCrbXAl22-GklX8cQpxnNEnvgoET18ocD-QLQ8tXmogKE_b2bomIDImH99vNhyVGpTjo_15oU445ZrCuCjQvLeL8=w1378-h775-no

It's also worth giving some thought to the eyes, and ensuring they're big enough to be able to see the CodeBugs' LED displays through them.

 

Don't Stare at Me, You Got the Bug Eyes

I went back and forth for a little with having two CodeBugs working in tandem. It was pretty effective having one triggered by the other, using the legs as inputs and outputs, but ultimately it was an unecessary complication. We'll get to that in a moment, though.

 

Firstly, I whipped up a couple of sprite animations for the CodeBugs, which will providing Jack's red, glowing pupils. They're pretty much identical to one another, except the eyeballs sometimes slant in the opposite direction, so two separate programs ensures they're a mirror image of each other. Both are attached to this doc, or you can check them out over on CodeBug.org.uk and remix your own.

 

As previously mentioned, triggering one from another ultimately wasn't necessary. Instead, I just wired the two Bugs in parallel, so they both activate at the same time.

 

In the image below, you can see that the two GND (ground) legs are connected together (black wire), with a flying lead that'll connect to the inside wall of the pumpkin. Leg 0 on both Bugs are also connected together, and have a longer flying lead that will connect to the lid of the pumpkin, so when you place the lid on top, the eye animations begin. Simple and classic.

flt6mz2K-LT51zqi-0F071HmPvdW-Ux_cUnx8LfvgzpavmVMNpH4vjDlirIyJi6orWp5uvdtJj4v3iJnA1pv9WA4efqQyRLgaXu28gGRa3RWBewAR3elJ-6pN8AFJzwWWxCwzZ9v0XsusSpZAYnCfPsfwbNsIwcHqBAu2eoSkKPPcJxLcAVF0Kp0fPxdVNCDgpYiFZpGnfUsQMjIvTtYX1LjfhflzrWXBqYT4bKIGHy_UNsTYNqMwUP-9UC9fJ5qJaI4wI4XrlZPlBPcRSrbu2io9PmMPnB_7rryJg6JMDWOW7oUQiEo_M-R-QFyx_-FhvSoRTeSrizusYn3CwinQHh5nTjldXAFLo8mJjN5ZVDTWVoYj5STLSadSiRHgV2vFGe2OQBvi3ciYJQF6FvUeAVH8_q-Fut1lxYUD2dl0qq-g4iGuL7G8Pg_C31YRbQ-cc5uOqUpym1aDz8UKWOQyDC61vUg6rnMVMVAzaZJidtc3WClLT3XqjyAN0rzKgqrMWnPUbp6vLhKmMmnyD1C-k94lbHHzI3G_O8LTtPkIcw=w1300-h731-no

To cover up the PCBs of the CodeBugs, I went with black tissue paper, although thin fabric would work just as nicely. So when it's not running, Jack's eyes look black, as below:

-cEAVSDqAhrTSrL34CmB5r-Ow25Gn_QmmgS58ZIpq13sjq8vwjWFyQgDVlfCck0uhbILvm9VKCKS7WhrHhIhaielb83Q9VZ-zdTPoS3PAD_pHF1gf_q_l-nowEik9amH2ZWoizt_ZjVhBHXkNKG86pCFns6MHRoUTNX6N7BxSoCtdzKgR_KUi8FzvYnevRgv-zDbyvpyxWtx-joeICLSGZdzip2BIx6ufeALd5OlqLiCbGRaIJFqFTZ_DmJK2qLgCRikjyqUdsLWV9LP5nbvEC3UL6Vajb9seQCUrO4xjuMePK3Wp7RccI0fcMEllWX2MvLmPFVbz5udap8CaSc3UuaHEft4N5tVjt6JqCjZLNzenmz-sFXMtY3Mi1GJWYcHi0ckfI1p-1m5gUL6lX3WgcL421ObUzNhtKk569DzivNoOfqm1JZD5Qr7fpHjIFdCnsx6VYbZq7sJy65-j_wxTwU6FeTuUm4IcXcphyow0n5dwqG8iFdgkztRD7G7OjRprSeEPMHt1vEQ2JKMcoHcL5nTljbTE5pOWgzQpRcxSos=w1300-h731-no

Make sure you get your spacing for the eye sockets correct, and tape (or sew) your CodeBugs into position behind the tissue paper (or your choice of masking material). I then folded the tissue paper up into something of an envelope, and added a few layers of tape to the top where it'll be hanging from (given that tissue paper is likely to tear).

-Uda8fNFIdkE7qTF83_g7jhdEJbM47lczjAATz_U8HA8f4xB81DNHMgS3eUcG6Kr2eAX7oIXrwr26dZe4Ao0hZ1DZIPGX0Q0wS1DR96oojdq4psAWoGpaxp7zELs4FNB4kBpFD8xC04PoF3j3WEvzKTP63YfD1rAoRYmQE3SOEa0uXvC9m44FIcvmEm2ybbSe26W44CxH1Zypz3YD1KkOStbTTSdXWrdqETDw_TY52S27fewywBgTk3FKAX4neVM46-VdCRFUVspKkQwyv1FTPMiyS_rXqFI7Zxn3lolmvMT8LrnU6gZSrm7YXVLHSuFnZNfD-DjhvqWE5O1kNnTn50XnnKsxcVWrNzLttIVofpfc9mj7gYR2ec35qmbSefrmM61jnrohSXPCSor3Rf1btC-fI1Kt0K9wlTo65oIfXHdWsLV_XVcbC5RmbhsvvPpOM6wdYoAFQ2m9poPeNn92XYOUmJ-5d2OXyS6EBRezvu_0JsnF7gLcLf7VNZSfqjJlI92zgoRLg_vM1-G-MmoKz5oRCFhsDohZj_oPnW946o=w1378-h775-no  Qxs1MYyCjDnQdjSyYtow3ucERd0VOtTsebbvp46zejswMrwhAFX-IfVqbALO7OZGQmdXJsWrSEwuMQfBc6pOZy2Smk6TrdBvVEXvynLI4KNuFGgyV_1neXFCTYB2V2CZJBE33Ly_qHlbAkxpsRizHHj1g_fOf1EDrjTRvNTuk3fzLaeOsAj-5PSiKLykHjde23bbnZIvhyAKxK5uURaGHR2ZOrS0lB81O-UluYZ319eiyHELgHNR_FqFY0SSHbX13tqreAVr0ACzL3ZPXtXU01oVr_gX_fiqF7oYBADBkVhy6CI5qXQ6XDRBvQIPOJp67dyFBrVwro1hHMSwYk74MKRB-acwtDqtXcfTqekE4bN3NRg9P-dN7AmKFi_8UmvHS1KH2LuX_eqSvu3_8-hFETgw-ccFLqSlX6uU-UuzNgvNcFEDtJrsvS3sVNrnwXstprJbfsMZ13lHBYQUEhA54YkPUfqSjX6AcH5LSLAfuQtIQQp9lWb-F3Wapa7PknU9d8FcWXmc1dq-dn4WDC2qLyYmTFYdvFWj5oZfrxfGNdY=w1378-h775-no

Kinda rough and ready, but it'll do for a few days of Halloween scare tactics image I also put a bit of insulation tape around the legs where they'll be up against the moist walls (oo-er) of the pumpkin, just in case. If they get damp, they'll conduct and the eyes will switch on whether the lid's in place or not, so this is just a simple way to prevent that.

 

Strip the ends of the two flying leads and wrap each one around a pin.

4Tj5oAoDxnIR97r72tOVk3slkK2p-LTnJqfBmzIXvJSyzw-o1tbwjchQbO1ZJO3CmvpOd0-WiPaIKOa0sNhN3jFbx0dNeJgy_TUCz0IU0bilxtxsTaeFBTT3N8PVlYGKQOlwVuv4YhLWrT0aGbsGg4CanvUXtgu1BqcX0SS4JpVTmKHhz4rie4q2nv-vlP--arrMaKtA6obvTEFTqIsiF505JMvnp5anTsPa9YCjD-KhBxELyn5g_Bt-KFJYaSM6t-G13pGZ8RXKCU8KGo6Qo13T4nWTjPsb7T9U9jlSZZ8WHkGzJNRQTm-ekoT7mEmKSCIP_BSqYJM72aKjbqs4nszIB4S2-EMwVehG_Y2JrV-_7L99MZHGuCDZmcIKD9D8FgqzlMljdju8hqrNoYKSC2UIGROs7ZDoNGaOq8wzrCwOJQH-Z0zvqcwC9QVqF80sQoKQrXM5H0ydaB77ZZR7B9dNsBEAKx_qmIDZ8D8DpRnryCrLzAx5XxG-8l2MAvXhXCX9sYb-b-N964abn1PGsu6JJECxQreHlNEs-hfgV3s=w1378-h775-no

Stick one pin into the wall of the pumpkin (doesn't matter where, as long as it doesn't poke all the way through) and the other into the lid. Now, when the two pieces of pumpkin touch, the CodeBugs detect that Leg 0 has been grounded, and begins running the animation.

Ddtv9b4bjCh6OJNXfeOvVCFYvAMsPkGTswx6nEYrNxgaCXOuiPlW1EOfN18wtPwWFRkrDklHVVSdFw-fPfhxhG_ZAiIYoHxSzYVEjzAY22DZyOxCUzw2Ox3lfGqkG7BTlVJIUorYjBDMLL_6fbWypacZtHgmOzBQgO9q7zf1aFvj9_oaXK2WpCkMvQDWtvTj7nU6ISeCv27LviCfW0ETTOFJvVavXIsLdWD_LdDmme7cqMqCG6iC_HQZCbTfa76MUpkkVinTwR5VzzzYQyTOD25Y7UshEwUsFCk4UpoNsMzN_cvBIE3PxwnyX3RIqTvXZeaFeoKLg_XiSWrEyUV42VLb5FQNRaf8jC_ABV2Np0xesInRW5jAWNFJduCFZvy3Bcu18hG8tBwL47uuuClu3okFyuM4Y_98JjrXJTh4pEasuZP4KmwhAhAYdOtBidIQmEtzJneWp__3cp4Kdkdxxn5-3l6j0B_niQcxZWNI1tyexc0_GUYvYOk421m4zsKxrJ2vmoLM-D0LwYpjhagWdtUR13Zh140ccOAMA9f1Oms=w1378-h775-no

I also used pins to hang the tissue paper envelope containing the two CodeBugs behind the eyes.

UVUV2VRujZ_mBKaOhKfiUgeYBudlQWC_rOUj9eGBEaRZ1oZjM2PDNt7zWwSaa4mX0GAGdLKARJKYWvEqTFLyKN8jpwZyy3KiiVaBhtxsopwRqzQEs-K2FuSjfPraVjn40wKN7Q6ayFnnxb0K44_w5f5LwVtfX8fcIFEJVbHanHr1-YllgxFYVnDSUizCi1OGOFQ8-Hr6PVtGl1QPv0UN4ioGcYCiVKgSZ-dn-PGCtPL-Bpqez7grn1MNibqUmUuQxFwrNJo4MDkXd369C2k0D0w6z2_j06_rgt6S5EXK8kWxKTXRcV5vVZiQ4FHQXjyHEjoXmm4mq_iJlx0JbFC5a9kGE6AcEKvbdFwgRyzT8yHjxSJmU7orgQwdmunMat5oG7b9JON_eW6X6qQuHHXtyqXutdW4PtY4obSm0ENA-hYxLptmqXuffuhr1j-qaKwmu2g9xKQwuGAZp4rJVEh07eXBpah0VV7IN3mT7hJBS1cM2nNSpRxH1LdffBs7vbmBO1mwtBnJ5ubkne77DN57-d4Ars6yux7y8WHxJxmxRiU=w1378-h775-no

Make sure the CodeBugs have their batteries inserted, put the lid on the Hack-O'-Lantern and watch him watching you!

UJAKkHHP0qYgsrWOvwxX8u3s0bgqNor_4X_q5ZnouFleV1euVUApTmbq6j-WTRB-twIbSpLcjt5QJUrovbVfahNwVVNLS8t1-2xJqo25r-TNhYLuK7CN5qP62lTbtCPmO2rTkq9szMG17pZ7Jejfog3q_0i3QROT0LBINvVcdj4JIA4cklCqMhepHVR4LpO1VQXlcxeR_2Jxxt3BGyYRQRof3foxKKlFgyET6aHsMn2hfb1GbIX5sCN4AT_jHg9KI-LSK6ZfiMdaKHLEVPc0kjssYGkpTEP19WKQ7WHRIrKTrV8nvCxCV7btB8fg6TaPatWFfuUFwTNwONvrv8WAHy0EiZz-fMH88YiKEm70-XNzjFkdefLJiCihMK1oUYFhrusPXXphvMoRNVFCbmUfqs0XYdjGCfDmtQ0b9nR4v7DlNjEpFAOlwG2v7p9pR8dcEWZ3Cu4UaZQdSlGWUQTZM_JihK9WRliOx9vitSY6oILJw8QC63z6O__WMC2Wpeu3H0FfkGYOEdvfpjdmduVTc8Xwh-VywfHm8STrQ4NL4kU=w1378-h775-no

Attachments:
pumpkin-left-eye.zip
pumpkin-right-eye.zip
  • codebug
  • halloween
  • hack-o-lantern
  • jack-o-lantern
  • pumpkin
  • codebug_beginner
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 9 years ago +3
    Nice work Spanner. I'll be away celebrating in Auckland and missing out on a great party here in Chch ... Mark
  • shabaz
    shabaz over 9 years ago +2
    We picked up a pumpkin over the weekend too - now we know what to do with it!! : ) Probably use your code as-is; the eyes animation is very cool in the video!
  • gadget.iom
    gadget.iom over 9 years ago +1
    Excellent article!
  • mcb1
    mcb1 over 9 years ago

    Nice work Spanner.

    I'll be away celebrating in Auckland and missing out on a great party here in Chch ...

     

    Mark

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 9 years ago in reply to balearicdynamics

    Well done, Scary Spencer!!!


    And he has a new Avatar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 9 years ago

    Simple yet great!

     

    Well done, Scary Spencer!!!

     

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • neilk
    neilk over 9 years ago

    Love it image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • gadget.iom
    gadget.iom over 9 years ago

    Excellent article! image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 9 years ago

    We picked up a pumpkin over the weekend too - now we know what to do with it!! : )

    Probably use your code as-is; the eyes animation is very cool in the video!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube