
Tessel: A microcontroller that runs JavaScript - darkmethod
https://tessel.io/
======
justincormack
Actually, a microcontroller that runs Lua. They released the source for the
JavaScript to Lua compiler today [https://github.com/tessel/colony-
compiler](https://github.com/tessel/colony-compiler)

~~~
sdegutis
That's pretty awesome. I love Lua lately, for its simplicity both in design
and implementation, and it's great to see that I can use it in an MCU! That
said, it's pretty dumb that it has to have a JS transpiler in order to get
popular.

~~~
anonymoushn
Apparently you cannot run code without using the transpiler, but it is
planned.

They also mention that the API will be awkward to use from Lua, but it's
probably pretty easy to fix this.

[http://forums.tessel.io/t/running-lua-on-
tessel/91](http://forums.tessel.io/t/running-lua-on-tessel/91)

------
VLM
My advice is the wrong tagline is up. If you want an embedded device running
JS or higher level than C anyway, you toss in a raspi with much better
hardware specs for much less money.

The secret sauce appears to be (at a glance) great software support (edited to
add, I'm talking about "high level bindings" like JS... there's plenty of C
for arduino, not nearly as much non-C) for a bunch of off the shelf compatible
debugged plugin hardware. Also deeply buried in the docs section it appears to
draw a Lot less power than a pi when doin "stuff". Of course if you want to
blink a LED I think a PIC 10F220 might just slightly have you beat by
approximately six orders of magnitude (no kidding, well 4 to 7 depending on
blah). Anyway that kind of stuff should be the primary advertising focus, or
at least thats what I found interesting.

I'm fuzzy on the "how easy is getting started" part, at least only after five
minutes. Not being clear means it must be as bad as gearing up for FPGA work
(just kidding I'm sure its not that bad). If its good, this might be an
additional secret sauce. Here's a 60 second video from opening box to blinking
LED (or, whatever)

At least that was the first five minutes impression from a hardware guy who
knows the market. And I've now spent more time typing and thinking than I
spent looking.

------
cobookman
I wonder how the timing on the micro-controller is. Is the JavaScript still
async? While JavaScript +/-10ms is fine on a computer, when messing with
signals that really limits you. Mind you this could be overcome by adding some
flag before the code to specify it to be run synchronously...or something like
that.

~~~
rtpg
nothing in Javascript fundamentally forces IO libraries to be asynchronous,
it's just that the domain in which JS is used (Node or Browsers) tend to have
a lot of async IO due to networks.

~~~
wyager
> nothing in Javascript fundamentally forces IO libraries to be asynchronous

Javascript inherently relies on highly non-deterministic heap allocation,
deallocation, and garbage collection. None of these are conducive to real-time
IO. You can not make strong guarantees about javascript execution time.

They probably partially get around this by having all the important IO stuff
done in C, but then that's not really a javascript microcontroller, is it?

------
johnohara
Device looks to be based on an NXP LPC1830FET180 microcontroller which uses an
ARM Cortex-M3 processor at 180MHz.

[http://www.nxp.com/products/microcontrollers/cortex_m3/LPC18...](http://www.nxp.com/products/microcontrollers/cortex_m3/LPC1830FET180.html)

The product page seems to indicate it does a more than run JavaScript.

~~~
dkersten
It doesn't run javascript (not natively). It runs just like every other ARM
microcontroller (so assembly, C, etc).

This device has a lua interpreter running as its firmware (coded in C, it
looks like) and these guys wrote a javascript to lua compiler.

So it runs javascript by compiling it to lua bytecode and then intrepreting it
in a C-based intrepreter.

------
habosa
Relevant: [https://xkcd.com/801](https://xkcd.com/801)

------
GuiA
$100 for something vastly inferior to a Raspberry Pi, Beaglebone, etc. that
cost 1/2 to 1/3 of that. What am I missing here?

~~~
mschuster91
It has WiFi, which requires FCC testing for the US market as well as
compliance certificates for the European area. These certifications and checks
are f...ing costly.

RPi/Arduino in contrast only have wired or no networking, thus eliminating a
huge part of the upfront costs (e.g. in Europe you then only need a CE
certificate, which you can either issue without testing and be liable if your
module doesn't meet the standards, or you get an ESD/EMR test for a couple
thousand bucks).

~~~
foxylad
Yes, but the Electric Imp has wifi built in for $30.

Ironically it uses the Squirrel language to program it, which I think was a
mistake - I found it very unproductive.

~~~
Zuph
They were using Lua, but found some of the features of the language to be non-
condusive to microcontroller use.

If you want something similar that can be programmed bare-metal, check out the
spark core: [https://www.spark.io/](https://www.spark.io/)

------
goodbyegti
It's absurdly expensive, even more so the modules. Looking at the BT module,
the BLE112 can be purchased for $15 in quantities of 1. So you pay $35 for a
small PCB, some pin headers and probably a wrapper around a UART.

~~~
mschuster91
As written above, everything related to radio has _huge_ upfront costs in
certifications. These costs are once-applicable, so if you're making a
million-unit BT dongle, then the certification costs per device are fractions
of cents. Here with thousand-unit series, the cost per device is massively
higher.

~~~
asdfs
Isn't the BLE112 already certified? Or does integrating it into a product
require you to get the entire product certified?

~~~
mschuster91
In Europe, the one who imports the device must submit a certification document
_for the device_... so even if you just stick already-approved products
together you have to do a complete recertification. This, sadly, also includes
selling a "Raspberry Pi computer" with you as distributor packing a Pi and a
Wifi stick in a case. Only if you ship the individual components to the
customer to self-assemble, you don't need certification...

~~~
tlrobinson
Where is the "individual components" line drawn?

~~~
mschuster91
As soon as you take anything and put it together, my lawyer has told me.
Technically, even computer shops assembling computers from parts will need a
full certification for every combination they sell... it's crazy.

Add the WEEE regulation (valuable resource recycling) to the mess and you're
out a couple thousand bucks if you do everything by the books.

~~~
tlrobinson
Interesting. Are Adafruit
([https://www.adafruit.com/category/112](https://www.adafruit.com/category/112))
and Sparkfun
([https://www.sparkfun.com/categories/16](https://www.sparkfun.com/categories/16))
certifying each of their wireless module breakout boards, for example?

~~~
mschuster91
Adafruit is an US company, they can take advantage of simpler US regulations.
As long as I import the modules for private usage, I don't need EU regulations
(but in case my device causes RF interruptions, I still am liable!).

As soon as I start to selling them for money in the EU, I am the importer and
thus need to provide CE certification, R&TTE inspection, WEEE trash register,
etc pp.

------
johnpmayer
This is great. I have some small background in real time embedded systems, but
I think that 99% of the "internet of things" need not be written in low-level
C. I'll probably pick this up...

...however, I do hope that they can bring down the price for future models.
$100 is a bit steep for a hobby project to control my AC. For now, I
understand that the premuim is rewarding the software effort.

~~~
Timmmmbob
You don't have to write in low-level C. You can write in high level C++, which
is vastly preferable to javascript! Or hell, why not write in Lua! It's what
this apparently transpiles to, and is much nicer.

The only reason javascript became popular is because it was the only option on
the web. Why does that mean we would want to use it when we have better
options?

~~~
bsder
> You can write in high level C++, which is vastly preferable to javascript!

First, C++ compilers are not available everywhere. Second, C++ compilers do
not always implement all corners of the language on embedded systems. Third,
C++ is better than Javascript? That's going to take some explanation.

> Or hell, why not write in Lua!

Lua has it's own share of "Wat". 1-based indexing when a non-trivial amount of
your stuff needs to interoperate with C is a big one. In addition, Lua is
nicely configurable--read, "Every Lua implements a different set of modules."

> The only reason javascript became popular is because it was the only option
> on the web.

It's popular to hate on Javascript, but Javascript isn't that bad. Go back and
take a look at Javascript in the Netscape 2.0 and Netscape 3.0 timeframe. It's
a fairly straightforward, minimal language.

Now, all that having been said, this isn't exactly impressive. A 180MHz ARM
with 32MB of flash and 32MB of RAM is not a small processor. With that level
of power, there are lots of options.

If this were running on an 50MHz M0 with 256K flash and 16K RAM, it would be
impressive.

~~~
dkersten
> First, C++ compilers are not available everywhere.

Neither is javascript. If both are available for this micro, then his
statement is as valid as yours.

> Second, C++ compilers do not always implement all corners of the language on
> embedded systems.

I've done a good bit of embedded programming in C and I wouldn't need all of
C++ to make life a lot easier.

> Third, C++ is better than Javascript? That's going to take some explanation.

To-may-to/to-mah-to. Whichever way you want to spin it (C++ > javascript or
javascript > C++) is going to take some explanation.

> but Javascript isn't that bad

No. But its also not as that great in comparison to how popular it is. Its
certainly improved a lot since the early days, but it still has some pretty
significant warts. Most languages do, of course, so if this is an issue or not
kinda depends on the "third" above.

> Now, all that having been said, this isn't exactly impressive. A 180MHz ARM
> with 32MB of flash and 32MB of RAM is not a small processor. With that level
> of power, there are lots of options.

Indeed. I wonder how much overhead this has compared to running C on the same
thing. I have nothing to back it up and certainly don't have time to
benchmark, but I'm convinced I could write a forth interpreter running on a
60MHz PIC24E that would have competitive performance to this thing. Maybe I
wouldn't beat it, but I reckon I could come close enough.

~~~
bsder
> Neither is javascript. If both are available for this micro, then his
> statement is as valid as yours.

Hrm, I stand corrected. I thought that at least some of the Javascript
implementations were C-only, but it looks like they all require C++.

> I've done a good bit of embedded programming in C and I wouldn't need all of
> C++ to make life a lot easier.

Templates, exceptions, and memory allocation all interleave and you pretty
much can't have one without all of them. And that's a huge amount of overhead
on a truly small system (which this is not--my first Linux box wasn't 180MHz
with 32MB or RAM). About the only thing you can have standalone is the
original "C with classes" subset of C++. And I just don't find that very much
more useful over straight C (and certainly not over the latest standard C11)

However, I'm much more interested in Rust on embedded systems than these
dynamic languages.

~~~
dkersten
Do they not support templates? I'd be happy with "C with classes, templates
and RAII". But point taken regardless.

I completely agree - I'm also much more interested in Rust for low level and
embedded programming!

------
rememberlenny
I won a Tessel at JSConf this year and love it.

Are there ways to make our own module attachments? The $50 parts seem a bit
steep.

~~~
kam
Yes. The module ports are documented here:
[https://github.com/tessel/hardware/blob/master/tessel-
hardwa...](https://github.com/tessel/hardware/blob/master/tessel-hardware-
overview.md#pins-and-ports) and the JS APIs for using them here:
[https://tessel.io/docs/hardwareAPI](https://tessel.io/docs/hardwareAPI)

------
pessimizer
When I think microcontroller, I think < $5. I'm not sure what this is supposed
to be for - it's almost as expensive as a gumstix board.

------
ojanik
Not enough jQuery!

------
refrigerator
How does this compare to [http://www.espruino.com/](http://www.espruino.com/)?

------
batmansbelt
Espruino is a similar device (without the cool plugins though, so expect to
use a soldering iron). Much cheaper too.

~~~
pmontra
I got one and I'm starting to experiment. I discovered that soldering can be a
problem. First, I had to buy a solder. Second, physics is merciless and a
mistake can toast your card (didn't happened to me yet) vs the run-fail-debug
loop we're used to in sw development.

Anyway, some hw modules have been tested with Espruino and the web site
explains how to use them. My understanding is that you can plug almost
anything into it, you just (!) have to know its specs and how to wire it to
the board.

~~~
batmansbelt
Yep, lots of good tutorials, and the creator of the board is quite helpful on
email.

------
ptk921
In their code snippet, it seems that position is not defined for the first
loop and would throw a ReferenceError.

------
zwieback
Really slick looking but way too expensive. Might buy it for $40, tops.

------
mpnordland
Yes, because we really, really need something else to run JS.

------
eudox
You win, please, just stop the pain.

~~~
angersock
Javascript: the embedded parts.

~~~
mtdewcmu
Learn Javascript the Hardware Way

