Loading files
<!DOCTYPE html>
<html lang="en" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="generator" content="Hugo 0.30.2" />
<meta name="description" content="All about the NodeConf EU 2017 Badge">
<meta name="author" content="nearForm">
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link rel="icon" href="/images/favicon.png" type="image/x-icon" />
<title>Accessing Hardware Features :: NodeConf EU Badge</title>
<link href="/css/nucleus.css?1509547569" rel="stylesheet">
<link href="/css/font-awesome.min.css?1509547569" rel="stylesheet">
<link href="/css/hybrid.css?1509547569" rel="stylesheet">
<link href="/css/featherlight.min.css?1509547569" rel="stylesheet">
<link href="/css/perfect-scrollbar.min.css?1509547569" rel="stylesheet">
<link href="/css/auto-complete.css?1509547569" rel="stylesheet">
<link href="/css/theme.css?1509547569" rel="stylesheet">
<link href="/css/hugo-theme.css?1509547569" rel="stylesheet">
<script src="/js/jquery-2.x.min.js?1509547569"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
</style>
</head>
<body class="" data-url="/getting-started/basic-hardware-features/">
<nav id="sidebar" class="">
<div id="header-wrapper">
<div id="header">
<a href="/"><img src="/images/logo.png" /></a>
</div>
<div class="searchbox">
<label for="search-by"><i class="fa fa-search"></i></label>
<input data-search-input id="search-by" type="text" placeholder="Search...">
<span data-search-clear=""><i class="fa fa-close"></i></span>
</div>
<script type="text/javascript" src="/js/lunr.min.js?1509547569"></script>
<script type="text/javascript" src="/js/auto-complete.js?1509547569"></script>
<script type="text/javascript">
var baseurl = "http:\/\/nodeconfeubadge.org";
</script>
<script type="text/javascript" src="/js/search.js?1509547569"></script>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/getting-started/" title="Getting Started" class="dd-item
parent
">
<a href="/getting-started/">
Getting Started
</a>
<ul>
<li data-nav-id="/getting-started/unlocking-your-badge/" title="Unlocking Your Badge" class="dd-item ">
<a href="/getting-started/unlocking-your-badge/">
Unlocking Your Badge
</a>
</li>
<li data-nav-id="/getting-started/built-in-software/" title="Built-in Software" class="dd-item ">
<a href="/getting-started/built-in-software/">
Built-in Software
</a>
</li>
<li data-nav-id="/getting-started/connecting-to-the-badge/" title="Connecting to the Badge" class="dd-item ">
<a href="/getting-started/connecting-to-the-badge/">
Connecting to the Badge
</a>
</li>
<li data-nav-id="/getting-started/hello-world-console/" title="Hello World on the Console" class="dd-item ">
<a href="/getting-started/hello-world-console/">
Hello World on the Console
</a>
</li>
<li data-nav-id="/getting-started/other-code-samples/" title="Other Code Samples" class="dd-item ">
<a href="/getting-started/other-code-samples/">
Other Code Samples
</a>
</li>
<li data-nav-id="/getting-started/basic-hardware-features/" title="Accessing Hardware Features" class="dd-item active">
<a href="/getting-started/basic-hardware-features/">
Accessing Hardware Features
</a>
</li>
<li data-nav-id="/getting-started/using-prototyping-area/" title="Using the prototyping area" class="dd-item ">
<a href="/getting-started/using-prototyping-area/">
Using the prototyping area
</a>
</li>
</ul>
</li>
<li data-nav-id="/challenges/" title="Challenges" class="dd-item
">
<a href="/challenges/">
Challenges
</a>
<ul>
<li data-nav-id="/challenges/hello-world-screen/" title="Hello World on screen" class="dd-item ">
<a href="/challenges/hello-world-screen/">
Hello World on screen
</a>
</li>
<li data-nav-id="/challenges/detect-button-press/" title="Detect Button Press" class="dd-item ">
<a href="/challenges/detect-button-press/">
Detect Button Press
</a>
</li>
<li data-nav-id="/challenges/detect-capacitive-touch/" title="Detect Capacitive Touch" class="dd-item ">
<a href="/challenges/detect-capacitive-touch/">
Detect Capacitive Touch
</a>
</li>
<li data-nav-id="/challenges/flash-leds/" title="Flash LEDs" class="dd-item ">
<a href="/challenges/flash-leds/">
Flash LEDs
</a>
</li>
<li data-nav-id="/challenges/play-music-with-buzzer/" title="Play Music with Buzzer" class="dd-item ">
<a href="/challenges/play-music-with-buzzer/">
Play Music with Buzzer
</a>
</li>
<li data-nav-id="/challenges/on-screen-menu/" title="On-Screen Menu" class="dd-item ">
<a href="/challenges/on-screen-menu/">
On-Screen Menu
</a>
</li>
<li data-nav-id="/challenges/broadcast-nfc-url/" title="Broadcast NFC URL" class="dd-item ">
<a href="/challenges/broadcast-nfc-url/">
Broadcast NFC URL
</a>
</li>
<li data-nav-id="/challenges/broadcast-beacons/" title="Broadcast Beacons" class="dd-item ">
<a href="/challenges/broadcast-beacons/">
Broadcast Beacons
</a>
</li>
<li data-nav-id="/challenges/use-noble-on-laptop/" title="Use Noble on Laptop" class="dd-item ">
<a href="/challenges/use-noble-on-laptop/">
Use Noble on Laptop
</a>
</li>
<li data-nav-id="/challenges/use-badge-for-hid/" title="Use Badge for HID" class="dd-item ">
<a href="/challenges/use-badge-for-hid/">
Use Badge for HID
</a>
</li>
<li data-nav-id="/challenges/connect-to-ble-lightbulb/" title="Connect to BLE Lightbulb" class="dd-item ">
<a href="/challenges/connect-to-ble-lightbulb/">
Connect to BLE Lightbulb
</a>
</li>
<li data-nav-id="/challenges/connect-to-ble-led-strip/" title="Connect to BLE LED Strip" class="dd-item ">
<a href="/challenges/connect-to-ble-led-strip/">
Connect to BLE LED Strip
</a>
</li>
<li data-nav-id="/challenges/communicate-with-another-badge/" title="Communicate with another Badge" class="dd-item ">
<a href="/challenges/communicate-with-another-badge/">
Communicate with another Badge
</a>
</li>
<li data-nav-id="/challenges/record-and-playback-sound/" title="Record and Playback Sound" class="dd-item ">
<a href="/challenges/record-and-playback-sound/">
Record and Playback Sound
</a>
</li>
<li data-nav-id="/challenges/display-an-image/" title="Display an Image" class="dd-item ">
<a href="/challenges/display-an-image/">
Display an Image
</a>
</li>
<li data-nav-id="/challenges/create-web-bluetooth-page/" title="Create a Web Bluetooth Page" class="dd-item ">
<a href="/challenges/create-web-bluetooth-page/">
Create a Web Bluetooth Page
</a>
</li>
<li data-nav-id="/challenges/detect-person-with-pir-sensor/" title="Detect a Person with a PIR Sensor" class="dd-item ">
<a href="/challenges/detect-person-with-pir-sensor/">
Detect a Person with a PIR Sensor
</a>
</li>
<li data-nav-id="/challenges/communicate-with-other-ble-device/" title="Communicate with another Device" class="dd-item ">
<a href="/challenges/communicate-with-other-ble-device/">
Communicate with another Device
</a>
</li>
<li data-nav-id="/challenges/implement-dat-protocol/" title="Implement Dat Protocol" class="dd-item ">
<a href="/challenges/implement-dat-protocol/">
Implement Dat Protocol
</a>
</li>
</ul>
</li>
</ul>
<section id="footer">
<p>Built with <a href="https://github.com/matcornic/hugo-theme-learn"><i class="fa fa-heart"></i></a> from <a href="http://getgrav.org">Grav</a> and <a href="http://gohugo.io/">Hugo</a></p>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable sticky-parent">
<div class="sticky-spacer">
<div id="top-bar">
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fa fa-bars"></i>
</a>
</span>
<span id="toc-menu"><i class="fa fa-list-alt"></i></span>
<span class="links">
<a href='/'></a> > <a href='/getting-started/'>Getting Started</a> > Accessing Hardware Features
</span>
</div>
<div class="progress">
<div class="wrapper">
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li>
<ul>
<li><a href="#cpu-pins-vertical-line-of-holes-along-left-hand-edge-of-badge">CPU Pins (Vertical line of holes along left hand edge of badge)</a></li>
<li><a href="#buttons">Buttons</a></li>
<li><a href="#leds">LEDs</a></li>
<li><a href="#graphics">Graphics</a></li>
<li><a href="#capacitive-sense">Capacitive Sense</a></li>
<li><a href="#battery-percentage">Battery Percentage</a></li>
<li><a href="#set-screen-contrast">Set Screen Contrast</a></li>
<li><a href="#nfc">NFC</a></li>
</ul></li>
<li><a href="#advanced-flashing-updated-firmware">Advanced: Flashing updated firmware</a></li>
</ul></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="body-inner">
<h1>Accessing Hardware Features</h1>
<p>This is an Open Source Hardware project. Schematics and board design files are available in the <a href="https://github.com/nearform/nceubadge/tree/master/hardware">/hardware directory of the repo</a>.</p>
<p>The badge uses the same core module as the <a href="https://www.espruino.com/Puck.js">Puck.js</a> and can run most of the same software.</p>
<p>Hardware Features include:</p>
<ul>
<li>nRF52832 SoC - 64MHz ARM Cortex M4, 64kB RAM, 512kB Flash, running the Espruino stack</li>
<li>Bluetooth Low Energy</li>
<li>Powered by a CR2032 battery which can last up to a week depending on what code you are running</li>
<li>Daylight-readable LCD screen</li>
<li>6 input buttons</li>
<li>Capacitive touch sensors on all 6 corners</li>
<li>Prototyping area with 8 CPU pins accessible</li>
<li>Holes for LEDs on all 6 corners</li>
<li>NFC antenna</li>
<li>SWD programming pins</li>
</ul>
<h3 id="cpu-pins-vertical-line-of-holes-along-left-hand-edge-of-badge">CPU Pins (Vertical line of holes along left hand edge of badge)</h3>
<p>You write to or read from a pin with:</p>
<pre><code class="language-javascript">digitalWrite(pin, value);
digitalRead(pin);
</code></pre>
<p>where pin is one of D0, D1, D2, D3, D4, D5, D6, D7, D8 (D0 at top) and value is 0 or 1.</p>
<p>The firmware has some extra API calls and variables for some of the badge features. You can use them as follows:</p>
<h3 id="buttons">Buttons</h3>
<p>You can use</p>
<pre><code class="language-javascript">digitalWrite(button, value);
digitalRead(button);
</code></pre>
<p>where value is 1 or 0 and button is one of BTNA, BTNB, BTNU, BTND, BTNL, BTNR</p>
<h3 id="leds">LEDs</h3>
<p>If you add LEDs to the corner holes, you can turn them on/off with</p>
<pre><code class="language-javascript">digitalWrite(led);
</code></pre>
<p>where led is one of LED1, LED2, LED3, LED4, LED5, LED6.</p>
<h3 id="graphics">Graphics</h3>
<p>In many Espruino examples on the main site, you’ll find setup code for different types of screens. That has already been taken care of for you on the badge and you can just access the graphics functions directly. e.g.</p>
<pre><code class="language-javascript">g.clear();
g.drawString("Hello World",0,0);
g.flip();
</code></pre>
<h3 id="capacitive-sense">Capacitive Sense</h3>
<p>You can read the capacitance (and hence touch) from the 6 corners using</p>
<pre><code class="language-javascript">Badge.capSense(corner);
</code></pre>
<p>where corner is one of CORNER1, CORNER2, CORNER3, CORNER4, CORNER5, CORNER6.</p>
<h3 id="battery-percentage">Battery Percentage</h3>
<p>You can get an estimate of the battery level by calling</p>
<pre><code class="language-javascript">Badge.getBatteryPercentage();
</code></pre>
<p>It returns an approximate battery percentage remaining based on a normal CR2032 battery (2.8 - 2.2v).</p>
<h3 id="set-screen-contrast">Set Screen Contrast</h3>
<p>You can set the screen contrast with</p>
<pre><code class="language-javascript">Badge.setContrast(c)
</code></pre>
<p>where c is a float from 0 to 1</p>
<h3 id="nfc">NFC</h3>
<p>You can set the URL that the NFC antenna broadcasts to NFC-capable phones by calling</p>
<pre><code class="language-javascript">NRF.nfcURL("url")
</code></pre>
<p>where URL is something like <a href="https://www.nearform.com">https://www.nearform.com</a></p>
<p><em>NOTE: If your phone is having difficulty picking up the NFC URL, it is likely that the tuning capacitors on your badge need to be changed to different values. Head on over to the Hacking Lounge to get them replaced or be shown how to do it yourself.</em></p>
<h2 id="advanced-flashing-updated-firmware">Advanced: Flashing updated firmware</h2>
<p>If you need to flash new firmware to the badge, you must first put it in DFU mode by holding BTNA as you insert the battery and quickly letting go of BTNA. Download the Distribution Packet Zip file containing the new firmware to your phobe and use nRF Toolbox on either <a href="https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrftoolbox&hl=en">Android</a> or <a href="https://itunes.apple.com/us/app/nrf-toolbox/id820906058?mt=8">iOS</a> to send it to the badge.</p>
<footer class=" footline" >
</footer>
</div>
</div>
<div id="navigation">
<a class="nav nav-prev" href="/getting-started/other-code-samples/" title="Other Code Samples"> <i class="fa fa-chevron-left"></i></a>
<a class="nav nav-next" href="/getting-started/using-prototyping-area/" title="Using the prototyping area" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="/js/clipboard.min.js?1509547569"></script>
<script src="/js/perfect-scrollbar.min.js?1509547569"></script>
<script src="/js/perfect-scrollbar.jquery.min.js?1509547569"></script>
<script src="/js/jquery.sticky-kit.min.js?1509547569"></script>
<script src="/js/featherlight.min.js?1509547569"></script>
<script src="/js/html5shiv-printshiv.min.js?1509547569"></script>
<script src="/js/highlight.pack.js?1509547569"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/js/modernizr.custom.71422.js?1509547569"></script>
<script src="/js/learn.js?1509547569"></script>
<script src="/js/hugo-learn.js?1509547569"></script>
<link href="/mermaid/mermaid.css?1509547569" type="text/css" rel="stylesheet" />
<script src="/mermaid/mermaid.js?1509547569"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
</body>
</html>
1b73fd9c3This file is pinned to the selected release. Download the original to open it in your design tool.