Shop OBEX P1 Docs P2 Docs Learn Events
CONTEST: Hack The Halls! - Page 3 — Parallax Forums

CONTEST: Hack The Halls!

13

Comments

  • Nick ErnstNick Ernst Posts: 138
    edited 2012-12-14 10:33
    Here's my employee entry! Thank you Jen for the awesome pictures!

    I didn't bring in the caboose that I made for my two kids to ride in, but may I present the "Christmas Quadrover Train". As the name suggests, it is a Quadrover that I transformed into a train to take my kids around in when we go looking at Christmas lights this year. Many of the places we go are neighborhoods where you have to walk through, and instead of having to put the kids on my shoulders 5 mins into the walk, I thought an RC Train that can pull them would be just what the doctor ordered. I'll post some video of it in full effect after we have our first outing this weekend with it, and we'll see how everyone reacts to it!

    IMG_1279.jpg
    1024 x 1371 - 199K
  • xanaduxanadu Posts: 3,347
    edited 2012-12-14 13:06
    Nick,

    Saw that on FaceBook, nice job!
  • TtailspinTtailspin Posts: 1,326
    edited 2012-12-16 10:04
    Oh wow, I am gone for a few days, and come back to a page full of new submissions. :thumb:
    I don't think my TupperWare will be walking away with any prizes, this time!...:cool:

    I'm sure glad I don't have to be a judge in this contest.:smile:

    -Tommy
  • WildatheartWildatheart Posts: 195
    edited 2012-12-17 00:31
    The following is being submitted for the Parallax Hack the Halls contest. Read on to learn how Martha got hacked by a Propeller.

    THE PROJECT:

    This project transforms the ‘Martha Stewart Living 22 inch Decorative Tree Picks’ sold at Home Depot. Each of the 3 pre-wired “twigs” contain 8 tiny LED’s and the set is designed to be powered by the included 3V/0.5A power adapter. Out of the box all 24 LED’s are continuously lit when powered. One set of 3 twigs containing red LED’s and one set of 3 twigs containing white LED’s were used to create a mesmerizing winter forest scene.

    THE MICROCOMPUTER PROGRAM:

    The Spin program, running on a Parallax Quickstart board, generates a constantly changing random pattern of events on 6 output pins. These output pins drive 6 2n3904 transistor switches to supply power for each of the 6 twigs. These 6 events use 6 of the 8 Propeller cogs; then with 2 remaining cogs needing a workout, no forest scene is complete without an animated reindeer nibbling on a red berry that hangs from one of the trees. So a Parallax servo was added to exercise the remaining 2 cogs. Although the control program slams full power-on to the trees to create a stimulating affect, it also fades the power during the off cycle to produce a peaceful change. The servo (with reindeer attached) is also programmed to move in random increments to increase interest.

    A good working knowledge of the Spin language for the Propeller microcomputer is helpful for this project; however this programmer has little more than novice ability. But as it is in this case, those with imagination and determination can thank Parallax for doing an excellent job hosting OBEX and the Parallax Forums, and also for offering free phone support to help replace expert programming ability. Except for minor changes and tweaking some parameters in freely available programs, the entire Spin program for this project was a cut and paste process from the following:

    Learn Parallax… by Andy Lindsay – used for timing and I/O pins routines
    Tutorial page with download link: http://learn.parallax.com/node/110

    OBEX… by Kwabena – program used to control Servo
    http://obex.parallax.com/objects/456/

    Parallax Propeller Forums… by cavelamb – program used to fade LED’s off http://forums.parallax.com/showthread.php?144413-variable-ramping

    Parallax phone support… - a brief phone/Email exchange with Nick to tie it all together

    THE HARDWARE AND CONSTRUCTION:

    The Power wirings for all 6 twigs were separated, striped and tined for insertion into a breadboard. Because a single Quickstart output pin can only supply 40 of the 60 mA required to power each twig, it was necessary to build 6 2n3904 switching circuits. The servo is connected and wired according to Parallax standard servo instructions.

    Power for the Quickstart board and the display came from the USB cable connection to a PC, a 9V battery, or an auxiliary 9VDC wall wart attached to pins 39 & 40. The 3.3VDC for the LEDs power was available at pin 38 on the Quickstart board.

    THE MATERIALS:

    1 pkg Martha Stewart Living 22 inch Decorative Tree Picks – White $15.75
    1 pkg Martha Stewart Living 22 inch Decorative Tree Picks – Red $15.75
    1 Parallax Quickstart board $25.00
    1 Parallax standard servo $12.99
    1 2x4x24” scrap from construction site n/c
    1 12x30x3/4” OSB or Plywood scrap from construction site n/c
    1 2” round plastic disc cut from peanut butter jar lid n/c
    attached to servo horn w/ 4-40 screws
    2 #8 x 2in wood screws $ 0.16
    4 4-40 x ¾” machine screws with nuts $ 0.64
    1 pkg synthetic snow from Target $ 2.00
    1 Reindeer Christmas tree ornament - glued to plastic disk $ 2.75
    4 or 5 small river rocks n/c

    PHOTO AND VIDEO ATTACHED:

    http://www.youtube.com/watch?v=eJQx8NqxJQQ&feature=youtube

    Quickstart photo.jpg


    Merry Christmas! -Gordon
    1024 x 683 - 76K
  • TMAC1TMAC1 Posts: 24
    edited 2012-12-17 05:32
    Here's my project; "The Magi's GPS" (still in progress, but I WILL have it done by the 20th)
  • CircuitMageCircuitMage Posts: 62
    edited 2012-12-17 14:15
    wrote:
    ....another contest that ends on 12212012...:-/
  • ercoerco Posts: 20,255
    edited 2012-12-17 17:34
    ....another contest that ends on 12212012...:-/

    If the world does end on 12/21, then at least Parallax's HTH contest helped urge one last spike of learned effort and technological productivity out of the Human race!
  • FRC2370FRC2370 Posts: 128
    edited 2012-12-18 19:41
    Here is my entry to Hack The Halls:

    1218121518b.jpg


    His name is Hamster-Bot. He was originally designed to be a christmas decoration for one of my FRC team's sponsors, but the project was canned so I took him home and finished the job. While he may have a misleading name, the goal is simple, to spread Christmas joy to everyone around him. He uses two Boards of Education with the 27982 transceivers, one for operating as a remote controller (which was to be placed outside the store), the other is on the boe bot for actually driving. His task when the command is sent is very simple, but alas his cuteness makes up for the simplicity of it.

    Video: http://www.youtube.com/watch?v=ap7HkxqumCk&feature=youtu.be

    The controller (now rebuilt for demo purposes)
    1218121519.jpg


    The code, which i can't post inline as at home I have a Mac and I wrote the code on a team computer is attached here:
    Receiver.bs2Transmitter.bs2
    1024 x 768 - 62K
    1024 x 768 - 68K
  • Ray_DRay_D Posts: 8
    edited 2012-12-18 22:40
    Here is my entry to the contest. Check out the video:

    http://www.youtube.com/watch?v=hSxGq68Pllk

    For more detail on the project see the thread http://forums.parallax.com/showthread.php?144729-Propeller-Clock-Powered-by-the-Propeller-Microcontroller
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-19 08:22
    Jen J. wrote: »
    Please submit your holiday hack by Thursday, December 20th. Winners will be announced on Friday, December 21st, 2012.

    Foir those of us who have procrastinated until the end been working on our hack until the end, What time Thursday is the cut off? 10AM Parallax time (PST) (like many sales)?
    11:59:59PM Wednesday night?

    How many hours do I/we have?
  • Jen J.Jen J. Posts: 649
    edited 2012-12-19 10:24
    You have until midnight (PST) tonight.
  • shyerdjshyerdj Posts: 4
    edited 2012-12-19 10:30
    Jen J. wrote: »
    To submit your project for this contest, please provide a brief writeup with links to any other applicable information (photos, schematics, videos, web sites, another thread) in this Forum thread.

    This is my submission for the Hack the Halls Contest:

    "How the Grinch Stole Christmas" Project

    Preface- I am an EET student at HVCC and I took a Microcontroller class this semester. We have gone through all of the examples and projects in the “What's a Microcontoller?” book so I am listing that as my reference for this project. This is my first project outside of class and is definitely NOT going to be my last because we all know how much microcontrollers rule! \m/ (‘_’) \m/ *rock on* Unfortunately I had to give back the 2x16 serial LCD at the end of this semester last week so it got removed from the project. This project has taken me a total of about 10 days to construct, program and troubleshoot. It also doesn’t help that finals are this week...

    Project – I have constructed a Xmas scene at the North Pole with LEDs and photoresistors put into various objects. A Joystick is used to control two servo’s and a pushbutton for the laser. When the photoresistor is hit by the laser then the target’s LED’s will light up and it will make some noises throughout. I am using the Basic Stamp on the BOE for this project. The intro song used for the North Pole is "White Christmas" and the song used for the villain is "In the Hall of the Mountain King."

    Here is the video: I'm sorry about the quality of video/audio of my cellphone...
    :

    Here are some pix:
    attachment.php?attachmentid=98051&d=1355939639&thumb=1attachment.php?attachmentid=98050&d=1355939654&thumb=1attachment.php?attachmentid=98052&d=1355939625&thumb=1attachment.php?attachmentid=98053&d=1355939611&thumb=1attachment.php?attachmentid=98054&d=1355939585&thumb=1attachment.php?attachmentid=98055&d=1355939571&thumb=1attachment.php?attachmentid=98056&d=1355939544&thumb=1

    Materials – I picked up a few cheap Christmas decorations at the dollar store and walmart as well as cotton balls, glitter (don’t ask) and 9V batteries for about $10. I threw everything on top of a pizza box and had used other cardboard boxes for things. I had to pick up two servos, LEDs, photoresistors, a speaker, joystick, various resistors and wire from radioshack. I had used my $50 gift card I’ve been holding on to for a year. The laser was bought off of amazon for like $5. The BOE was picked up at the beginning of the semester.

    The Code: Xmas_project(final).bs2

    And a link to a forum post incase this is all fubar http://forums.parallax.com/showthread.php?144736-How-the-Grinch-Stole-Xmas
  • shyerdjshyerdj Posts: 4
    edited 2012-12-19 10:39
    For some reason I submited a reply post but it didn't show up. I just hope i didnt spam the post....

    Here is a link of my project for this contest. http://forums.parallax.com/showthread.php?144736-How-the-Grinch-Stole-Xmas

    -Dan
  • Jen J.Jen J. Posts: 649
    edited 2012-12-19 10:52
    Hi Dan,
    Took care of that for you.
    Thanks for submitting your project!

    JJ
  • ercoerco Posts: 20,255
    edited 2012-12-19 13:02
    Dan: That's fabulous, a Grinch shooting gallery. Great work!
  • ke4pjwke4pjw Posts: 1,115
    edited 2012-12-19 13:06
    I would like to submit my propeller powered Christmas lights project that has been ongoing for the past few years. The lights are controlled by a 16 channel Propeller powered controller that I call the "Rudolph 16". These controllers receive DMX-512 from a Propeller powered PC interface I call the "DMX Director". The DMX Director connects to the PC via USB. In order to ensure the Prop could swallow the needed data stream quickly without error, I utilized a FTDI245 USB to parallel serial interface. I modified the FDS object to work with the FTDI245 and uploaded to the OBEX. It took the better part of a year to design the boards and write the software in my spare time. Starting off, I knew nothing of Propeller and only had worked with basic stamps. The "shows" are generated using a shareware PC program called "Vixen". I wrote a plugin for Vixen to talk to my "DMX Director".

    Getting the prop to dim the lights

    Testing the first prototype

    One of the completed and populated boards.
    75886_1730868078480_1441831958_31851277_3987897_n.jpg


    The DMX Director
    20121221_153757.jpg


    Full Show

    This show has 96 DMX-512 channels available, with the "Mega Tree" being 64 of those channels. My wife created all of the shows that we display during the Christmas season.

    Merry Christmas everyone!
  • tomcrawfordtomcrawford Posts: 1,126
    edited 2012-12-19 17:10
    I am hereby withdrawing my earlier Shiftbrite entry in favor of Shiftbrites Revisited. Here is a video of Maggie's crate festooned. http://youtu.be/dv80ntxxLPo

    I have appended the code. I will document it on the Projects forum tomorrow.
  • CapdiamontCapdiamont Posts: 218
    edited 2012-12-19 18:24
    SSR box.jpg


    I threw together some simple animation of light strings for the 2011 Trucker Christmas Parade in Eureka, California. I helped out the Timber Heritage Association. It was started late, so the second SSR box was not made. With the animation and lights everyone put on, we earned second place in the light truck category that year. This year my stamp was doing a school project. Each out put uses a 3 amp SSR to control the AC strings, fused at 2 amps.

    Three sets of animation, with three channels each. The wheels used six strings of lights, two each channel. I arranged them as spokes. Trouble was the other side rotated backwards and I was too tired at that point to think clearly to fix it. The front of the speeder had two windows and a grill. That became two eyes and a mouth. The eyes blink on and off and wink using three channels. The last three channels were unused, but were made to simulate a chase sign for the group's initials.

    The SSR box is a three gang electrical outlet box, with the plug cord cut off an old UPS. The SSRs and fuses all fit within the box tightly.

    http://www.youtube.com/watch?v=Mxc7ilvOvN4

    http://www.timberheritage.org is the group.
    640 x 546 - 101K
  • ercoerco Posts: 20,255
    edited 2012-12-19 19:10
    Had to hack into a Scribbler for this one! It's a higher-tech version of the classic train under the Christmas tree. Robot follows a tape line on the carpet. Yes Virginia, there is a Santa Claus, but no, there ain't much contrast between the white tape line and my tan berber carpet:

    I love Old Blue, but she had a few weaknesses, and line following was one of them. The contrast threshholds were hardwired in (no software adjustment), and finding suitable lines and backgrounds was always a pain. I added a series potentiometer to the two IR LEDs (also in series) to reduce the IR illumination to adjust the high/low transistion. I used a 10K pot on hand, but a 500-ohm unit would be superior, since ~200 ohms was all that was necessary. Also, I discovered that the sensor height needed to be raised for optimum view of the illuminated line, so I made it a tail-dragger by removing the tail wheel and adding a simple skid.

    The red & green LEDs on Old Blue made it a natural for this Christmas contest. :)

    My joyfully compact code for line-following:
    HIGH 3' IR LEDs on, added a ~200 ohm series resistor
    main:IF IN4=0 THEN PULSOUT 13,2500:HIGH 8:ELSE PULSOUT 13,1800:LOW 8
    IF IN5=0 THEN PULSOUT 12,2500:HIGH 10:ELSE PULSOUT 12,1800:LOW 10
    GOTO main
    
    980 x 735 - 151K
    980 x 650 - 101K
  • Jen J.Jen J. Posts: 649
    edited 2012-12-20 08:46
    Contest is closed to any further entries.
    The judges will convene and we shall announce the winners later today.
    Thank you for sharing all of your wonderful holiday projects!
  • PHMIIIPHMIII Posts: 2
    edited 2012-12-20 09:20
    The “Carolinator” is an Autonomous Christmas Caroling Robot that was inspired by Erco’s Jingle-Bot and Jessica’s Christmas Caroling Device.

    Photos:
    Carolinator 06.jpg
    Carolinator 03.jpg
    Carolinator 05.jpg


    This Robot is a BOE-Bot clone using a Parallax SumoBot controller board and a few spare parts. The program is a blend of Ping)))Dar - Scan For and Go To Closest Object and three of the songs from the Christmas Caroling Device (I flat out stole Jessica’s Christmas Carols).

    Video:
    http://www.facebook.com/photo.php?v=4165730868296
    ' -----[ Title ]--------------------------------------------------------------' The "Carolinator" - GoToClosestCarolingObject.bs2
    ' Based on Smart Sensors and Applications - GoToClosestObject.bs2
    ' Sweep Ping))) Ultrasonic Rangefinder across 180-degrees and find the closest
    ' object.  Then calculate and execute the turn required to face the object.
    ' Travel forward until the object is less than or equal to 20 cm from the front
    ' of the rangefinder.
    ' And Plays a variety of Christmas songs from CarolingDeviceWithLights.bs2
    ' This is for the Phil-Bot: a Boe-Bot clone using a SumoBot board: 12-14-2012
    
    
    ' IMPORTANT: This program has several constants that have to be tuned before
    '            it will work right.  Follow the instructions in Smart Sensors
    '            and Applications, Chapter 8, Activity #4 and #5 before you run
    '            this program!
    
    
    ' {$STAMP BS2}                               ' Target device = BASIC Stamp 2
    ' {$PBASIC 2.5}                              ' Language = PBASIC 2.5
    
    
    ' -----[ EEPROM Data ]--------------------------------------------------------
    
    
    ' Store information needed to play "Deck the Halls"
                          ' Deck the halls with boughs of holly
    Notes_DTH     DATA    "C", "b", "A", "G", "F", "G", "A", "F",
                          ' Fa la la la la la la la la
                          "G", "A", "b", "G", "A", "G", "F", "E", "F",
                          ' Tis the season to be jolly
                          "C", "b", "A", "G", "F", "G", "A", "F",
                          ' Fa la la la la la la la la
                          "G", "A", "b", "G", "A", "G", "F", "E", "F",
                          ' Don we now out gay apparel
                          "G", "A", "b", "G", "A", "b", "C", "G",
                          ' Fa la la la la la la la la
                          "A", "B", "C", "D", "E", "F", "E", "D", "C",
                          ' Toll the ancient yuletide carol
                          "C", "b", "A", "G", "F", "G", "A", "F",
                          ' Fa la la la la la la la la
                          "D", "D", "D", "D", "C", "b", "A", "G", "F", "Q"
    
    
    Octaves_DTH   DATA      7,   6,   6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,   6,   6,   6,
                            7,   6,   6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,   7,   6,
                            6,   6,   7,   7,   7,   7,   7,   7,   7,
                            7,   6,   6,   6,   6,   6,   6,   6,
                            7,   7,   7,   7,   7,   6,   6,   6,   6
    
    
    Durations_DTH DATA      4,   8,   4,   4,   4,   4,   4,   4,
                            8,   8,   8,   8,   4,   8,   4,   4,   2,
                            4,   8,   4,   4,   4,   4,   4,   4,
                            8,   8,   8,   8,   4,   8,   4,   4,   2,
                            4,   8,   4,   4,   4,   8,   4,   4,
                            8,   8,   4,   8,   8,   4,   4,   4,   2,
                            4,   8,   4,   4,   4,   4,   4,   4,
                            8,   8,   8,   8,   4,   8,   4,   4,   2
    
    
    Dots_DTH      DATA      1,   0,   0,   0,   0,   0,   0,   0,
                            0,   0,   0,   0,   1,   0,   0,   0,   0,
                            1,   0,   0,   0,   0,   0,   0,   0,
                            0,   0,   0,   0,   1,   0,   0,   0,   0,
                            1,   0,   0,   0,   1,   0,   0,   0,
                            0,   0,   0,   0,   0,   0,   0,   0,   0,
                            1,   0,   0,   0,   0,   0,   0,   0,
                            0,   0,   0,   0,   1,   0,   0,   0,   0
    
    
    ' Store information needed to play "Jingle Bells"
                          ' Dashing through the snow
    Notes_JB     DATA     "D", "B", "A", "G", "D", "R",
                          ' In a one horse open sleigh
                          "D", "D", "D", "B", "A", "G", "E", "R",
                          ' O'er the fields we go
                          "E", "C", "B", "A", "g", "R",
                          ' Laughing all the way
                          "D", "D", "C", "A", "B",
                          ' Bells on bobtail ring
                          "D", "B", "A", "G", "D", "R",
                          ' Making spirits bright
                          "D", "B", "A", "G", "E", "R",
                          ' What fun it is to ride and sing
                          "E", "E", "C", "B", "A", "D", "D", "D",
                          ' A sleighing song tonight
                          "D", "E", "D", "C", "A", "G", "R",
                          ' Jingle Bells, Jingle Bells
                          "B", "B", "B", "B", "B", "B",
                          ' Jingle all the way
                          "B", "D", "G", "A", "B", "R",
                          ' Oh what fun it is to ride
                          "C", "C", "C", "C", "C", "B", "B",
                          ' In a one horse open sleigh
                          "B", "B", "B", "A", "A", "B", "B", "D",
                          ' Jingle bells, jingle bells
                          "B", "B", "B", "B", "B", "B",
                          ' Jingle all the way
                          "B", "D", "G", "A", "B", "R",
                          ' Oh what fun it is to ride
                          "C", "C", "C", "C", "C", "B", "B",
                          ' In a one horse open sleigh
                          "B", "B", "D", "D", "C", "A", "G", "Q"
    
    
    Octaves_JB    DATA      6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,   6,  6,
                            6,   7,   6,   6,   6,   6,
                            7,   7,   7,   6,   6,
                            6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,
                            6,   6,   7,   6,   6,   7,   7,  7,
                            7,   7,   7,   7,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,
                            6,   7,   6,   6,   6,   6,
                            7,   7,   7,   7,   7,   6,   6,
                            6,   6,   6,   6,   6,   6,   6,  7,
                            6,   6,   6,   6,   6,   6,
                            6,   7,   6,   6,   6,   6,
                            7,   7,   7,   7,   7,   6,   6,
                            6,   6,   7,   7,   7,   6,   6
    
    
    Durations_JB  DATA      4,   4,   4,   4,   2,   4,
                            8,   8,   4,   4,   4,   4,   2,   4,
                            4,   4,   4,   4,   2,   4,
                            2,   4,   4,   4,   2,
                            4,   4,   4,   4,   2,   4,
                            4,   4,   4,   4,   2,   4,
                            4,   4,   4,   4,   4,   4,  4,   4,
                            4,   4,   4,   4,   4,   2,  4,
                            4,   4,   2,   4,   4,   2,
                            4,   4,   4,   8,   3,   4,
                            4,   4,   4,   8,   4,   4,  4,
                            8,   8,   4,   4,   4,   4,  2,   2,
                            4,   4,   2,   4,   4,   2,
                            4,   4,   4,   8,   3,   4,
                            4,   4,   4,   8,   4,   4,  4,
                            8,   8,   4,   4,   4,   4,  1
    
    
    ' Store information needed to play "We Wish you a Merry Christmas"
                          ' We wish you a Merry Christmas
    Notes_MC      DATA    "e", "a", "a", "b", "a", "G", "F", "F",
                          ' We wish you a Mery Christmas
                          "F", "b", "b", "C", "b", "a", "G", "e",
                          ' We wish you a Merry Christmas
                          "e", "C", "C", "d", "C", "b", "a", "F",
                          ' And a Happy New Year
                          "e", "e", "F", "b", "G", "a",
                          ' Good tidings we bring to you and your kin
                          "e", "a", "a", "a", "G", "G", "a", "G", "F", "e",
                          ' Good tidings for Christmas
                          "b", "C", "b", "a", "e", "e",
                          ' And a Happy New Year
                          "e", "e", "F", "b", "G", "a", "Q"
    
    
    Octaves_MC    DATA      6,   6,   6,   6,   6,   6,   6,   6,
                            6,   6,   6,   7,   6,   6,   6,   6,
                            6,   7,   7,   7,   7,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,
                            6,   6,   6,   6,   6,   6,   6,   6,   6,   6,
                            6,   7,   6,   6,   7,   6,
                            6,   6,   6,   6,   6,   6
    
    
    Durations_MC  DATA      4,   4,   8,   8,   8,   8,   4,   4,
                            4,   4,   8,   8,   8,   8,   4,   4,
                            4,   4,   8,   8,   8,   8,   4,   4,
                            8,   8,   4,   4,   4,   2,
                            4,   4,   4,   4,   2,   4,   4,   4,   4,   2,
                            4,   4,   4,   4,   4,   4,
                            8,   8,   4,   4,   4,   2
    
    
    ' -----[ I/O Definitions ]----------------------------------------------------
    
    
    ' Ping))) Ultrasonc Rangefinder and Mounting Bracket
    PingServo      PIN     14                    ' Servo that directs Ping))) snsr
    Ping           PIN     15                    ' Ping))) sensor signal pin
    
    
    ' Boe-Bot servo pins (Left and right are from driver's seat perspective.)
    BotServoLeft   PIN     13                    ' Left drive servo
    BotServoRight  PIN     12                    ' Right drive servo
    
    
    Speaker        PIN     5                     ' piezo Speaker and LED
    
    
    ' -----[ Constants ]----------------------------------------------------------
    
    
    ' Ping))) mounting bracket constants
    LimitLeft      CON     330                   ' Bracket 90-degrees Left - 1250
    LimitRight     CON     1195                  ' Bracket 90-degrees Right - 250
    Center         CON     770                   ' Center/0-degree pulse duration - 750
    Increment      CON     15                    ' Increment for pulse sweeping
    MinSweep       CON     40                    ' Pulses -> 90-degree right
    
    
    ' Boe-Bot continuous rotation servo control constants
    FwdLeftFast    CON     850                   ' Fast settings - straight ahead - 850
    FwdRightFast   CON     645                   ' Stock - 660
    BackUpLeft     CON     723                   ' Backs Up Slow
    BackUpRight    CON     780                   ' Backs Up Slow
    RotateRight    CON     762                   ' Boe-Bot rotate right pulse - 765
    RotateLeft     CON     739                   ' Boe-Bot rotate left pulse - 735
    BtwnPulses     CON     20                    ' ms between servo pulses
    
    
    ' Ping))) Ultrasonic Rangefinder constants
    CmConstant     CON     2260                  ' Echo time -> cm with ** - 2260
    SinCosTo256    CON     517                   ' For */ -127..127 -> -256..256 - 517
    Ms20           CON     330                   ' 20 ms worth of cm
    
    
    ' MSB sign (twos complement)
    Negative       CON     1                     ' Negative sign (bit-15)
    Positive       CON     0                     ' Positive sign (bit-15)
    
    
    ' Ping and turning axis geometry
    PingDirToAngle CON     8700                  ' Servo pulse to angle ** con - 8454
    PingAxleOffset CON     7                     ' 7 cm between ping))) and axis - 7
    StopDistance   CON     20                    ' The adjusted distance at STOP - 20
    
    
    ' -----[ Variables ]----------------------------------------------------------
    
    
    time           VAR     Word                  ' Ping))) echo time
    pingDir        VAR     Word                  ' Pulse duration -> direction
    x              VAR     Word                  ' x coordinate
    y              VAR     Word                  ' y coordinate
    distance       VAR     Time                  ' Object centimeter distance
    markDir        VAR     y                     ' Pulse points to closest object
    rightMark      VAR     x                     ' Pulse to object's right side
    leftMark       VAR     pingDir               ' Pulse to object's left side
    pulses         VAR     x                     ' +/- brads to turn toward object
    PrevDist       VAR     Byte                  ' Previous distance measurement
    angle          VAR     Byte                  ' Servo angle from right in brads
    counter        VAR     angle                 ' Loop counter
    minDist        VAR     angle                 ' Minimum distance measurement
    sweepInc       VAR     Nib                   ' Increment for servo sweep
    sweepDir       VAR     Bit                   ' Increment/decrement pingDir
    xSign          VAR     Bit                   ' Stores sign of x variable
    ySign          VAR     xSign                 ' Stores sign of x variable
    pSign          VAR     Bit                   ' Sign of pulses variable
    edgesFound     VAR     Bit                   ' Navigation flag
    
    
    ' -----[ Christmas songs Variables ]------------------------------------------
    
    
    offset         VAR     Nib                   ' Variable space for LOOKUP table
    index          VAR     Byte                  ' Index for pointing at data
    
    
    carolCounter   VAR     Byte                  ' Index for Christmas Carol
    
    
    noteDot        VAR     Bit                   ' Stores if a note is dotted or not
    noteOctave     VAR     Nib                   ' Stores the octave of each note
    noteLetter     VAR     Byte                  ' Stores the letter of each note
    noteFreq       VAR     Word                  ' Stores the frequency of each note
    noteDuration   VAR     Word                  ' Stores the duration of each note
    
    
    ' -----[ Initialization ]-----------------------------------------------------
    
    
    FOR counter = 1 TO 20                        ' Centers Ping)))
      PULSOUT PingServo, Center
      PAUSE 20
    NEXT
    
    
    PAUSE 2000                                   ' Delay program start by 3 seconds
    
    
    ' -----[ Main Routine ]-------------------------------------------------------
    
    
    DO WHILE(1)
    
    
      IF (carolCounter >= 3) THEN                ' Set carolCounter to Zero
        carolCounter = 0
      ENDIF
    
    
      GOSUB Get_Ping_Cm                          ' First distance measurement
    
    
      ' If notheing is in range, Go forward and Hunt!
    
    
      DO UNTIL distance <= 250                   ' Repeat until distance <= 250 cm
        GOSUB Get_Ping_Cm                        ' Get new distance
        PULSOUT BotServoLeft, FwdLeftFast        ' Boe-Bot forward
        PULSOUT BotServoRight, FwdRightFast
        PAUSE BtwnPulses - (distance / Ms20)     ' 20 ms pause between pulses
      LOOP
    
    
      DO UNTIL distance <= StopDistance          ' Repeat until distance <= 20 cm
    
    
        edgesFound = 0                           ' Clear edges found flag
    
    
        DO UNTIL edgesFound = 1                  ' Repeat until edges found = 1
          GOSUB Face_Closest_Object              ' Find & face closest object
        LOOP
    
    
        GOSUB Get_Ping_Cm                        ' Get current distance
    
    
        DO UNTIL distance <= StopDistance        ' Drive toward object
          prevDist = distance MAX 255            ' Current distance -> previous
          GOSUB Get_Ping_Cm                      ' Get new distance
          PULSOUT BotServoLeft, FwdLeftFast      ' Boe-Bot forward
          PULSOUT BotServoRight, FwdRightFast
          PAUSE BtwnPulses - (distance / Ms20)   ' 20 ms pause between pulses
          IF distance >= prevDist + 7 THEN EXIT  ' Exit if distance increasing was 5
        LOOP
    
    
      LOOP                                       ' Main routine's outermost loop
    
    
      IF (carolCounter = 0) THEN
        GOSUB Deck_The_Halls                     ' Play "Deck the Halls"
      ELSEIF (carolCounter = 1) THEN
        GOSUB Jingle_Bells                       ' Play "Jingle Bells"
      ELSEIF (carolCounter = 2) THEN
        GOSUB Merry_Christmas                    ' Play "We Wish You a Merry Christmas"
      ELSE
        PAUSE 20                                 ' Pause for 20 ms
      ENDIF
    
    
      carolCounter = carolCounter + 1
    
    
      PAUSE 1000
    
    
      FOR counter = 0 TO 30                      ' Back up about 10 cm
        PULSOUT BotServoLeft,  BackUpLeft
        PULSOUT BotServoRight, BackUpRight
        PULSOUT PingServo, Center                ' Keeps Ping))) Facing Forward
        PAUSE 20
      NEXT
    
    
      FOR counter = 1 TO 125                     ' Turn around 180 Degrees
        PULSOUT BotServoLeft,  RotateRight
        PULSOUT BotServoRight, RotateRight
        PULSOUT PingServo, Center                ' Keeps Ping))) Facing Forward
        PAUSE 20
      NEXT
    
    
    LOOP
    END
    
    
    ' -----[ Subroutines - BoeBot_Turn_Brads ]-----------------------------------
    
    
    ' Boe-Bot turns a certain number of binary radians to face an object.
    
    
    BoeBot_Turn_Brads:
    
    
      IF pSign = Negative THEN ' Stock Positive
        FOR counter = 0 TO ABS(pulses)
          PULSOUT BotServoLeft, RotateRight
          PULSOUT BotServoRight, RotateRight
          PAUSE BtwnPulses - (distance / Ms20)
        NEXT
      ELSE
        FOR counter = 0 TO ABS(pulses)
          PULSOUT BotServoLeft, RotateLeft
          PULSOUT BotServoRight, RotateLeft
          PAUSE BtwnPulses - (distance / Ms20)
        NEXT
      ENDIF
    
    
      RETURN
    
    
    ' -----[ Subroutines - Face_Closest_Object ]----------------------------------
    
    
    ' Scan for closest object using a Ping))) rangefinder mounted on a standard
    ' servo.  Locate the middle fo the object, and turn Boe-Bot to face it.
    
    
    Face_Closest_Object:
    
    
      ' Initialize sweep increment.
      sweepInc = Increment
    
    
      ' Start Servo rotated to the far right.
      pingDir = LimitRight
      GOSUB Point_At_PingDir
    
    
      ' Make minDist large and sweepDir positive (0).  Single_Sweep sweeps
      ' left -> right while measuring object distances and stores the direction
      ' of the closest object in markDir.
      minDist = 65535
      sweepDir = Positive
      GOSUB Single_Sweep
    
    
      ' Point the servo in the direction of the closest distance measurement.
      pingDir = markDir
      GOSUB Point_At_PingDir
    
    
      ' Scan to find object's right side.
      GOSUB Find_Right_Side
      IF edgesFound = 0 THEN RETURN
    
    
      ' Point the servo in the direction of the closest distance measurement.
      pingDir = markDir
      GOSUB Point_At_PingDir
    
    
      ' Scan to find object's right side.
      GOSUB Find_Left_Side
      IF edgesFound = 0 THEN RETURN
    
    
      ' Average the angles to the object's left and right sides.  That's the
      ' middle of the object.  Point rangefinder in that direction.
      pingDir = leftMark + rightMark / 2
      GOSUB Point_At_PingDir
    
    
      ' At this point, the Ping))) should be pointing directly at the closest
      ' object.
    
    
      ' Calculate the angle to the object's angle in brads, and turn the
      ' Boe-Bot to face that angle.
      GOSUB Turn_Angle_Adjust
      GOSUB BoeBot_Turn_Brads
    
    
      ' Face Ping))) rangefinder straight ahead.
      pingDir = Center
      GOSUB Point_At_PingDir
    
    
      RETURN
    
    
    ' -----[ Subroutines - Find_Left_Side ]---------------------------------------
    
    
    ' Scan left until the measured distance is 10 cm beyond the closest distance,
    ' which is assumed to mean the object's side has been found.
    
    
    ' If the object's side has been found within the 180-degree field of vision,
    ' set edgesFound = 1 and store the pulse duration (pingDir) at which the
    ' object was found in the leftMark variable.
    
    
    ' If the side was not found by the 180-degree point in the scan, rotate the
    ' Boe-Bot until the edge is found, and then set edgesFound to 0 signifying
    ' that the scan will have to be repeated because the Boe-Bot rotated
    ' to find the side, which would otherwise cause the markDir variable to
    ' store an incorrect value.
    
    
    Find_Left_Side:
    
    
      sweepDir = Positive
      distance = minDist
      sweepInc = 1
    
    
      DO UNTIL distance > minDist + 10
        GOSUB Sweep_Increment
        GOSUB Get_Ping_Cm
        IF pingDir <= LimitLeft - 10 THEN ' Stock >=
          pingDir = LimitLeft - 50
          GOSUB Point_At_PingDir
          DO UNTIL distance > minDist + 10
            PULSOUT BotServoLeft, RotateLeft
            PULSOUT BotServoRight, RotateLeft
            GOSUB Get_Ping_Cm
            PAUSE 20
          LOOP
          edgesFound = 0
          RETURN
        ENDIF
      LOOP
      leftMark = pingDir
      edgesFound = 1
      RETURN
    
    
    ' -----[ Subroutines - Find_Right_Side ]--------------------------------------
    
    
    ' Mirror image of Find_Left_Side.
    
    
    Find_Right_Side:
    
    
      sweepDir  = Negative
      distance = minDist
      sweepInc = 1
    
    
      DO UNTIL distance > minDist + 10
        GOSUB Sweep_Increment
        GOSUB Get_Ping_Cm
        IF pingDir >= LimitRight + 10 THEN ' Stock <=
          pingDir = LimitRight + 50
          GOSUB Point_At_PingDir
          DO UNTIL distance > minDist + 10
            PULSOUT BotServoLeft, RotateRight
            PULSOUT BotServoRight, RotateRight
            GOSUB Get_Ping_Cm
            PAUSE 20
          LOOP
          edgesFound = 0
          RETURN
        ENDIF
      LOOP
      rightMark = pingDir
      edgesFound = 1
      RETURN
    
    
    ' -----[ Subroutine - Get_Ping_Cm ]-------------------------------------------
    
    
    ' Gets Ping))) rangefinder measurement and converts time to centimeters.
    ' Distance may be declared as time to save variable space.
    
    
    Get_Ping_Cm:
    
    
      PULSOUT Ping, 5
      PULSIN Ping, 1, time
      distance = time ** CmConstant
      distance = distance + 3 ' Add 3 for Phil's PING))) Bracket
    
    
      RETURN
    
    
    ' -----[ Subroutines - Point_At_PingDir ]-------------------------------------
    
    
    ' Points servo mounted Ping))) rangefinder at an angle determined by the
    ' value of the pingDir variable.
    
    
    Point_At_PingDir:
    
    
      FOR counter = 0 TO MinSweep
        PULSOUT PingServo, pingDir
        PAUSE BtwnPulses
      NEXT
    
    
      RETURN
    
    
    ' -----[ Subroutine - Polar_To_Cartesian ]------------------------------------
    
    
    ' Calculates x and y (Cartesian coordinates) given distance and angle
    ' (polar coordinates).
    
    
    Polar_To_Cartesian:
    
    
      ' Calculate left/right component.
      x = COS angle                              ' Polar to Cartesian
      xSign = x.BIT15                            ' Store sign bit
      x = ABS(x) */ SinCOsTo256                  ' Polar to Cartesian continued
      x = distance */ x
      IF xSign = negative THEN x = -x            ' Correct sign with sign bit
    
    
      ' Calculate straight ahead component.
      y = SIN angle                              ' Polar to Cartesian
      ySign = y.BIT15                            ' Store sign bit
      y = ABS(y) */ SinCOsTo256                  ' Polar to Cartesian continued
      y = distance */ y
      IF ySign = negative THEN y = -y            ' Correct sign with sign bit
    
    
      RETURN
    
    
    ' -----[ Subroutines - Single_Sweep ]-----------------------------------------
    
    
    ' Do one sweep, and find the closest distance measurement and the
    ' pulse value that points the servo in that direction.
    
    
    Single_Sweep:
    
    
      DO UNTIL pingDir <= LimitLeft ' Stock >=
        GOSUB Sweep_Increment
        GOSUB Get_Ping_Cm
        IF distance < minDist THEN
          minDist = distance
          markDir = pingDir
        ENDIF
      LOOP
    
    
      RETURN
    
    
    ' -----[ Subroutine - Sweep_Increment ]---------------------------------------
    
    
    ' Increment/decrement the position of the servo that directs the Ping)))
    ' rangefinder. When pingDir goes outside either LimitRight or LimitLeft,
    ' the sweep direction toggles.
    
    
    Sweep_Increment:
    
    
      ' Change sweepDir for adding/subtracting increment if at rotation limit.
      IF pingDir >= LimitRight THEN ' Stock <=
        sweepDir = Positive
      ELSEIF pingDir <= LimitLeft THEN ' Stock >=
        sweepDir = Negative
      ENDIF
    
    
      ' Add/subtract increment to/from pingDir.
      IF sweepDir = negative THEN
        pingDir = pingDir + sweepInc ' Stock -
      ELSEIF sweepDir = Positive THEN
        pingDir = pingDir - sweepInc ' Stock +
      ENDIF
    
    
      ' Send positioning pulse to Ping))) Mounting Bracket servo.
      PULSOUT PingServo, pingDir
    
    
      RETURN
    
    
    ' -----[ Subroutines - Turn_Angle_Adjust ]------------------------------------
    
    
    ' Adjusts required turn angle based on 7 mm offset of Ping))) rangefinder from
    ' Boe-Bot's turning axis.
    
    
    Turn_Angle_Adjust:
    
    
      ' Get the object's distance at its center.
      GOSUB Get_Ping_Cm
    
    
      ' Position servo & calculate angle from far-right in brads.
      angle = pingDir - 250 ** PingDirToAngle
    
    
      GOSUB Polar_To_Cartesian
    
    
      ' Add distance between Ping))) and center of Boe-Bot axis.
      y = y + PingAxleOffset
    
    
      ' Recalculate the turning angle with respect to Boe-Bot's turning axis.
      angle = x ATN y
      pulses = 64 - angle
      pSign = pulses.BIT15
    
    
      RETURN
    
    
    ' -----[ Subroutine for Christmas songs ]-------------------------------------
    ' -----[ Subroutine - Deck_The_Halls ]----------------------------------------
    ' Plays the song "Deck the Halls"
    
    
    Deck_The_Halls:                      ' Subroutine Label
      index = 0                          ' Set index back to 0 for new songs
      ' Loop until the end of the song, or the center button is pressed
      DO UNTIL (noteLetter = "Q") 'OR (IN3 = 0)
        READ Notes_DTH + index, noteLetter: GOSUB Get_Frequency
    
    
        READ Octaves_DTH + index, noteOctave: GOSUB Get_Octave
    
    
        READ Durations_DTH + index, noteDuration: noteDuration = 1000 / noteDuration
    
    
        READ Dots_DTH + index, noteDot
        IF noteDot = 1 THEN noteDuration = noteDuration * 3 / 2
    
    
        FREQOUT Speaker, noteDuration, noteFreq       ' Play note
    
    
        index = index + 1                             ' Increase data pointer by 1
      LOOP
      noteLetter = "R"                                ' Set note letter to "R" so
                                                      ' the song will replay
    RETURN                                            ' Return to Main Program
    
    
    ' -----[ Subroutine - Jingle_Bells ]------------------------------------------
    ' Plays the song "Jingle Bells"
    
    
    Jingle_Bells:                        ' Subroutine label
      index = 0                          ' Set index back to 0 for new songs
      ' Loop until the end of the song, or the center button is pressed
      DO UNTIL (noteLetter = "Q") 'OR (IN3 = 0)
        READ Notes_JB + index, noteLetter:   GOSUB Get_Frequency
    
    
        READ Octaves_JB + index, noteOctave: GOSUB Get_Octave
    
    
        READ Durations_JB + index, noteDuration: noteDuration = 900 / noteDuration
    
    
        FREQOUT Speaker, noteDuration, noteFreq       ' Play note
    
    
        index = index + 1                             ' Increase data pointer by 1
      LOOP
      noteLetter = "R"                                ' Set note letter to "R" so
                                                      ' the song will replay
    RETURN                                            ' Return to Main Program
    
    
    ' -----[ Subroutine - Merry_Christmas ]---------------------------------------
    ' Plays the song "We Wish you a Merry Christmas"
    
    
    Merry_Christmas:                     ' Subroutine label
      index = 0                          ' Set index back to 0 for new songs
      ' Loop until the end of the song, or the center button is pressed
      DO UNTIL (noteLetter = "Q") 'OR (IN3 = 0)
        READ Notes_MC + index, noteLetter: GOSUB Get_Frequency
    
    
        READ Octaves_MC + index, noteOctave: GOSUB Get_Octave
    
    
        READ Durations_MC + index, noteDuration: noteDuration = 1000 / noteDuration
    
    
        FREQOUT Speaker, noteDuration, noteFreq       ' Play note
    
    
        index = index + 1                             ' Increase data pointer by 1
      LOOP
      noteLetter = "R"                                ' Set note letter to "R" so
                                                      ' the song will replay
    RETURN                                            ' Return to Main Program
    
    
    ' -----[ Subroutine - Get_Frequency ]-----------------------------------------
    ' Returns the frequency for each corresponding note letter in the 8th octave
    
    
    Get_Frequency:                       ' Subroutine label
      LOOKDOWN noteLetter, [  "C",  "d",  "D",  "e",  "E",
                              "F",  "g",  "G",  "a",  "A",
                              "b",  "B",  "R",  "Q"     ], offset
    
    
      LOOKUP offset,        [ 4186, 4435, 4699, 4978, 5274,
                              5588, 5920, 6272, 6645, 7040,
                              7459, 7902,    0,    0     ], noteFreq
    RETURN
    
    
    ' -----[ Subroutine - Get_Octave ]--------------------------------------------
    ' Calculates what octave the note should be played in
    
    
    Get_Octave:                          ' Subroutine label
      noteOctave = 8 - noteOctave
      noteFreq = noteFreq / (DCD noteOctave)
    RETURN
    

    Happy Holidays, Phil
    1024 x 612 - 79K
    1024 x 612 - 107K
    1024 x 612 - 84K
  • halfblinddadohalfblinddado Posts: 59
    edited 2012-12-20 10:06
    Ok now that is awsome. I'm gonna make something like that for my Christmas tree.
  • halfblinddadohalfblinddado Posts: 59
    edited 2012-12-20 10:07
    I meant erco's entry.

    Mike
  • ercoerco Posts: 20,255
    edited 2012-12-20 12:55
    EXCELLENT project, Phil! I love your Carolinator and I sure hope the judges see fit to include that in the competition.

    @Mike: If I would have had more time, I would have hacked in the Sound Pal from my Mystery bag to play a Christmas carol. But Jen said the contest ended at midnight (seemed a day early, hope that didn't knock Duane and other procrastinators out) so I "cost-reduced" my original concept, which included real toy train boxcars with toy robots riding on top...
  • ercoerco Posts: 20,255
    edited 2012-12-20 14:18
    Duane Degn wrote: »
    Foir those of us who have procrastinated until the end been working on our hack until the end, What time Thursday is the cut off? 10AM Parallax time (PST) (like many sales)?
    11:59:59PM Wednesday night?

    How many hours do I/we have?

    Duane, I hope you didn't miss the midnight cutoff with a 90% completed project... If so, post here anyway!
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-12-20 14:24
    The 2012 part of the deadline got this procrastinator! I might have hit a target date for Christmas 2013!!
  • Jen J.Jen J. Posts: 649
    edited 2012-12-20 15:44
    Thank you so much for all the wonderful entries in our first annual "Hack The Halls" contest! Our panel of judges were quite pleased with the quantity, variety, and creativity of the holiday projects.


    And the winners for the 2012 "Hack The Halls" Contest are…


    First Place ($300 in Parallax credit) - ke4pjw (Post #77)
    http://forums.parallax.com/showthread.php?144156-CONTEST-Hack-The-Halls!&p=1152158&viewfull=1#post1152158
    "Propeller Powered Christmas Lights Project and the Griswold FX - Rudolph 16 Custom Board" - ke4pjw provided an excellent video explaining his process and his programming. He also made his own custom control board. The light show looked beautiful. Seriously…where can we get a Rudolph 16 board? Judge quote: "Fricking bad ***!"


    Second Place ($200 in Parallax credit) - Ray-D (Post #70)
    http://forums.parallax.com/showthread.php?144156-CONTEST-Hack-The-Halls!&p=1151978&viewfull=1#post1151978
    "Propeller Powered Christmas Clock" - Judges liked the custom Propeller controlled boards that were created, the versatility of the clock, and the level of detail that went into its creation.


    Third Place ($100 in Parallax credit) - shyerdj (Post #73)
    http://forums.parallax.com/showthread.php?144156-CONTEST-Hack-The-Halls!&p=1152082&viewfull=1#post1152082
    "How the Grinch Stole Christmas Game" - shyerdj created a North Pole diorama with LEDs and photoresistors. He then added an interactive component with a remote controlled Grinch with laser cannon. It is a great looking finished piece and it's interactive. Judge quote: "Yea! Lasers and glitter!"


    Honorable Mention ($75 in Parallax credit) - halfblinddado (Post #48)
    http://forums.parallax.com/showthread.php?144156-CONTEST-Hack-The-Halls!&p=1149294&viewfull=1#post1149294
    Judges were only going to award 3 prizes, but we had to add an Honorable Mention because of this project. A 3-D printer was used to create a nice Wintry sculpture which was then lit from underneath with LEDs. Jessica's 'Christmas Scribbler Caroling Robot' tutorial was then modified for the project.
  • ercoerco Posts: 20,255
    edited 2012-12-20 15:52
    Bravo, judges. Great choices all around and lots of fun to participate in. Folks really stepped up with the quality of ideas and videos submitted. If there was a "best video" prize, I think jdolecki's tender "Robot's First Christmas" would take it. Merry Christmas to all!

    PS: Tommy, resubmit your Gift Guard 9000 next year. It's a timeless, useful concept which should stay plenty fresh in that Tupperware if you burp it!
  • Martin_HMartin_H Posts: 4,051
    edited 2012-12-20 15:59
    Congratulations to the winners.
  • ercoerco Posts: 20,255
    edited 2012-12-20 16:09
    @Martin_H: Dude, yours was FANTASTIC and your son's snow was a hilarious touch. BEST FAMILY EFFORT!
Sign In or Register to comment.