Posts

Java control of WS2811 / WS2812 LED Strips (aka NeoPixels)

Image
diozero has included support for NeoPixel LEDs via a JNI wrapper of Jeremy Garff's excellent rpi_ws281x library for sometime now. Unfortunately this only works on the Raspberry Pi, annoying given that diozero is intended to be platform independent. I'd read that it was possible to control such LED strips via SPI, investigating this further had been on my to-do for sometime given that it could final allow for a truly platform independent library for LED strips. I quickly hacked together some Java code based on a loose port of Jeremy's SPI code and tested it out last night, to my surprise it worked first time on one of my old Pi Zeros: I am in the process of adding this to diozero, hopefully this code will work on all of the other devices that diozero supports. I'll also need to look into including support for 5050 / Adafruit DotStar  / WS2801 / APA102 LED strips.

Adding a custom library to Arduino IDE

Yesterday I posted how I had no idea how to add the nanopb library to the Arduino IDE given that it does not appear in the IDE's Library Manager. This is probably very basic to most Arduino folks, it was as simple as manually adding the library to the Arduino's libraries folder! On Windows 7 this is "My Documents/Arduino/libraries". Commands in cygwin terminal: cd $HOME/My\ Documents/Arduino/libraries/ git clone https://github.com/nanopb/nanopb Restart the Arduino IDE and it is ready to use, simple! I've validated that I can now compile this ESP8266 MQTT example project. For reference, here is another interesting article on this subject: Internet of Things Applications with MQTT and nanopb Protocol Buffers .

Remote communication options

I've been adding support for remotely controlling very small Arduino compatible devices over USB via StandardFirmata  using firmata4j . This is working well however has a number of issues: As far as I know, Firmata doesn't support SPI (there is a proposal to include support) firmata4j only supports serial connections To resolve option 1 I am looking into developing my own remote communication protocols  using various combinations of JSON and Google Protocol Buffers over MQTT, HTTP and WebSockets. This is currently work in progress, however, GPIO and SPI are both working - I've tested GPIO output as well as controlling an SSD1331 colour OLED display over SPI (I've not tested I2C yet). Performance was surprisingly good. I need to work on a protocol for discovering board capabilities remotely that works for all Single Board Computers as well as Arduino compatible devices. I'm not sure how to include Protocol Buffer support on Arduino devices as there are

ESP8266 and slow WiFi

I'm in the process of adding support for these excellent little devices in diozero  using StandardFirmataWiFi . I'd followed the  instructions for adding support for this board in the Arduino IDE via the Board Manager. I was concerned with the extremely slow speed, in particular the get firmware (~10 seconds) and get board capabilities  (~27 seconds!) commands. A quick search and it seems that this is a known problem in v2.3.0 of the ESP8266 Arduino board library - this version is over a year old. The good news is that this will be fixed in the next version (v2.4.0) - response times for the slow commands are now in the order of milliseconds. Given the severity of the issue it is a shame it is taking so long for v2.4.0 to be released. The workaround is to use the latest version from git, simply follow the instructions for installing using git : cd /cygdrive/d/Apps/arduino-1.8.5/hardware/ mkdir espressif cd espressif git clone https://github.com/esp8266/Arduino.git esp82