News for hackers. Stuff that matters.
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by rdtsc on Tuesday January 20, 2015 @09:11PM (#8921077)
That's a cool project!

The author -- Frank Hunleth gave a talk at Erlang Factory last year about it:

http://www.erlang-factory.com/sfbay2014/frank-hunleth (Building an IP Network Camera)

It was fun and he did a demo too.

The idea was that Erlang works very well as an init/supervisor on an embedded system.

Erlang processes map very well to a full OS processes but on a smaller scale -- tiny stack space (a couple K) + but heaps are isolated. There is also a C API which makes it nice to interface with hardware.

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by oubiwann on Tuesday January 20, 2015 @10:11PM (#8921248)
Frank's also going to be giving a talk at Erlang Factory SF this year -- but this time on the Nerves Project itself :-)
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by shadeless on Tuesday January 20, 2015 @09:13PM (#8921085)
I was looking for something like this for a project that involve IoT device and need near real time feedback. One thing that isn't clear to me is what should be used to communicate between the devices and servers?

Having no experience with it (and having background in Node.js), websockets sounded like a way to go at first but I didn't see it mentioned much in that context, on the other hand I heard about few projects who use messaging systems like RabbitMQ and similar to transfer data back and forth. Thoughts?

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by rdtsc on Tuesday January 20, 2015 @09:25PM (#8921124)
Look at the link to the talk about this project I posted above. Frank used Cowboy (Erlang web server). It was in used in 3 ways -- serving static files, websockets (you can use that for signaling) and streaming binary data (video) using Motion JPEG.

Other projects might use MQTT -- a messaging system built for smaller devices (instead of say AMQP). RabbitMQ has a driver for it:

http://www.rabbitmq.com/blog/2012/09/12/mqtt-adapter/

But if you can get any server that supports websockets and have websocket clients in your client code (if you don't use a browser). Then you can roll your own messages using JSON or even binary.

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by shadeless on Tuesday January 20, 2015 @09:44PM (#8921183)
Wow, that looks exactly like what I wanted! Bookmarked the talk immediately, thanks.

Also one big unknown to me is updating the devices. I skimmed the nerves website and the slides from the talk and it looks like the only way is to write directly to the device SD card, there's no over-the-air updates?

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by rdtsc on Tuesday January 20, 2015 @10:04PM (#8921233)
From the same Nerves project I had founnd this:

https://github.com/fhunleth/fwup

It is a firmware updater. It seems one mode is the basic create whole disk image and replace. The other is can handle update "tasks".

Now in general Erlang was built to handle hot-code updates. Basically replace the code while the code is running (have use immutable data structures and have specials facilities built it).

But that can be tricker to set up and if you have C code or hardware control, it might not work as well. So upload firmware then reboot might work (I am just guessing here since I don't know any details or goals).

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by shadeless on Tuesday January 20, 2015 @10:31PM (#8921299)
That looks promising, thanks! This thread just gave me a great excuse to get into Erlang (and Elixir), seems too good to be true.
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by jacquesm on Tuesday January 20, 2015 @10:33PM (#8921304)
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by shadeless on Tuesday January 20, 2015 @10:51PM (#8921348)
Thanks for the reminder, I read nice things about that book on several occasions.
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by nitrogen on Wednesday January 21, 2015 @12:52AM (#8921709)
If it's okay to lose an update or two every now and then, you can send individual UDP packets with something like JSON or MessagePack in them. Otherwise use a raw TCP socket. No need for a framework and HTTP just to communicate.

For bigger systems, RabbitMQ is pretty nice.

Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by rcarmo on Wednesday January 21, 2015 @02:58AM (#8922035)
I'd love to see this for the Raspberry Pi as well (the hardware's a fair bit more popular)
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by oubiwann on Wednesday January 21, 2015 @10:08AM (#8923363)
Frank's been doing all his latest work on the Raspberry Pi, actually. In fact, that's what he tested the new LFE support on :-)
Re:Cross-compiled Erlang, Elixir, and LFE for Embedded Devices by rcarmo on Thursday January 22, 2015 @06:29PM (#8932484)
That's grand. I can't see an image for it anywhere, though...

(edit: found the instructions for it on the SDK)