• Digital Fireworks with Tessel

    Friday, July 18, 2014

    7/18/2014– Jon McKay

    Image source: Matthew Bergman

    Background Context

    Several months ago, Eran Hammer messaged me about helping him with a project he was working on for NodeConf. My only experience with Eran Hammer up to that point was watching his over-the-top presentation at Realtime Conf. I’ve since forgotten a majority of the presentation, but I do distinctly remember a dime bag containing blue rock candy, dozens of remotely controlled mortar and pestles, and several hundred pounds of dirt and edible plants in a warehouse. In short, it was weird and intriguing and made me feel vaguely like I had abused moderately-strong hallucinogens.

    Naturally, I was excited about helping with the next project, especially since I could develop it on Tessel.

    Eran was set on creating an LED fireworks display to be “set off” on July 4th. The idea was scaled down from an overhead, 15 foot wide, 10 foot long LED grid (estimated cost of $75000) to “simply” 1260 Neopixel LEDs laid out in the shape of an exploding firework.

    You can see a video of an early test or the actual display here.

    Now that we’ve finished, you can actually build a similar system yourself by installing the fireworks Node module for your computer and the neopixels Node module for Tessel.

    Technical Setup

    Eran was in charge of writing the JavaScript library to generate firework animations, and my task was to actually route those animations through Tessel and into one giant strip of Neopixels.

    Neopixel is Adafruit’s brand for addressable LED strips using a specific chip called the WS2812. They are extremely popular due to their simple programming interface and mesmerizing light displays.

    The difficult part of using Neopixels is that they are very timing constrained (so much so, in fact, that parts of the library for Arduino are written in Assembly to ensure a fast enough data throughput. Heavy timing-dependence doesn’t bode well for a JavaScript application, so I knew this project was going to be a bit of a challenge.

    We decided that most of the actually timing-based “pin-wiggling” would have to be done in the firmware layer (written in C) and we would use Tessel’s JavaScript layer to simply pass the fireworks animation from the USB hub to the firmware.

    In all, Eran’s laptop ran a Node server responsible for initiating the Tessel script and generating animations, sending those animation as a binary packet to Tessel, and Tessel was responsible for routing the buffer to the Neopixel driver.

    Each RGB LED receives 3 bytes of data (one byte for each color) and then uses a shift register to pop those bytes off before sending the rest of the animation buffer on to the next pixel. Each transmitted bit is essentially a PWM signal with a period of 1.25 microseconds. A “0” is represented by a duty cycle of 32% and a “1” is represented by a duty cycle 85% (with a ~10% error margin). At the end of an animation, the signal should be held low for at least 50 microseconds.

    Source: Adafruit

    Eran and I were initially worried that we wouldn’t be able to get a good frame rate with a single strand of 1260 pixels. A reasonable frame rate for animations is 30 frames per second. To determine the expected frame rate with Neopixels, we’d need to do a little math:

    1260 pixels * (24 bits/pixel * 1.25 microseconds/bit) + 50 microseconds = 22100 microseconds, or .0221 seconds per animation frame. In theory, that’s about 47 frames per second, but real life is always a bit slower and we weren’t sure by exactly how much.

    Implementation

    Fortunately, our LPC1830 microcontroller features a State Configurable Timer (SCT) which provides programmers with an extremely flexible interface for pin manipulation. Essentially, it allows you to define different timing states associated with different pin inputs and outputs.

    In the case of a single strand of neopixels, I could have used 4 different states. A simplified example of how it could work would be:

    • A timer for the entire period. This timer sets the output pin high at the beginning of a bit transmission which makes the PWM active.

    • A timer for the “0” duty cycle completion (at 32% as mentioned above). When this event fires, it will actually check the value of the current bit being transferred. If it’s a 0, then there is no conflict and the pin state will be pulled low. If it’s a 1, there is a conflict, and the pin will not be changed.

    • A timer for the “1” pwm completion (at 85%) will pull the pin low regardless of the value of the bit being transmitted. This is because it’s a 0, it was already pulled low and doesn’t matter, and if it’s a 1, it needs to be pulled down immediately.

    • A timer that only fires at the end of at the end of a 8 bits. This timer will call an interrupt routine to set up the next byte to be transferred.

    But in reality, I couldn’t set up the next byte after the previous one finished, because that would cause a delay between when the previous byte was sent out and the amount of time it would take to process the logic of setting up the next one. That delay in the signal would totally ruin the animation being sent to Neopixels and the colors would be all wrong (in the best case).

    In fact, what I needed was a double buffer. A double buffer would allow me to set up the next byte while the current byte is being transmitted. I implemented that functionality by adding another SCT state. I set the state of a GPIO pin either high or low depending on which buffer the SCT should be using to generate a signal, and set the next byte in the other in interrupt routines after the previous byte was sent.

    Further Work

    I ended up finishing the single strand implementation in a few hours, but wanted to take the system to the extreme. Tessel has three PWM pins connected to its GPIO port, and I wanted to enable all three of them to output animation data in parallel, effectively tripling the possible frame rate.

    One frustrating weekend, I attempted to add a four more events for the two other pins (each requires two events for the double buffer). Unfortunately, there just wasn’t enough time in the interrupt routine to service three different buffers at a time.

    1.25us/(1/180Mhz) = 225 clock cycles to update three buffers

    I found that I could update two pwm channels fairly well, but three channels took too long to update. I think my implementation could have been cleaner if I didn’t use so many structs within structs (thanks OOP).

    I ran out of time before I could try implementing the more complicated, but ever so elegant and efficient: DMA transfer. DMA effectively allows for the movement of data over physical pipes without requiring any overhead from the processor. You just tell the microcontroller the destination and source of data transfer and it all happens automagically. I wish DMA was taught in more undergraduate computer architecture classes; it’s a really cool technology.

    Using DMA would allow us to use all three PWM channels without the overhead of the interrupt routine that takes all too long to update the next byte because the hardware would handle it automatically.

    If you’re interested in contributing, this would be a super fun way to get started! As someone still getting familiar with writing firmware myself, I learned a ton about how timing, double buffers, DMA, and PWM work on a much deeper level and was able to visually see my achievement with an awesome light show.

    #jon mckay #eran hammer #fireworks #neopixels #LED #custom firmware #LED strip #LED fireworks #NodeConf #npm #node #javascript

  • An Interview with unRob: First Tessel Projects

    Thursday, July 17, 2014

    7/17/2014– Kelsey Breseman

    unRob, or Roberto Hidalgo, accepted my Skype call from his home/office/headquarters in Mexico. He leaned back on his office chair, put on his round glasses, and lit a cigarette. He was full of words, ideas, and inspirations – turning the camera so I could see electrical diagrams he’d convinced a friend to draw for him on the whiteboard wall, or pulling out a simple case he’d put together for a Tessel project. A couple of times, he called offscreen in Spanish to his business partner/friend/roommate for clarifications on an English phrase or a little fact.

    I asked Roberto for an interview because he has impressed all of us at Technical Machine with the many simple but brilliant projects he’s already built with a Tessel and limited electrical expertise. If you haven’t seen his projects, you should check out his YouTube channel.

    Kelsey: What’s your background in engineering?

    Rob: My father was an electrical engineer. The first node of internet in Mexico, he plugged it in. So I grew up with that kind of stuff when I was really young. And I liked computers.

    I got into a program on genomics, but I didn’t go, so I decided to do graphic design. But then I didn’t like school, so I dropped out, and here I am.

    Kelsey: I saw that you have a cool domain name as the Surrealist Party– what is it that you do?

    Rob: We do software. We’ve done all kinds of stuff. We have clients that are newspaper organizations and shit and we do their frontend and their backend. For web we do Node and Ruby. Most of our backend is MongoDB and stuff like that.

    It’s just my partner and me, just the two of us. We’ve been doing this for four years.

    The only time we used hardware, we developed a little box that you connect HDMI, you push a button, and it automatically transmits to the internet as live video streaming. That was pretty much the only experience I’ve had in hardware so far.

    Kelsey: How did you make that?

    Rob: It was just, like, we used an Arduino, and it had a couple of functions. One was to start up the system, because we had an embedded computer, and then we had to control the flow– to transmit, and to get feedback to the operator about the transmission quality and stuff like that.

    We ended up doing most of that as a Node.JS server, with johnny-five, and then just communicating through the Arduino.

    It was fucking complicated. You have to do stuff in C, and then the drivers don’t work. I actually contributed a couple of patches to the serial node thing to make it work.

    Researching that project is how I came to know about Tessel, actually. I thought, it would be easier if I could just skip C and all of the layers behind it. So here we are.

    Kelsey: Did you have something in mind to make when you ordered a Tessel?

    Rob: Yeah. The first thing I made was– here’s the thing. The elevator in my building goes straight to my house. The keys for this fucking elevator are like eighty bucks. So I thought, maybe I could hack a wireless telephone at the base to make the elevator go. This is me not knowing shit about electronics.

    So I just opened the elevator up, and I thought it could work. I could trigger a USB to serial port thing, I could trigger the locate button, then have the handset send the signal to the elevator button and call the elevator up.

    The problem with this is that I can’t let my landlord see this. If he comes one day and there’s just wires coming out of the elevator button…

    I thought it would be great if I could skip the base, skip the radio protocol, and just use WiFi. So I started researching that.

    I wanted an embedded computer that could run a web server and talk through Wifi, and be able to be powered by a small battery. Tessel was just the perfect fit.

    Kelsey: So this elevator– it doesn’t go to anyone else’s apartments?

    Rob: It can, if you short the right pins, I can get the elevator to go to my neighbors’ houses. But we usually just call it for ourselves.

    We developed a telephone to IP, so I made a node module that handles calls. The lady that helps us clean the place, she doesn’t have a smartphone, and we don’t give her keys because they’re so expensive. That was one of the use cases. She just calls this number, lets it ring a couple of times, and then the elevator comes.

    I use it sometimes when I’m drunk and I can’t find the keys.

    It’s a lot of fun.

    The day I got it, my partner was in Brazil for the World Cup. I had a ridiculous amount of work that I needed to do, but I just said fuck it, Tessel is here, and spent six straight hours doing research trying to fix the elevator button I’d burned out, and then I made the Tessel call the elevator.

    In that six hours, I was really excited, that’s when I posted the video [Ed. note: this video].

    If I knew shit about electronics, I could probably do it in half an hour. Six hours is okay. It was like 5am on a Friday night.

    Kelsey: So what else are you planning to make?

    Rob: A friend of mine, an electrical engineer, has been teaching me to do bridges. What I’m trying to do now is build a theremin. I did something kind of like that with graphite [Ed. note: this].

    My roommate, my partner, he’s very annoyed with me for making these noises.

    I actually want to embed a Tessel into a guitar pedal. My guitar broke three weeks ago. I was very sad. So I bought another guitar, an electro-acoustic. I thought maybe I could do a pedal with it, and modify the effects through Tessel and through my phone.

    It’s easier to just push a button with your phone than to lean down and mess with knobs.

    That’s what I want to do with the Tessel for now.

    There’s lots of stuff I’ve been thinking about doing, but I want to know more about how the actual components work.

    I’ve enlisted most of my friends to have an electronics playdate. They’re coming in a couple of weeks to teach me stuff. Maybe something good will come out of it.

    Kelsey: It’s cool that you’re poking into the electrical side of things.

    Rob: Since I was little I always took stuff apart. One time I took apart the washing machine, because I wanted to know how it worked. I got electrocuted, and after that time I was scared about electricity and stuff.

    It’s very frustrating. That’s the thing I like about knowing what the software thing does. If you use C and you have to take into account all the memory manipulations, and weird loops, and re-use somebody else’s code, then it’s scary and it’s frustrating, and you don’t do it.

    With an entry-level language such as JavaScript, it’s easy. You can screw up, and probably you will burn the thing out. But it’s not very expensive, and with all of the revisions you guys did to the power, probably it won’t.

    That’s something interesting.

    It makes hardware accessible for people like me who are stupid about electrical stuff.

    I know my way around software, and I know how to make things talk to each other, but the actual physical part of it is mind-boggling for me.

    The thing that I enjoyed the most was Wifi, built in. It’s ridiculous: the expense of an Arduino, plus a Wifi shield, you have to know stuff. My Wifi network is secure enough for this kind of purpose.

    If I used straight radio, anyone within a 300 meter radius could open my elevator. This thing, they just need to know my Wifi network, and my password, and how to talk to it. It’s much more useful in certain cases.

    For prototyping, this is the best thing I’ve ever encountered.

    My electrical engineer friends, they tell me, I could do that probably in a couple of months. I tell them, yeah, you could do that in a couple of months, with a team of probably fifty people. You could do that for a much bigger expense than– what’s a Tessel? Ninety-nine dollars?

    If you don’t want to spend a lot of time thinking about the implementation, but just hacking the idea, this is a great tool.

    You guys made a really great thing. It has made me– you have no idea– very happy.

    The satisfaction of doing software, and having things move from one side of the screen to the other is immense, for people who like those kinds of things to happen, like myself. But when you translate that to the physical world, it’s just like, you revert back to when you’re six years old and you figure out that you can plug a light bulb straight into the socket, and it will work, and it will do stuff.

    Probably it will contribute to changing the culture: we’re not just programming for programming’s sake, but we’re creating stuff, making, building stuff, that’s something interesting. And it’s a lot of fun.

    #unrob #kelsey breseman #tessel #project #projects #elevator #node #johnny-five #electronics #javascript #interview #user

  • Tessel is in your hands.

    Thursday, July 10, 2014

    7/10/2014– Updates

    It’s been about a month since we started shipping, and things have been overwhelming. Let me try to catch you up:

    Contributing

    We have a contribution guide! We’re still working on filling it out, but please PR/add GH issues for anything you want to see there.

    Here are a few tools we’ve seen so far:

    Hopefully the contribution guide makes this sort of project easier– and if you’re looking for a way to help out, we’ve started a task list in the contribution guide repo.

    Projects

    We’re also starting to see some cool projects. Probably the showiest is Eran Hammer’s LED fireworks display from Nodeconf, Rob Hidalgo is definitely the most prolific– see his YouTube channel– and the youngest person’s project we’ve seen so far is a temperature gauge by Dunmail Hodkinson’s daughter. We’ve also started collecting more on our company Pinterest.

    In order to properly showcase your projects, we’re working on a projects portal. It’s tailored to helping people share what they’ve made on Tessel in a replicable way– link to GitHub code, pictures and videos, text for instructions, metadata re modules, etc. Expect to see it live in the next week or two– and in the meantime, please take pictures of what you make!

    Orders and Support

    All of the pre-orders have been shipped, and we’re continuously sending out new orders. We’re working on improving the fulfillment process; it’s been shaky, and we apologize sincerely. Kelsey is in the process of writing a blog post about that process and our plans for better support.

    That said, it’s possible we’ve missed a few support requests while figuring out our system. If you have been waiting on a response from us for more than a day, please email again to support@technical.io and we’ll make sure to get back to you right away.

    Meanwhile, we’ve seen really wonderful engagement on the forums. Thanks for surfacing issues, fixing each other’s problems, and bringing up your ideas. Keep it up!

    Blog

    Meanwhile, we’ve written a bit to the blog, mostly introducing our three summer interns (Paige, Evan, and Nathan):

    All right, other than bug fixes, Nodeconf, and tracking parcels, that about sums up what we’ve been working on! Look forward to some cool R&D soon.

    All the best, Kelsey, Jon, Kevin, Paige, Eric, Nathan, Jia, Tim, and Evan

    #update #updates #forums #projects #portal #tools #toolchain #contribution guide #contributors #lua #open source #javascript #microcontroller #DIY

  • Tessel Run Internship

    Tuesday, July 8, 2014

    7/8/2014 - Nathan Lintz

    Hi TM Blog Readers,

    I’m Nathan Lintz - aspiring DJ, JavaScript ninja, and Technical Machine intern. In my spare time I like to create playlists on Spotify and read Pitchfork to stay up to date on whatever music craze is sweeping the indie charts.

    Coffee Time

    For the past two summers, I worked as a front end web engineer at Intuit, where I developed a passion for making beautiful user interfaces. As a UI designer, I was frustrated by the limited interaction possibilities afforded by software platforms. What draws me to hardware is the ability to create new user interactions that are impossible on purely software platforms.

    With software alone, we are limited to a small set of gestures such as swipe, hover, and pinch. I am interested in leveraging the hardware capabilities of the Tessel to build new forms of user interaction which were previously impossible on a software platform. For example, using the climate module, a program can detect changes in the user’s environment. A clever interface might use this data to blend the UI with the user’s surroundings. An application could use hot colors if it detects the user is outdoors on a sunny day or it might use cool colors if the user is indoors.

    Since starting my internship, I’ve been working on some side projects which connect real world devices to software applications. Last week, I wrote an app which sent accelerometer data from the Tessel to my laptop’s mouse using a custom Objective C library that I wrote. I plan to abstract this Objective C library into a framework for controlling any Mac functionality from any Tessel module.

    In the coming weeks, I want to build even more devices that can communicate directly with my Mac’s hardware. Some ideas I have are controlling Spotify via text messages or adjusting my screen’s brightness based on the ambient light in the room. If you’re interested in helping me out with these projects, send me a message nathan@technical.io and I’ll send you the library. You can also follow me on Github (nlintz) to see my up and coming Tessel creations.

    #nathan lintz #technical intern #summer 2014 #user interface #user interaction

  • New Intern #2 - Introducing Evan

    Monday, June 30, 2014

    6/30/2014 - Evan Simpson

    Last month I left my internship at the world’s largest single-site employer with over 70,000 employees to come join Technical Machine’s team of 6. Well, maybe that’s a little bit misleading. You see they weren’t employees, they were cast members, and they all referred to a single mouse as their boss.

    Hey there, I’m Evan, one of the three new interns at Technical Machine, and if you haven’t figured it out yet, I left my job at Walt Disney World in Florida to be here. I made the switch for the same reason many other people choose smaller companies - to have a larger impact. After just a few short weeks here I can say without a doubt that I’ve already accomplished more at Technical Machine than at any other company I’ve worked for. Not only have I been responsible for making improvements to firmware and modules like BLE and RFID, but I’ve also had the opportunity to share what I’ve learned on our forums, and help community members resolve some of the issues they’ve run in to.

    Me standing in a parking lot

    My biggest goal for the summer is to help make the Tessel and its modules as easy to use as possible. I’ll be spending plenty of time improving the BLE library and contributing to full node compatibility in our runtime. Having a predominantly software background means I still have a lot to learn about hardware, but the team has been very supportive and has helped me learn a lot already.

    That’s enough about work - let’s hear some more about me. I move around the country quite often, so I typically spend my weekends exploring whatever new area I’m living in. Bonus points for me whenever I stumble across that restaurant that doesn’t look like anything special but actually has the most amazing food. You know the one - the one only the locals know about. Aside from restaurants, I also enjoy checking out museums and finding a nice trail for running or hiking. When I’m not working full time, I’m actually still a student at Olin College of Engineering, working towards a degree with the words “Engineering” and “Computer” somewhere in the name. I’ve still got one year left come September, and the closer it gets the more excited I am to graduate.

    Watch for more posts from me in the future, probably about BLE, and feel free to reach out anytime on Twitter @evanmsimpson, our forums, or email at evan at technical.io. I’m really excited to be working at Technical Machine where I can surround myself with knowledgeable people, and hopefully learn a lot this summer.

    -Evan

    #Tessel #intern #disney #ble #rfid #hardware #evan simpson #technical machine #olin #student

August 2018

January 2018

July 2017

February 2017

November 2016

October 2016

September 2016

August 2016

July 2016

June 2016

April 2016

March 2016

February 2016

November 2015

September 2015

August 2015

July 2015

June 2015

May 2015

March 2015

February 2015

January 2015

December 2014

November 2014

October 2014

September 2014

August 2014

July 2014

June 2014

May 2014

April 2014

March 2014

February 2014

January 2014

December 2013

November 2013

October 2013

September 2013

August 2013

July 2013