Friday Hack Chat: JavaScript On Microcontrollers

Microcontrollers today are much more powerful and much more capable than the 8051s from back in the day. Now, they have awesome peripherals and USB device interfaces. It’s about time a slightly more modern language was used to program these little chips.

During this Friday’s Hack Chat, we’re going to be talking about JavaScript on microcontrollers. [Gordon Williams] will be joining us to talk about Espruino. This is a tiny JavaScript interpreter that runs on the little embedded chips, has a debug interface, and allows you to program your board on any platform without any external programming hardware.

[Gordon] is the key developer of Espruino, and so far he’s launched a full-sized Espruino, and a pico Espruino on Kickstarter, both with amazing success. The software stack has been extremely popular as well — it’s been ported to the ESP8266 and dozens of other microcontrollers that will soon be in the Internet of Things.

During the Hack Chat, we’ll be discussing interpreted languages on microcontrollers, interpreter design and optimization, with a special emphasis on creating devices with Espruino and putting Espruino boards on the Internet with WiFi, Bluetooth, and other crazy radios. As always, we have a spreadsheet open to everyone if you’d like to ask a question.

Here’s How To Take Part:

join-hack-chatOur Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. Hack Chats are mostly, usually, and this week noon, Pacific time on Friday. Here’s a time and date converter!

Log into Hackaday.io, visit that page, and look for the ‘Join this Project’ Button. Once you’re part of the project, the button will change to ‘Team Messaging’, which takes you directly to the Hack Chat.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

JavaScript For The ESP8266

The ESP8266 is a popular WiFi chip that provides a relatively transparent connection between the TX and RX pins of a microcontroller and a WiFi network. It was released a little more than a year ago, and since then developers and hardware hackers have turned the ESP into much more than a serial to WiFi bridge. It’s a microcontroller platform unto itself, with a real development environment and support for the scripting language Lua.

Lua is okay, but a real win would be a JavaScript interpreter for this tiny WiFi platform. It’s taken months of work, but finally there’s an open source version of JavaScript available for the ESP8266.

This build is based on the Espruino firmware, a JavaScript interpreter for microcontrollers. This interpreter runs on dozens of different microcontrollers, but being the latest, greatest, and most popular new microcontroller platform means a new solution for the ESP is very, very exciting.

Right now the JS interpreter for the ESP is in testing, with expectations high that everything will be brought over into the main branch of the Espruino firmware. There are samples of JavaScript running on the ESP available, and binaries that can be flashed onto an ESP are available here.

Thanks [Richard] for sending this one in. He’s set up an Espruino board on the ESP8266 community forum, that should eventually be filled with new examples of JavaScript running on an ESP.

“Bricking” Microcontrollers In LEGO Motivates Young Programmers

Back when he was about seven years old, [Ytai] learned to program on an Atari 800XL. Now he has a seven-year-old of his own and wants to spark his interest in programming, so he created these programmable LEGO bricks with tiny embedded microcontrollers. This is probably one of the few times that “bricking” a microcontroller is a good thing!

IMG_20150519_144818The core of the project is the Espruino Pico microcontroller which has the interesting feature of running a Java stack in a very tiny package. The Blocky IDE is very simple as well, and doesn’t bog users down in syntax (which can be discouraging to new programmers, especially when they’re not even a decade old). The bricks that [Ytai] made include a servo motor with bricks on the body and the arm, some LEDs integrated into Technic bricks, and a few pushbutton bricks.

We always like seeing projects that are geared at getting kids interested in creating, programming, and hacking, and this certainly does that! [Ytai] has plans for a few more LEGO-based projects to help keep his kid interested in programming as well, and we look forward to seeing those! If you’re looking for other ways to spark the curiosity of the youths, be sure to check out the Microbot, or if you know some teens that need some direction, perhaps these battlebots are more your style.

Hackaday Links Column Banner

Hackaday Links: November 23, 2014

The 2015 Midwest RepRap Festival, a.k.a. the MRRF (pronounced murf) was just announced a few hours ago. It will be held in beautiful Goshen, Indiana. Yes, that’s in the middle of nowhere and you’ll learn to dodge Amish buggies when driving around Goshen, but surprisingly there were 1000 people when we attended last year. We’ll be there again.

A few activists in St. Petersburg flushed GPS trackers down the toilet. These trackers were equipped with radios that would send out their position, and surprise, surprise, they ended up in the ocean.

[Stacy] has been tinkering around with Unity2D and decided to make a DDR-style game. She needed a DDR mat, and force sensitive resistors are expensive. What did she end up using? Velostat, conductive thread, and alligator clips.

You know the Espruino, the little microcontroller board that’s basically JavaScript on a USB stick? Yeah, that’s cool. Now you can do remote access through a telnet server letting you write and debug code over the net.

The Open Source RC is a beautiful RC transmitter with buttons and switches everywhere, a real display, and force feedback sticks. It was a Hackaday Prize entry, and has had a few crowdfunding campaigns. Now its hit Indiegogo again.

Speaking of crowdfunding campaigns, The Mooltipass, the designed-on-Hackaday offline password keeper, only has a little less than two weeks until its crowdfunding campaign ends. [Mathieu] and the rest of the team are about two-thirds there, with a little more than half of the campaign already over.

Using A Headphone Jack As A UART

We’ve seen audio ports being used to establish a communications channel between a computer and a microcontroller before, but nothing quite as slick as this. [Gordon] is using a webpage running on a tablet to send Javascript to a microcontroller where the entire program is interpreted.

[Gordon] is using the Espruino Pico, a board that’s on Kickstarter right now. This tiny board is built around a javascript interpreter, allowing code to be written and updated on the fly without mucking around with bootloaders.

This technique can be expanded to provide bidriectional communication between a microcontroller and a computer. On the project Github, [Gordon] used the microphone pin on a TRRS jack to sent data to a computer. It needs two more resistors, but other than that, it’s as simple as the one-way communications setup.

[Gordon] put together a few demos of the program, including one that will change the color of some RGB LEDs in response to input on a webpage.

Continue reading “Using A Headphone Jack As A UART”

Espruino Pico, Javascript On A USB Stick

There are probably very few official numbers for this, but web developers at least seem to outnumber the amount of people who regularly poke pins and registers with C. For them, the embedded world must be a scary and foreboding domain, full of bitwise operations and dynamic types. [Gordon] figured there was another way and built a Javascript interpreter for a microcontroller. The latest board built around this interpreter is up on Kickstarter, and its even smaller and more capable than his earlier version.

This isn’t [Gordon]’s first rodeo; last year he launched the (full-sized) Espruino, featuring an ARM Cortex M3 and his very own Javascript interpreter. The large-scale Espruino was a rousing success, and now he’s moving on to a smaller thumb drive-sized footprint for the Pico. The hardware is a bit better, relying on the ARM Cortex M4 STM32F4 with a bit more RAM, and this time the board is slightly cheaper. It still runs the same Javascript interpreter, though, so all the code is exactly what you’d expect.

We haven’t seen many projects using this tiny Javascript of Things, but the new layout does make it fantastically useful. Depending on how the crowd funding campaign turns out, [Gordon] might be adding socket, and USB HID support, along with inline C functions.

The JavaScript Of Things

Espruino

There are a ton of people out there that can program in JavaScript, but give them an embedded device, and they’re up the creek without a paddle. Not anymore, that is, thanks to [Gordon]’s wonderful Espruino, a JavaScript interpreter for ARM microcontrollers. Oh, it’s also a very capable dev board that has more than enough power to turn just about any project you can imagine into reality.

On board the Espruino is an ARM Cortex M3 in the form of an STM32 chip, 256kB Flash, 48kB of RAM, and a ton of PWM and ADC pins to go along with 2 SPI ports, 2 I2C ports, and 2 DACs. It’s a very capable piece of hardware, and if you’re looking to build anything, it would be hard to pick a better general purpose dev board.

[Gordon] has put his board up on Kickstarter, and since it’s already been successfully funded, he’ll be releasing the hardware and software sources under an Open Source license. If you’ve ever wanted to run JavaScript on an ARM board, it looks like Espruino is just the ticket.