Avatar for thomc


Member since Mar 2014 • Last active Dec 2016
  • 2 conversations

Most recent activity

  • in Electronics
    Avatar for thomc

    It would be nice to have a selection of breakout shims for SMT prototyping with I2C chips. Something like:


    Would be cheap and make life easier to experiment with new chips.

  • in JavaScript
    Avatar for thomc

    @d0773d Did you ever get AES working? I just tried it with the smallest JS AES code I could find (https://github.com/mdp/gibberish-aes), stripped required parts, minified it, and it ran out of memory expanding Rcon.

    It isn't written for embedded devices, so I might have to port one of the Arduino ones if I can't find something.

  • in Interfacing
    Avatar for thomc

    Very elegant way to do it!

    I was recently researching using a cheap SDR dongle for decoding 433 and came across a tool which specifically does that with various protocol support. Example:


    It also has a feature to analyse unknown protocols.

    As an aside some people have used SDR with GNU Radio to process 433 into audio and use Audacity to view the waveform: http://www.kukk.org/blog/sdr/messing-wit­h-433mhz-equipment/

    Doesn't beat a couple of quids worth of components and a bit of JS in a web browser though!

  • in General
    Avatar for thomc

    Hi @Vicary, this is a lot more difficult than it sounds. I investigated emulating a SD card (not with Espruino) and it was a lot of work. I found a solution for my needs (security testing) by getting a SD->USB Mass Storage adapter, and then emulating USB mass storage with a microcontroller. So it went Microcontroller(emulating USB MS)->adapter->MicroSD->Device

    It was pretty slow, and the adapters were hard to find and now discontinued:


    Only other option I saw at the time was an expensive industrial SD card testing unit. I might have another look because it would be so useful.

    An easier solution for you might be to use a USB drive to hold your root file system. Emulating a mass storage device is much easier, and I believe there might be devices that allow you to do it (I have one which selects ISOs and emulates a DVD drive).

    See https://samhobbs.co.uk/2013/10/speed-up-­your-pi-by-booting-to-a-usb-flash-drive

  • in General
    Avatar for thomc

    @Manxome in a similar way you can attach an Interrupt to a pin on, say, an Arduino, you can set a watch on a pin in Espruino. When the pin changes (rises, falls, or both) it will call your function:


  • in Interfacing
    Avatar for thomc

    On closer inspection, it looks like they based the receiver code on an Arduino project called RCSwitch which appears to listen for and implement 3 different protocols:


    These protocols I assume cover a wide variety of those cheap Chinese 433Mhz sensors from eBay, and can "learn" them, but it is not as if it is pulling an unknown protocol out of the air. That would be too difficult with the noise as you say.

    With that in mind I guess one would have to implement the protocol for whatever device(s) they are using. So the ability to have the tools/functions available to do that with fast execution is the most useful. So the native code idea sounds like the most flexible.

    I am planning on getting my 433 sensors such as temp, humidity, PIR, doorbell, all hooked up to the Espruino, as well as LightwaveRF. So I'll have to figure out how to detect each protocol. This would make a cool 433Mhz sniffer project too ;)

  • in Interfacing
    Avatar for thomc

    Regarding transmit, the array of times would be excellent. If nothing else it simplifies it and can ensure a perfect waveform. With a slight optimisation I was able to get LightwaveRF working with a simple loop around digitalPulse, rather than eval() a string of digitalPulse commands, but it is right on the verge of being too slow.

    Regarding receive, I have a device called NinjaBlock which was another Kickstarter which is a home automation and sensor hub. It is a BeagleBone with an attached Arduino cape that does 433Mhz transmit and receive.

    Running on the BeagleBone was a Node.js app which talked to their cloud API. You can put the NinjaBlock into learning mode, activate a 433Mhz device such as a doorbell or PIR sensor, and it would learn it. From there you can set it to take actions, e.g. if PIR sensor then take photo and upload to Dropbox. Additionally you could send 433Mhz signals to control devices.

    It supported lot of sensors and devices, mainly the cheap ones from eBay. It didn't support LightwaveRF, I guess because the protocol is a little more involved.

    Anyway, this is all to say that they have managed to decode different radio signals with an Arduino, and it is open source in case some of the code is helpful:


  • in Interfacing
    Avatar for thomc

    Refactored this a bit and it works nicely. Now going to move my efforts to GitHub:


    A humble start, but something to build from. Given it is using JS it would be nice to make it object oriented so we could do:


    You get the idea anyway.

  • in Interfacing
    Avatar for thomc

    btw, I can't help thinking that your interpretation of the protocol is how it should have been, it makes so much more sense. The encode array you created by adding a bit and turning 10 into 0 now has an obvious pattern running through it. And simply having a longer pause on a 0 is much easier. Of all the people that reversed LightwaveRF and re-implemented the protocol and you are the only one that saw it... :)