The Project board is for sharing projects based on Silicon Labs' component with other community members. View Projects Guidelines ›

Projects

    Publish
     
      • Creating F1-Style Race Starting Lights with EZR32 Wireless MCUs

        szpapp | 02/48/2016 | 10:35 AM

        original.png

         

        Project Members: 

        Peter, Zoltan, Szilveszter

         

         

        RobonAUT is an annual RC car competition for students at Budapest University of Technology and Economics. Twenty student teams from the Department of Automation and Applied Informatics will compete against each other in the upcoming RobonAUT on 20th February 2016.

        As sponsors of the event, Silicon Labs wanted to get more involved in the competition and decided to provide a DIY racing starting gate, which included LEDs and infrared beam sensors, and a pair of RF modules, one receiver and one transmitter, that they can attach to their RC cars. Formula One is one of the biggest sporting events in Hungary and gaining popularity around the world, so our intention was to create replicas that looked as much like the real thing as possible.

         

        Note: The photos were taken from the experimental track, not the final one, to help students develop control algorithms until the actual competition day. 

         

         

        How it works: 

         

         

        Each student team has an off-the-shelf RC car and an ARM Cortex evaluation kit. They need to design a custom PCB that can fit into their RC car to be able to catch the starting signals sent by the gate and detect the tracking line on the floor. It is also required to write the right control algorithm that makes the steering wheel reliable along the way without getting lost.

         

        We provided each team with a transmitter board to help their development before they got the gate in place. The transmitter board sends the same signals as the gate does, so we called them gate-simulators. 

        They also need to pass a few maneuvers such as reverse parking, taking left/right fork of the track, and driving uphill. Since usage of any remote controller is strictly prohibited, the teams have to implement autonomous controller software that drives the car along the line. 

         

        See the competition overview here: http://robonaut.hu/cikkek/robonaut-2016-szabalyai 

         

        The race start signal is based on counting down from five to zero. The delay between the numbers is one second, except the last one (zero), where the delay varies between two-four seconds randomly. The starting gate has five columns of two big LED lights on both sides. The lights go on according to the counter and all lights go out at the zero count.

         

        original (1).png

         

        There is always one RC car on the track and it only starts when the previous one finished the track. The RC cars are only allowed to start the car when they receive the start signal. Otherwise, infrared beam sensors from the starting gate will detect the false start and may result in disqualification.

         

        original (2).png

         

        Materials Used

         

        - EZR32LG330F256 MCM RF modules

        - Starting gate: RF module as transmitter and a WSTK6200A kit with custom LED driving circuitry

         

        Source File: 

        I will add it to this page once the competition is finished. 

         

        Check out their Facebook page to get the latest info on the competition: 

        https://www.facebook.com/robonautbme/

      • JavaScript on the EFM32

        Alf | 02/33/2016 | 09:56 AM

        So, after a couple of beers, a colleague and me decided that JavaScript had to be the ultimate IoT language. Why? Three reasons:

        • JavaScript is asynchronous
          • Easy to write energy efficient code
        • JavaScript is a scripting language
          • Parsed on the fly
          • Easy to test/develop
          • Easy to debug
        • JavaScript is SOOOOOO hot right now

         

        Where the last bullet of course is the most importantSmiley Happy

         

        So, as any good engineer I didn't want to make everything from scratch, so I searched for alternatives. Turns out there actually exists quite some projects for running JS on IOT devices, like Samsung IoT.jsTessel and Marvells Kinoma. Most of these frameworks are however full JavaScript engines requiring something like 300 MHz to run at adequate speed. To me, that's not too energy-friendly so I opted for a framework that takes some short-cuts on the JavaScript implementation but has a very energy-friendly implementation: Espruino.

         

        You can get the basic info here: http://www.espruino.com/ and all the source code are available at github: https://github.com/espruino/Espruino . It has a very easy-to-use web IDE, created for running code on the fly. It also support integration with regular JS development environments like Electron. You can get the web IDE here,

         

        So, after a couple of nights I got the basic support running. It supports timekeeping in EM2, wake-ups from EM2. If you want to try it out, download the attached binary and flash it on your Giant Gecko starter kit. Then open the web IDE and connect to the COM-port of the kit.

         

        If you want some simple examples, you can for example try:

        var state=0;
        
        function led_swap() {
          state = !state;
          LED1.write(state);
        }
        
        setWatch(led_swap, BTN1, {edge:'falling',repeat:true});
        setDeepSleep(true);

        Or:

        var Clock = require("clock").Clock;
        var clk = new Clock(2016,0,27,17,0,0,0);
        
        function setLed() {
          LED1.write(clk.getDate().getSeconds() & 0x1);
          LED2.write(clk.getDate().getSeconds() & 0x2);
        }
        
        setInterval(setLed,1000);
        setDeepSleep(true);

        If you ever save something to flash (using save()) or send it to EM2 and want to recover the console, just hold down BTN1 (marked as PB0 on the kit) when resetting. There's also a bug that caused the console not to recover after loading from or saving to flash.

         

        Here's two Energy Profiler shots of the examples above:

        Example 1, You can see it's using about 2.8 uA when waiting for pin-wakeup and the LED consuming ~0.5mA. You can also see that it actually triggers on both edges (rising & falling) with Espruino validating the trigger.

        JS_profiler1.PNG

         

        Example 2:

        Again, you can see normal timekeeping at 2.8 uA, and the LEDs consuming 0.5 mA each..

        JS_profiler2.PNG

         

        If you want to save something with setDeepSleep() I recommend using the below stub to go to deep sleep after 5 secs, so you have enough time to type save() after uploading the code:

        //Go to deep sleep after 5 secs, so we have time to do save()
        setTimeout(function() {setDeepSleep(true)}, 5000); 

         

        Lastly, if you want to contribute just get the code from github, there is a Simplicity Studio project located in the targets/efm32 folder. What's currently missing:

        - PWM

        - SPI

        - Analog functionality

        - Serial over USB (Right now it's using the serial over the debug USB-cable. Should move this to the on-chip USB)