DLP LightCrafter Display 2000 EVM and BeagleBoneBlack first setup

In this article we will make a first setup of our BeagleBoneBlack and our DLP LightCrafter Display 2000 EVM.





BeagleBoneBlack O.S. setup

In order to use the DLP with the BeagleBoneBlack we need to get the last Debian O.S. available for such board. The last version is provided both with the correct capes configuration and with a set of useful Python scripts to test the DLP.

You can download a nightly or weekly build from this site. For my setup I’ve downloaded the Stretch version (Debian 9) for SD card and with lxqt desktop.

After you’ve downloaded the image you can write it in your SD card using Etcher or your preferred image writer.

BeagleBoneBlack hardware setup

Simply plug the DLP module in the BBB. I suggest to use the provided screw in order to keep the BBB board raised and stable.

If you power the BBB board through the USB cable the DLP will not be powered. I’ve used a PSU to power both the BBB and the DLP board through the respective power jack.

We will use the USB cable just to connect the board to the PC.

First boot

When you power the BBB board you will see the user leds blinking. If you’re using Windows the board will be recognized and the drivers installed automatically.

The DLP will bootup, a green led will turn on and a default splash screen will be shown:

Project the BBB screen

We can tell to the BBB to send the Desktop screen to the DLP. To do so we need to connect to the BBB board using SSH. You can use any SSH client, on Windows you can use Putty.

Open your client and connect to the address, this is the default address used by the BBB board when connected through the USB cable, and port 22. When prompt digit the user debian and the password temppwd.

You will get the following output:

Now we can write the following two commands:

Those commands will instruct the DLP board to take as input source the video sent by the BBB board through the Parallel Interface and to use a resolution of 640×360 (nHD landascape).

Here the result:



Flash Espruino on ESP8266-01 board

Here some instruction on how to flash the Espruino system in the ESP8266-01 board using a USB-TTL adapter.


In order to flash the ESP8266-01 with Espruino we need to put the ESP in flash mode. To put the ESP in flash mode we need to pull-up gpio2, and pull down gpio0.

The EPS8266-01 pinout:

Image source: https://www.myelectronicslab.com/

Then the schema used to put the ESP in flash mode when connected to a FT232 adapter:

A summary of the connections:


To flash Espruino simply run this command:

You should get the following output:

First connection

In order to run in normal mode we need to change the connection schema:

I had some trouble connecting the ESP8266-01 for the first time to the Espruino IDE. I was able to connect to it using a standard serial software but no way with the IDE.

I’ve then installed the Espruino Tools and uploaded a first sample application that makes the ESP connect to the WiFi.

And here the sample.js code:

After the sample upload I was able to connect to my ESP using the Espruino IDE.

Internal/External temperature sensor with two ESP8266 boards and Espruino

In this article we will use two ESP8266 board to show internal and external temperature in an OLED screen using Espruino and some JavaScript code.





The internal board will:

  • read the temperature and humidity from a DHT22 sensor
  • receive the external temperature and pressure from the external ESP board
  • show all the information in the OLED screen

The external board will:

  • read the temperature and barometric pressure from a BMP085 sensor
  • send the temperature and the pressure to the internal board using a WiFi connection

In this article we will reuse the wiring and the code we wrote in the previous articles about the ESP8266 board.


The internal board is wired to the DHT22 sensor and the OLED screen:

The external board will be connected to the BMP085 sensor:

Internal board code

The internal board gets the internal temperature using the DHT22 sensor and print it in the OLED screen. The board prints also the external board information, we keep such information in an externalData variable.

But how the externalData variable get updated? Through a socket server that listen for new connection on port 1234. When a connection is established the server read the sent data.

The complete code is available as attachment. Time to setup the external board.

External board code

The external board reads the temperature and the barometric pressure from the BMP085 sensor and send it to the internal board using a TCP connection.

The result


How to make two ESP8266 communicate through WiFi with Espruino and JavaScript

In this article we will make two ESP8266 communicate using the WiFi network. We will use Espruino and some JavaScript code.

Setup the WiFi

Espruino offers a WiFi module that let us to connect to a WiFi network.

The code below will connect our ESP to the WiFi network and will print the information about the obtained IP plus other network information:

The result should be:

Please take note of the IP for both the devices, currently there are no other way to discover each other.

Now both the devices are connected to the WiFi network. Now we can make them talk each other. In this example we elect one board server and the other client. The client board will start a TCP communication toward the server board. Once connected they will able to exchange messages.

Setup the server

The server first setup the WiFi connection, then creates a socket server on port 1234 for receiving connection from the clients. When a connection is established it will print the messages coming from the client and will close the connection saying “I’m a server! Goodbye.”.

Setup the client

The client, after get ready with the WiFi connection, will try to connect to the server. When the connection is established it will send a “Hello I’m a client!” message and will wait for responses from the server.

The output

Here the output in the server side:

Here the output for the client side:

Reading pressure and temperature from a BMP085 using an ESP8266 board and Espruino

In this short tutorial we will read the barometric pressure from the BMP085 sensor using an ESP8266 board and Espruino with some Javascript code.


Our BMP085 sensor communicates through an I2C connection, so we need to connect the SCL pin to the corresponding D1 pin and the SDA pin to the corresponding D2 pin in the ESP board. The other two pins are dedicated to the power.


To read both pressure and temperature we will use the BMP085 module of Espruino. After the I2C connection is setup we initialize the BMP085 module, then we start polling and printing the sensor information.

Here the result:

Showing temperature in a OLED display using Espruino and an ESP8266 board

In this short article I will show you how to read the temperature and the relative humidity from a DHT22 sensor and display it in a 128×64 OLED display using an ESP8266 board with Espruino and JavaScript running on it.


The DHT22 has 4 pins, only three used: two for the power and one for the data. We will connect the power pins to the corresponding pins on the ESP8266 board and the data pin to one of the GPIO pin, D7 in our schema.

The display is a SSD1306 with a resolution of 128×64 pixels and I2C communication. The display has four pins, two for the power and two for the I2C. We connect the I2C pin to the corresponding D1 e D2 pins in the ESP8266 board.


Espruino provides a module for reading the temperature and the relative humidity from a DHT22 sensor. We will use it to read both the values from the connected sensor.

Then we will use the I2C module combined to the SSD1306 module to show the collected information in the display.

We will poll the sensor every 2 seconds and update the display consequently.

The final result:

How to install Espruino firmware in an ESP8266 board


This is an update to the installation tutorial I’ve already wrote: Run JavaScript on your ESP8266 using Espruino firmware

For this installation I’m using a D1 mini board which is a “wrapper” for the ESP8266 (ESP-12) board.

Flash the Espruino firmware

The first step is to flash the Espruino firmware into the ESP board. You can find a tutorial in the Espruino site. In this article I’m putting a short list of instructions ready to use.

Install the ESP tools with the following command:

The ESP tools are a set of Python scripts necessary to flash a firmware in the ESP board.

We need now the last version of the Espruino firmware, you can get it from the download page of the Espruino site. The zip file will contain the Espruino firmware also for the ESP8266 board.

We are ready to flash our board. The following instruction are for a ESP-12 board connected to the /dev/ttyUSB0 port. Please refer to the original tutorial for a different version of the ESP board. First move to the folder where you have unzipped the firmware.

The blue led in the board will start blinking and you will see the following output in console:

If you’re having problems finding the correct device path in Linux:

  • first check that you’re using an USB data cable. The first time I’ve tried I was getting crazy because I was using a simple power USB cable.
  • second try this console command to print the system events when the USB cable is plugged:

    When you plug the cable you will get something like this:

Ready to run

After the flash operation the board is ready to receive your JavaScript commands!

To send the commands you need to connect to the board using a serial connection (through the USB port). Under linux you can use the screen program:

Now you can send JavaScript commands that will be interpreted and the output provided as response.

For example writing:

you will get:

You can call functions, for example:

it will reset the board and print a boot message:

If you want to exit from Screen press CTRL-A and then \.

Now you’re ready to write your JavaScript code and run it in a ESP8266 board, for example using the Espruino Web IDE.


Handling polymorphism with Jackson

Sometime you need to serialize a hierarchical model to JSON. Jackson offers different ways to handle the problem. Here I will expose two of them.


First solution: Annotate the super class with @JsonTypeInfo(use=Id.CLASS)Pros: works with any subtype. Cons: breaks with classes or package renaming.

Second solution: Annotate the super class with:

adding a JsonSubTypes.Type for each sub-class. Pros: no problems with renaming if custom names are provided. Cons: requires to specify all the sub-classes in the super-class.

Long story

We have animals:

between them dogs:

and cats:

We try to serialize a cat:

obtaining the following JSON:

But when we try to deserialize it:

we get an exception:

Not good. Looks like Jackson is not able to understand if the JSON refers to a cat or to a dog.

We can help Jackson annotating the super-class with the JsonTypeInfo annotation. The annotation will add type information to the generated JSON.

We can tell Jackson to use the fully-qualified Java class name as type information:

a @class property will be added with the full class name:

If you like a shorter class name you can use the Id.MINIMAL_CLASS option:

a @c property will be added with a shorter class name:

With both solutions we should be worried about refactoring: if we change the classes or package names we will not be able to deserialized previously stored JSON.

As alternative we can store custom names using the Id.NAME option:

Obtaining a JSON with a new property @type with the type name:

By default Jackson uses the class name as name.

Unfortunately during the deserialization we get an exception:

Jackson is not able to map the type name to a class. To solve the problem we provide sub-class information with the JsonSubTypes annotation:

We can use custom names specifying them in the Type annotation:

Now we get a JSON with our custom names:

We can obtain the same result annotating the sub-class with a JsonTypeName annotation:

With custom names we can refactoring without problems but we will need to specify all the subtypes in the super class.

For more information please refer to official documentation: http://wiki.fasterxml.com/JacksonPolymorphicDeserialization