Posts | Comments

Planet Arduino

Archive for the ‘General’ Category

Last week I received my M5Stack unit. It’s a nice little device with a ESP32 and a clever system to stack multiple elements. The top element contains a main unit that also contains a display, three buttons (beside the Power button), a slot for a SD card and an USB-C connector for the communication and for charging the battery.

To use the web frontend from io.m5stack.comto program the device we need a new firmware.

We are going to use

esptool
 which will handle the flashing process. On Fedora execute:

$ sudo dnf -y install esptool

Now erase flash of the ESP32 after you have connected the M5Stack.

$ esptool --chip esp32 --port /dev/ttyUSB0 erase_flash

Flash the new firmware.

$ esptool --chip esp32 --port /dev/ttyUSB0 write_flash --flash_mode dio \
    -z 0x1000 m5cloud-20180323-v0.3.8.bin

After the reboot, connect to the SoftAP (like you do for other frameworks like ESPEasy) and attach your device to the web interface. Now, coding can start…just simple than using the WebREPL for Micropython.

xLights is a free and open source program that enables you to design, create and play amazing lighting displays through the use of DMX controllers, E1.31 Ethernet controllers and more.

With it you can layout your display visually then assign effects to the various items throughout your sequence. This can be in time to music (with beat-tracking built into xLights) or just however you like.
Currently xLights runs on Windows, OSX and Linux

I look after the Linux build and since most of the other core developers are running Windows or OSX build/compile issues occasionally come up.

To help know when/how such breakage occurs I have setup automatic builds via travis-ci which are triggered after every commit.  This way when a commit breaks the linux build I get an email so I can quickly go and check/fix as needed.  Thanks to the integration with GitHub

Setting this up was a bit more complicated than just turning on builds in travis-ci.

By default the build environment on travis-ci is Ubuntu trusty (which is the Ubuntu I want to use as it is the oldest LTS still supported and so useful for AppImage builds) – but sadly that doesn’t have new enough libraries (in particular the ffmpeg libraries) and also the build toolchain is too old (need C++14 support which is only in the newer gcc).  Adding these dynamically every build was not practical.  As such I had to build a custom docker image which was pre-configured with the necessary libraries/tools etc.  Doing it this way also meant that I could provide a pre-compiled wxwidgets as part of the image rather than having to rebuild it every time (this saves substantial time).

To build the Docker image I had to create a suitable ‘Dockerfile‘ which describes the build of the image.  This dockerfile was as follows:

FROM ubuntu:14.04

ADD cbp2make /usr/bin/cbp2make
ADD Recipe.deps /Recipe.deps
ADD Recipe /Recipe
ADD Recipe.appimage /Recipe.appimage

RUN bash -ex Recipe.dep

This dockerfile is different to most others I have seen.

It starts by saying the base image (Ubuntu 14.04) and then adds a couple of files.  Rather than having the dockerfile cause the complete build of xLights it just sets up for future builds.

It adds four files, the first being a quick pre-built cbp2make (since that is not available in ubuntu 14.04 – this was the simplest way to add)

The next three are Recipe files.

  • Recipe.deps just sets up the image by installing dependencies and pre-building wxWidgets.
  • Recipe clones the source of xLights from GitHub and then builds it.
  • Recipe.appimage takes the built xLights and packages it up as an AppImage binary.

Then it only runs the Recipe.deps – this way the docker image is ready to build and we don’t waste time rebuilding things that don’t change.

Once this was setup with all those files in a single directory the next step was to build the docker image and upload to docker hub.

$ ls
cbp2make Dockerfile out Recipe Recipe.appimage Recipe.deps
$ docker build -t xlights_image .
$ docker create --name xlights_container xlights_image
$ docker tag xlights_image debenham/xlights:latest
$ docker push debenham/xlights:latest

This simply build the docker image and called it ‘xlights_image’.  This runs the Dockerfile script which adds the required files and then runs Recipe.deps to preconfigure the image.

It then created a container from this image, tagged it with my dockerhub username and finally uploaded to dockerhub so that Travis-CI can use it.

At this point I could test the build (from almost anywhere) by simply pulling the image and running the ‘Recipe’ script.

$ docker pull debenham/xlights
$ docker run --name buildvm debenham/xlights /bin/bash Recipe

If I want to build the AppImage binary I do the same thing – but run the Recipe.appimage script instead.

$ docker pull debenham/xlights
$ docker run --name buildvm debenham/xlights /bin/bash Recipe.appimage

Now all that was left was to integrate this with GitHub/Travis-CI.  This is done by creating a ‘.travis.yml‘ file in the root of the git repository.

Thanks to the docker image this file is simple

dist: trusty
sudo: required
services:
    - docker
git:
    depth: 3
script:
    - docker pull debenham/xlights
    - docker run --name buildvm debenham/xlights /bin/bash Recipe
notifications:
    email:
      recipients:
        - chris@adebenham.com
        - keithsw1111@hotmail.com
     on_success: never
     on_failure: always

This travis file starts by saying what the build needs (ubuntu trusty, docker, sudo etc).  Then describes how to build/test xLights (by pulling the image and then running the Recipe).  Once this is done it says what sort of notifications are needed.  In this case it will notify via email to myself and one other developer.  It also says that want to be notified when the build fails (rather than on every build)

All that remained was going to Travis-CI and turning on the automatic build.

In a coming post I will describe how I build both AppImage binaries and Ubuntu packages for each release.

Each year I setup a display of Christmas lights in Narara.

This year (2015) I pretty much started from scratch as I moved to all pixels (each light is individually controlled)

Here are videos of my lights this year.

Jingle Bells pon de Floor

Light Of Christmas

What’s This

Wizards of Winter

Technical Details

For those that are interested this is all controlled by a Sandevices E682 and Advatek Pixlite4 sitting in a large plastic tub.

IMG_20151127_140104

All the sequences were created in xLights running on Linux – and the show is controlled by FPP running on a Raspberry Pi

If anyone is interested in the sequences used here is a zip file containing all the sequences and my xlights_rgbeffects.xml file

2015_Sequences

Gen
09

Edidoom: Intel Edison Running Doom

arduino, doom, edison, Gaming, General, Intel Edison Commenti disabilitati su Edidoom: Intel Edison Running Doom 

Wiring of the TFT to an Intel EdisonProving that the Intel Edison is really a full Pentium-class PC, Lutz has successfully ported Doom to the tiny board. For those who aren’t quite as old as I am and are unfamiliar with the classic title, Doom literally blew away gamers in 1993 with a combination of fast paced […]

Read more on MAKE

circular-knitic-1Artist duo Varvara Guljajeva & Mar Canet designed and built an open hardware automated knitting machine called Circular Knitic.

Read more on MAKE

Gen
06

Losing to My High School Class a Big Win

3D printing, arduino, education, Electronics, General Commenti disabilitati su Losing to My High School Class a Big Win 

IMG_0695Recently I switched careers from designing industrial food and dairy equipment to teaching industrial technology in a high school. While planning this move and taking night classes, I read quite a bit about authentic instruction where the students engage in real projects that end with something tangible and with real […]

Read more on MAKE

Dic
14

10 Perfect DIY Projects for Makers Who Love Their Pets

arduino, Craft, Electronics, General, Raspberry Pi Commenti disabilitati su 10 Perfect DIY Projects for Makers Who Love Their Pets 

Dean Segovis’ Fetch-O-Matic is an automatic tennis ball launcher the gives dogs a workout while having fun. The secret to the launcher is the windshield wiper motor housed inside. When a ball is dropped inside the holder, it sends some power to the motor, which in turn transfers the energy to the spring-loaded throw arm and launches the ball. Those savvy enough can train their dogs to use it by themselves whenever they want to have fun.  Pets are people too. If corporations can be labeled as people then why can’t our pets? Regardless, when it comes to our pets, we often spoil them with lavish gifts to show our affections. Makers on the other hand tend to build projects that help with everything from feeding […]

Read more on MAKE

Nov
21

Eric Huebsch’s Humorous Blinking Rock Sculpture

arduino, Art & Design, General, motion activated Commenti disabilitati su Eric Huebsch’s Humorous Blinking Rock Sculpture 

rock-brother-1This blinking rock sculpture by artist Eric Huebsch just can't help but look a little sentimental

Read more on MAKE

The #meARMThe meArm is a small, hackable, robotic arm designed from the ground up to be low cost and easy to use.

Read more on MAKE

Nov
06
e-traces-shoes-2See the big picture when it comes to dance moves with an ingenious piece of wearable electronics by designer Lesia Trubat González called E-Traces.

Read more on MAKE



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook