Pixl.js

Pixl.js

Buy Now

From £30

Or £21.60 in volume

Espruino Shop
🌎 Distributors

Pixl.js is a smart LCD with Bluetooth LE.

Monitor and control other Bluetooth LE devices, act as a wireless display, create your own smart conference badge, or even just display the status of your code - all while drawing tiny amounts of power.

Pixl.js's unique design allows you to use the Arduino footprint to interface with the huge array of existing Arduino shields, while still using the LCD and buttons. Add Ethernet, WiFi, Motor drivers, even GSM. No soldering required!

Just got your Pixl.js? Take a look here!

Contents

Features

Powering Pixl.js

Pixl.js can be powered in multiple ways:

Vin pins

As mentioned above you can solder a JST connector (part number B2B-PH-K-S to Pixl.js):

JST pins on Pixl.js

Note: This connects stright to the Vin pins, so you should use USB or CR2032 or the JST connector, but not more than one at the same time!

Power Consumption

All power figures below are with the LCD on:

This means that when running off a CR2032 battery you could expect around 20 days of battery life with light JavaScript usage, LCD on, and no backlight. Life can be significantly improved by turning the LCD off when it is not needed.

Pixl.js sends advertising data without ever executing JavaScript. To get the best power consumption, make sure your code executes as rarely as possible.

Resetting Pixl.js

Occasionally you may want to hard-reset Pixl.js. To do this:

For short (1 second) periods of time you can also just short out the 3v power rail. Do to this take something metallic and touch it between the top of the CR2032 Battery/holder and the USB socket's metal outer.

Resetting Pixl.js this way will not clear out any saved code - see Hard Reset below.

Hard Reset

To clear out all saved code, reset Pixl.js while keeping BTN1 held for around 10 seconds (even while Pixl.js says SELF TEST Release BTN1).

Once Pixl.js displays Removed saved code from Flash you can release it - this will clear out any previously saved code and bonding data that could have caused problems.

Note: If you release BTN1 when instructed by the text Release BTN1 then a self-test will be performed. Saved code will not be loaded from flash, but will not be erased from flash either - a subsequent reset will start Espruino up loading the saved code as normal.

Tutorials

First, it's best to check out the Getting Started Guide

There is more information below about using the LCD and onboard peripherals as well.

Tutorials using Pixl.js:

Tutorials using Bluetooth LE:

Tutorials using Bluetooth LE and functionality that may not be part of Pixl.js:

There are many more tutorials that may not be specifically for you device but will probably work with some tweaking. Try searching to find what you want.

Pinout

Hover the mouse over a pin function for more information. Clicking in a function will tell you how to use it in Espruino.

D0 3.3v !
D1 3.3v !
D2 3.3v
D3 3.3v ADC
D4 3.3v ADC
D5 3.3v
D6 3.3v
D7 3.3v
D8 3.3v
D9 3.3v
D10 3.3v
D11 3.3v
D12 3.3v
D13 3.3v
GND
A4 3.3v ! ADC
A5 3.3v ! ADC
A5 3.3v ! ADC
A4 3.3v ! ADC
A3 3.3v ADC
A2 3.3v ADC
A1 3.3v ADC
A0 3.3v ADC
Vin
GND
GND
5V !
3.3V
RST
3.3V
GND
Vin
3.3V
SWIO
SWCK
GND

Pins not on connectors

H0 3.3v LCD
H1 3.3v BTN1
H2 3.3v BTN2
H3 3.3v BTN3
H4 3.3v BTN4
H5 3.3v LCD
H6 3.3v LCD
H7 3.3v LCD
H8 3.3v ! LCD
H9 3.3v ! LCD

Pins on the Arduino header are accessed via the built-in variables D0..D13 and A0..A5.

Note: Pixl.js has one available I2C, SPI and USART (and infinite software SPI and I2C). Unlike other Espruino boards, these peripherals can be used on any pin.

Arduino Shields

Pixl.js is a 3.3v device, and is only designed for 3.3v shields.

Shield power

If you find that your shield isn't powered, it may be because the 5v pin on the Arduino shield isn't connected. There is a solder jumper near the LCD connector labelled 3.3 5V Vin, and you can apply solder to:

Do not short all 3 pins of the solder jumper together! This will connect 3.3v to Vin, which will power your Pixl's processor (and the LCD) directly from Vin, which is likely to be a high enough voltage that it will permanently damage it.

Shields

Here are some of the Arduino shields that we have tested and documented:

Information

Pixl.js

LCD Screen

NOTE: When you get it, your Pixl has a protective film over the front of the LCD. It may appear scuffed of scratched, but can easily be peeled off from one corner.

Pixl.js displays the REPL (JavaScript console) by default, so any calls like print("Hello") or console.log("World") will output to the LCD when there is no computer connected via Bluetooth or Serial. Any errors generated when there is no connection will also be displayed on the LCD.

Graphics

You can output graphics on Pixl.js's display via the global variable g that is an instance of the Graphics class. The display is double-buffered, so when you want the changes you made to be displayed you need to call g.flip():

// Draw a pattern with lines
g.clear();
for (i=0;i<64;i+=7.9) g.drawLine(0,i,i,63);
g.drawString("Hello World",30,30);
// Update the display when done
g.flip();

Screen updates

g.flip() only updates the area of the screen that has been modified by Graphics commands. If you're modifying the underlying buffer (g.buffer) then use g.flip(true) to update the entire screen contents.

Pixl.js comes with a built-in menu library that can be accessed with the Pixl.menu() command.

// Two variables to update
var boolean = false;
var number = 50;
// First menu
var mainmenu = {
  "" : {
    "title" : "-- Main Menu --"
  },
  "Backlight On" : function() { LED1.set(); },
  "Backlight Off" : function() { LED1.reset(); },
  "Submenu" : function() { Pixl.menu(submenu); },
  "A Boolean" : {
    value : boolean,
    format : v => v?"On":"Off",
    onchange : v => { boolean=v; }
  },
  "A Number" : {
    value : number,
    min:0,max:100,step:10,
    onchange : v => { number=v; }
  },
  "Exit" : function() { Pixl.menu(); },
};
// Submenu
var submenu = {
  "" : {
    "title" : "-- SubMenu --"
  },
  "One" : undefined, // do nothing
  "Two" : undefined, // do nothing
  "< Back" : function() { Pixl.menu(mainmenu); },
};
// Actually display the menu
Pixl.menu(mainmenu);

See http://www.espruino.com/graphical_menu for more detailed information.

Contrast

You can change the LCD screen's contrast with Pixl.setContrast(0.5) with a number between 0 and 1.

You can also write single byte commands to the ST7567 LCD controller using the Pixl.lcdw(...) command if you want to experiment with different LCD modes.

Terminal

Pixl.js's LCD acts as a VT100 Terminal. To write text to the LCD regardless of connection state you can use Terminal.println("your text"). Scrolling and simple VT100 control characters will be honoured.

You can even move the JavaScript console (REPL) to the LCD while connected via Bluetooth, and use your bluetooth connection as a simple keyboard using the following commands:

Bluetooth.on("data",d=>Terminal.inject(d));
Terminal.setConsole();

Power Usage

When on, the LCD draws around 200uA (0.2mA). You can turn the LCD off to save power with Pixl.setLCDPower(true/false) if you need to. When resuming, the LCD will be refreshed to display what was previously on the screen.

Splash Screen

When it first boots, Pixl.js animates the Pixl.js logo onto the screen. Subsequent calls to reset() display it but skip the animation. If you'd like your own splash screen, on Espruino firmware 2v05 and later you can write a 1bpp image string made using the Image Converter to the Storage file .storage, for example to display a Q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gBh54YHmAAAAAAAAAAAAAZ+Z+Z//+YAAAAAAAAAAAAGfmfmf//mAAAAAAAAAAAABn5ngAHmfgAAAAAAAAAAAAZ+Z4AB5n4AAAAAAAAAAAAGfmeeH5hmAAAAAAAAAAAABn5nnh+YZgAAAAAAAAAAAAYAZ/h//4YAAAAAAAAAAAAGAGf4f/+GAAAAAAAAAAAAB//mGAH//gAAAAAAAAAAAAf/5hgB//4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==")))

Or to skip the splash screen completely, you can just write a zero-length file:

require("Storage").write(".splash","");

On-board LED, Buttons and GPIO

LED

The only LED available on Pixl.js is the backlight, which is controllable via the LED or LED1 variable.

Buttons

There are 4 buttons on Pixl.js. Starting in the top left, going clockwise, they are BTN1, BTN2, BTN3 and BTN4.

setWatch(function() {
  console.log("Pressed");
}, BTN, {edge:"rising", debounce:50, repeat:true});

GPIO pins

GPIO pins are numbered D0 to D13 and A0 to A5 (matching the Arduino header). They are marked on the PCB (for D0 to D13, the D is omitted).

You can use the same digitalWrite/digitalRead commands with these that you did with the LEDs and buttons, but you can also use PWM, I2C, SPI and Analog.

NFC - Near Field Communications

To set Puck.js up to redirect to a new NFC URL, just use NRF.nfcURL(...):

NRF.nfcURL("http://espruino.com");

or to turn off, call it with no arguments:

NRF.nfcURL();

Other NFC functionality is available - check out the reference for NRF.nfc* methods and events, and see the Web NFC page for information on transferring data via NFC.

Known Problems

On the 2v01 firmware release (which the first Pixl.js shiped with), NFC doesn't work.

If you upgrade, 2v02 firmware and later have this fixed.

Serial Console

When power is first applied, Pixl.js checks if pin D0 is at 3.3v (which will be the case if it is connected to a Serial port's transmit line). If it is, it initialises the on-chip UART on D0 (Pixl.js RX) and D1 (Pixl.js TX) and puts the Espruino console (REPL) on it at 9600 baud.

To use it, connect to a 3.3v output USB to TTL converter as follows:

Pixl.js USB->TTL converter
GND GND
D1 RX ( -> PC )
D0 TX ( <- PC )
Vin 5v (Optional - to run without a battery)

You can now use the normal Espruino Web IDE, or a serial terminal application at 9600 baud.

When you connect via Bluetooth, the console will automatically move over. To stop this, execute Serial1.setConsole(true) to force the console to stay on Serial1.

Note: Serial1 is not enabled by default because it requires the high speed oscillator to stay on, which increases power draw a huge amount. If you connect the UART but don't power down and power on Pixl.js, you won't get a serial port.

Firmware Updates

Please see the Firmware Update page for detailed instructions.

Troubleshooting

For more answers please check out the Bluetooth Troubleshooting or General Troubleshooting pages.

My Pixl's screen was scratched when I got it!

The Pixl comes with a protective film over the LCD. The film itself is very soft which means it picks up scratches during manufacture and packing, however it is easy to peel off from one corner and will reveal a shiny new LCD.

Other Official Espruino Boards

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.