Puck.js is either supplied with a separate battery, or assembled with the battery inside and a clear plastic tab between the battery and PCB to keep it turned off. To turn it on, you need to:
+
side of the battery (with the writing on)
facing away from the Puck.js PCB. The red LED should flash once, very briefly.Puck.js ...
text against
the shelf in the case itselfPlease see the Puck.js reference page for some pictures of the correct orientation of the battery and Puck.js case.
While Puck.js ships with firmware that's fine for simple tasks, we're constantly improving the software and adding new features. To get the best out of it, we'd recommend that you update Puck.js's firmware first.
To turn on your Pixl.js you have three main options:
+
facing away from the PCB)Vin
and GND
pins on Pixl.jsWhile Pixl.js ships with firmware that's fine for simple tasks, we're constantly improving the software and adding new features.
To get the best out of it, we'd recommend that you update Pixl.js's firmware first.
To turn on your Jolt.js you have three main options:
While Jolt.js ships with firmware that's fine for simple tasks, we're constantly improving the software and adding new features.
To get the best out of it, we'd recommend that you update Jolt.js's firmware first.
Simply press BTN1 (the top right button) to power Bangle.js on.
If bluetooth connectivity is disabled (by default Bangle.js will be connectable):
BLE
and Programmable
are On
to enable programming permanently, and then choose Back
to exit settingsMake Connectable
, select it, and leave Bangle.js displaying on the Connectable
screenCheck out The Bangle.js 'Getting Started' page for more information.
Check out the MDBT42Q page for more information about powering the MDBT42Q.
While pre-programmed MDBT42Q modules from us ship with firmware that's fine for simple tasks, we're constantly improving the software and adding new features.
To get the best out of it, we'd recommend that you update the firmware first.
Check out Ruuvi's getting started page for more information about powering MDBT42Q.
You'll need to have your Thingy:52 flashed with Espruino and powered on. Check out the Thingy:52 page for more information.
Simply plug your nRF52832DK into a USB connector. You need to have it flashed with Espruino.
Once your device is powered up it'll start advertising itself via Bluetooth Low Energy.
Puck.js and Pixl.js will also act as NFC tags that can direct your NFC-capable phone to the relevant URLs.
For Bluetooth LE you need a Bluetooth 4.0-capable adaptor in your computer (Bluetooth versions before 4.0 won't work). Pretty much all new computers come with Bluetooth 4, but you may need to get an external Bluetooth LE dongle if your computer:
If your computer doesn't have Bluetooth LE then Bluetooth LE USB adaptors and small, cheap (~$10), and easily available. There are two main types of USB Bluetooth Adaptor available:
To be sure that you get a usable adaptor we'd recommend that you buy ONLY adaptors that explicitly mention CSR
or Broadcom
in the descriptuon. The BlueGiga BLED112 module WILL NOT WORK - it is a serial port device, not a general purpose Bluetooth adaptor.
Common USB Bluetooth adaptors that have been tested and work are:
By default, Espruino appears as a Bluetooth Low Energy device with a serial port. When you connect to this serial port you get full command-line access to the Espruino Javascript interpreter built into it.
Note: Bluetooth LE serial ports (known as 'Nordic UART') will not appear in your Operating System's list of serial devices.
To get started you have two options:
If your computer supports it, Web Bluetooth is the easiest way to get started with Espruino.
You'll need an up to date Chromium browser such as Google Chrome, Ungoogled Chromium, Edge or Opera (Brave will not work). Operating System support varies so for platform specific instructions see below:
OS X Yosemite or later required, and check that your Mac supports Bluetooth Low Energy:
About this Mac
in the top leftSystem Report
Bluetooth
under Hardware
Bluetooth Low Energy Supported
If it doesn't:
sudo nvram bluetoothHostControllerSwitchBehavior=always
(to go back to the old behaviour type sudo nvram -d bluetoothHostControllerSwitchBehavior
)If the Web Bluetooth option appears but you're unable to see any Bluetooth devices,
try: System Preferences
—> Security & Privacy
—> Bluetooth
-> Add Google Chrome
Windows 10 fully supports Web Bluetooth, as long as you have an up to date version of Google Chrome (v70 or above) and your PC has a Bluetooth LE radio (all new Laptops will).
For those not wanting to use Google Chrome, you can use another Chromium based browser such as Cromite or Ungoogled Chromium (Brave will not work)
If you do not have Windows 10, you need to install the Espruino Native IDE application instead, as this is able to access the Bluetooth adaptor directly.
Linux is not officially supported in Chrome and is not enabled by default, but it does work.
To enable it:
chrome://flags
in the address barExperimental Web Platform Features
(chrome://flags/#enable-experimental-web-platform-features
).Use the new permissions backend for Web Bluetooth
(chrome://flags/#enable-web-bluetooth-new-permissions-backend
) if it existsOther potential issues:
bluetoothd --version
. Pretty much every Linux distribution from the past 5 years is now up to date, but if yours isn't there are some Bluez installation instructions hereAll Chromebooks with Bluetooth should support Web Bluetooth.
Android 6 (Marshmallow) or later are supported out of the box. You can use a Chromium based browser such as Google Chrome or Cromite
You can also use the Bangle.js Gadgetbridge app to provide app loader functionality for your Bangle.js (but not yet Web IDE).
Android 5 (Lollipop) devices can use Chromium installed over ADB to a developer mode device.
Apple's built-in web browser does not support Web Bluetooth. Instead you'll need to install a Web Browser that does support Web Bluetooth:
Once that is done you'll be able to access Web Bluetooth through any webpage viewed with the browser app (the app won't add Web Bluetooth to Safari).
Web Bluetooth
:YourDevice ABCD
(where ABCD
is the last 4 digits of your device's MAC address)On some platforms (Windows, or Linux with older versions of Bluez
) Web
Bluetooth isn't supported yet.
On these you'll need to install a native application. We've created a Web IDE installer for Windows.
Once installed, you need to run Espruino IDE
- which is confusingly
similar to the Espruino Web IDE
which you may have had installed if you'd
used normal Espruino USB devices before.
Note:
COM
(eg. COM5
), they are not your device and connecting to them won't work.On Linux, Mac OS and other platforms you'll need to follow the NPM install instructions on the Web IDE GitHub Page
Once set up, you can try writing some code!
There are two ways of using the Raspberry Pi to control Espruino devices.
You can use the Espruino Hub software (which provides an MQTT bridge) and the Node-RED UI - see the Node RED Tutorial
Or you can use the Raspberry Pi to host a web-based version of the Web IDE.
Once set up, you can try writing some code!
In the worst case, you don't have any computers that allow you to communicate using Bluetooth Low Energy.
But all is not lost! With many devices you can connect directly using a USB-TTL converter:
You can then use the normal Espruino Web IDE, which has separate instructions for Getting Started
You can use the Espruino command-line app. It works under Node.js, so you'll need to:
npm install -g espruino
(on Linux you'll want to use sudo
before the command)sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
to give node permissions for BLE (or you'll have to run it as sudo
)espruino --help
for helpespruino --list
to list devices, then copy your device's MAC address and type espruino -p aa:bb:cc:dd:ee
to connect.Ctrl-C
twice to exit.espruino -p aa:bb:cc:dd:ee -w filename.js
to upload a file, enter terminal mode,
and then re-upload it if it changes (so you can use your favourite editor)This is the easiest solution on iOS
Connect
UART
Commands
belownRF UART
appConnect
and choose your Espruino deviceCommands
below.Note: In this app, you need to manually press the Enter
key before sending a line. If you're on iOS you need to do this by copy/pasting out of code in notepad - which is much trickier (the Adafruit app above is easier).
You can use Web Bluetooth on your own website to control Espruino BLE devices, as long as you have a compatible browser.
While you can use Web Bluetooth directly, we've provided a helpful library. Just include
<script src="https://www.puck-js.com/puck.js"></script>
in your website (served off HTTPS
)
and you can easily execute commands just by running JS code like:
Puck.write('LED1.set();\n');
We've got a proper tutorial on it here
You can make your own application to control Espruino for whatever platform you need.
For the simplest control, all you need to do is connect to the Espruino bluetooth
device and the characteristic with ID 6e400002b5a3f393e0a9e50e24dcca9e
.
You can then write repeatedly to it to send commands to Espruino.
Type in LED1.set()
and click send.
LED1.reset()
to turn it off. LED2
and LED3
work tooBTN.read()
and false
will be returned - it'll be true
if the button is pressedTry:
Please try the walkthrough to get started writing your first code for Espruino
There's lots of detailed information on specific boards, as well as a list of tutorials for them:
There is more general information:
Note: Espruino runs on many other devices, and espruino.com caters for all of them. Unless a tutorial explicitly says it is for your device it's possible that you will have to change some pin names and wiring to match the pins that you used on your device.
Out of the box, Espruino bluetooth devices don't draw that much power and can run for a while on a battery (see your board's specific reference page for more information). When they're running a small amount of JavaScript code once a minute or when a button is pressed the battery life won't be impacted significantly.
However, it's very easy to draw more power:
while(true);
) will draw around 200x more power than at idle. Executing
JavaScript on an event (eg setWatch(myCode, BTN)
or setInterval(myCode, 100000)
draws negligible extra power).As a result, if you've been experimenting with your device but don't intend to use the code
you've uploaded it's recommended that you either remove the battery, or connect
to your device and type reset()
, to ensure that no code is running in the
background that might flatten the battery.
However for normal, non-buggy code power consumption is low enough that there is no reason not to leave the device powered on.
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.