How do I Post to the Game Q&A Forum?

Welcome to the FTC Game Q&A Forum! If this is your first time here, please refer to the Instructions for Forum Use section before posting.

Thank you!

Posts created to sell a product or service are not permitted and will be deleted!

Results 1 to 4 of 4

Thread: DIY IR Beacon using Arduino or ATTiny chip

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Location
    New Hartford, NY, US
    Posts
    2

    DIY IR Beacon using Arduino or ATTiny chip

    If you're a first year team, like us, you may be dealing with the fact that the Hi-Technic IR Beacons have been sold out and on back order since just after the season started. Not having an IR beacon makes it really hard to practice the autonomous portion of this year's challenge.

    After a little research and playing around, we discovered that building a beacon is possible using an Arduino unit and some 940nm infrared LEDs.

    All the Hi-Technic beacon does is pulse a set of infrared LEDs at 1200 hz. Interestingly enough, the Arduino tone() function creates the exact kind of square wave needed to pulse the LEDs. All we had to do was connect some LEDs to a PWM pin of our Arduino through a transistor and use tone() to pulse them at 1200hz. Our robot follows our home-made beacon exactly the same way it does a borrowed Hi-Technic IR Beacon.

    In order to make our design more compact, we created a second prototype driven by an ATTiny85 chip instead of an Arduino. The ATTiny85 is sort of like the little brother of the chip that powers the Arduino. The ATTiny85 comes as an 8-pin DIP and costs about a buck, making it great for small DIY projects like this. It allowed us to create a cheaper, more compact beacon that fits entirely on a half breadboard. We used an Arduino as an In-System Programmer to burn a 1200 hz tone program onto the ATTiny chip, and then breadboarded it out like this:



    It's powered by a 9V battery that's taped to the back of the breadboard and our robot follows it just as well as it follows a borrowed Hi-Technic beacon. Excluding the breadboard itself, that's about $6 worth of components and it can be built in less than an hour.

    For the technically minded, the following components were used (where applicable, components are through-hole not surface mount):

    • 1 - ATTiny85
    • 1 - 16 Mhz External Crystal
    • 1 - 6-pin (on/off) switch
    • 4 - 940nm Infrared LEDs
    • 1 - Green LED to indicate Power
    • 5 - 4.7kΩ Resistors
    • 1 - 2N 3906 NPN Transistor
    • 2 - 10 uF Electrolytic Capacitors
    • 2 - 22 pF Capacitors
    • 1 - 7205 5v Voltage Regulator
    • 1 - 9V Battery Connector
    • 1 - 22 AWG Wire
    • 1 - 9V Battery
    • 1 - Half-Size Breadboard


    You should be able to get all of these parts at SparkFun, AdaFruit, or similar online retailers. With the exception of the ATTiny85 and the 16Mhz crystal, you should also be able to find all the components at Radio Shack. You will also need access to either an Arduino or an AVR-compatible chip programmer to burn the program onto the chip.

    Here's the schematic:



    Larger Version: http://i.imgbox.com/acjL8Tot.png

    Here's the actual program we burned onto the ATTiny85 chip:

    Code:
    int LED_PIN = 1;
    void setup() 
    {                
      pinMode(LED_PIN, OUTPUT);  
    }
    
    void loop() 
    {
        
      tone(LED_PIN, 1200, 10000);
      delay(10000);
    }
    The exact same program works on Arduino, though you probably want to change the pin to 13 or to one of the other PWM pins.

    If anyone is interested in building their own DIY Beacon but needs more detailed instructions or questions answered, let me know.

    Jeff, one of LOCAR Team 7200's Coaches

  2. #2
    Senior Member
    Join Date
    May 2013
    Location
    Olympia, WA, 98501
    Posts
    192
    Nice job! You really only need 3 LEDs though Can you set the fuses of the ATTiny to use an internal clock instead of a crystal?

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Location
    New Hartford, NY, US
    Posts
    2
    Quote Originally Posted by Ernest314 View Post
    Nice job! You really only need 3 LEDs though Can you set the fuses of the ATTiny to use an internal clock instead of a crystal?
    Absolutely. You can set it to 1 or 8 mhz using only the internal oscillator. If you do, you may need to adjust for the speed difference. Last I knew, the time functions in the Arduino 1.x code were dependent on a 16Mhz clock speed, so either overclocking, or underclocking means you can't rely on the timing of many of the internal functions. Whether tone() falls into that category, I just don't know. Since I only needed 1 GPIO pin, I saw no reason not to throw a crystal on to avoid the timing problem, but I do have some replacement timing functions somewhere that work regardless of clock speed.

    As for the number of IR LEDs, yeah, for some reason, I thought there were four, but looking at the pictures of the old style beacons, I see they only have three. Oh, well… the new ones have six, so I don't think the exact number is all that critical, and in our tests, it works fine.

  4. #4
    Junior Member
    Join Date
    Sep 2014
    Location
    NY
    Posts
    10
    Yes, we need to build one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •