Author Archives: kolban

Wiring up ESP8266s

I have been reading about using the ESP8266s and wanted to have a play but first I needed some circuits to build.  I have two types of ESP8266 available to me:

  • ESP8266-01 – 8 pin device
  • ESP8266-12 – Breakout board


First, the circuit for the ESP8266-01.  This is the schematic I followed.  It has two buttons.  One for reset and the other to ground GPIO0.  To enter flash mode, press and hold the GPIO0 button and then press and release the reset button while still holding the GPIO0 button.


Here is what it looks like diagrammatically on a breadboard.


and finally, what it looked like in actuality.  Don’t use this photograph to assemble your circuit.



Similarly to the ESP8266-1, the ESP8266-12 has an identical circuit but isn’t breadboard mounted.

Here is the physical pin diagram for the device:



and now the schematic for the circuit:


Because it isn’t breadboard friendly, I don’t have a diagram of the breadboard layout, but here is a photograph of an assembly:


Hopefully these may assist you if you are having problems.  For follow up and Q&A, I suggest the ESP8266 Community Forum.



Building Arduino apps in Eclipse

I started studying the excellent Arduino plugin for Eclipse and now that Eclipse Mars has been released, I wanted to see if it worked.  I had a few puzzles to solve and decided to write it up in detail as a tutorial/walk-through so that others may benefit or these instructions be improved upon.

The story talks of a specific set of components:

  • Eclipse Mars
  • Arduino IDE 1.6.5
  • Windows 7

A link to the PDF describing the story can be found here.


See also:

nRF24L01, Java and a PC

This article describes the ability to send and receive data using the nRF24L01 through the Java programming language from a PC.

The notion behind the idea came from a number of projects I was working upon where I had Arduino devices sending and receiving data through the nRF24L01 but needed a second Arduino to validate that my data was being transmitted correctly.  In addition, I wanted to have my PC involved in the communications for a variety of purposes such as dashboards and as a proxy to the Internet.  As a result of this, I asked myself how that might be achieved?  The result is as shown in the following block diagram:


We have an Arduino Nano which has a USB port combined with an nRF24L01 on a circuit board.  There will be more on this later but it is literally just two components with a cost of less than $5.  We will call this the “Serial nRF24”.  It attaches to the PC through a USB cable.  To the PC, it then looks like a standard serial device with its own COM port.  Data written to the COM port arrives at the Serial nRF24 while data written by the Serial nRF24 is available to be read from the COM port.

A breadboard layout for the Serial nRF24 may be:



Note that we have chosen CE to be pin 10 and CSN to be pin 9.  The other pin selections are required.  If you decide to use other pins, ensure you update the Arduino program to reflect your selection.

Running on the Serial nRF24 is a pre-written Arduino program (sketch) that is supplied with this article.  There is nothing more to be said about this program other than you load it up one time.

Finally, we have a Java JAR file that you make available on the PC.  This JAR file contains a class called NRF24Serial which exposes APIs that can be called by your own Java apps that run on the PC.  Your Java apps have no idea how the NRF24Serial class is implemented but, between you and me, the class reads and writes to the COM port which thus reads and writes to the Serial nRF24 which in turn interacts with other nRF24s wirelessly.

The NRF24Serial java class has the following API:

NRF24Serial(String portString)

Construct an instance of the class where the Serial nRF24 is found on the specified COM port.

NRF24Serial(SerialPort port)

Construct an instance of the class using the pre-populated SerialPort object as the interface to Serial nRF24.

void startListening()

Become a receiver and start listening for incoming packets of data.

void stopListening()

Stop being a receiver and allow us to transmit outgoing packets of data.

void setTXAddr(String addr)

Specify the target address of the device to which we wish to transmit data.

void setRXAddr(String addr)

Specify our address against which other devices can transmit data to us.

void read(byte data[])

Read data received over the network and place in the data array.

void write(byte data[])

Write data over the network to the partner device.

void setRate(int rate)

Set our communication rate over the wireless network.  Values are:

  • 1 – 1 MBps
  • 2 – 2 MBps

void dump()

Dump the details of the nRF24L01 device.

void test()

Test that we have a connection to our own nRF24L01 device and that all is well.

The Serial nRF24 Protocol

As we have seen, the Java API connects to the  Serial nRF24 using USB, but what does the actual serial protocol look like?  What if we want to drive the Serial nRF24 using a library other than Java?

Here we delve into the protocol used by Serial nRF24.

The protocol is based on an “AT” set of commands.  Commands are sent as ASCII text messages and responses are received.  Unless otherwise noted, all commands return one of two messages:

  • “OK” – The command executed correctly.
  • “FAIL” – The command failed.  Following the FAIL indicator is a text string providing more details of the failure.

Command: AT

No parameters.  Tests connection to the Serial nRF24.

Command: AT+RATE


Set the over the air transmission rate.  The following values are supported:

  • 1 – Set the transmission rate to be 1 MBps
  • 2 – Set the transmission rate to be 2 MBps

Command: AT+DIR


Set the direction of the Serial nRF24.  There are two possibilities:

  • TX – Make the Serial nRF24 a transmitter of data.
  • RX – Make the Serial nRF24 a receiver of data.

Command: AT+RXADDR

AT+RXADDR=Up to 5 characters (5*8 = 40 bits)

Set the address that the Serial nRF24 will appear as to other transmitters.  This is our identity on the network.

Command: AT+TXADDR

AT+TXADDR=Up to 5 characters (5*8 = 40 bits)

Set the address that the Serial nRF24 will send data to on the next transmission.



Set the channel used for communications.

Command: AT+WRITE


Transmit data.  The length of the data is specified as a parameter.  The actual data to be transmitted is sent immediately after the command.

Command: AT+READ


Read data.  The length of the data to be read is specified as a parameter.  The actual data read is returned  immediately after the command.

Command: AT+DUMP


Dump the current state of the Serial nRF24 to the serial stream.  This is used exclusively for debugging.



Set the power amplification level.  The lower the level, the less power consumed by the device.  Values are:

  • MIN
  • LOW
  • HIGH
  • MAX



Returns “OK” if we have detected a carrier and “FAIL” otherwise.

Command: AT+BAUD


Set the baud rate that the Serial nRF24 uses to communicate over serial.  The default baud is 9600.

Included dependencies

This project makes extensive use of the following Open Source modules


The project can be downloaded from Github.

See also

Breadboard power supply woes

I have been using a breadboard power supply for a while.  Over the last couple of days I have been working with some 3.3V ICs and couldn’t figure out why they were failing on me.  Somehow I was breaking them so I checked and re-checked everything I could.

While looking at my breadboard power supply … shown below … I had a horrible realization:


This is a dual voltage converter.  From a 7V-12V input, it will produce either 5V or 3.3V.  There is a switch on it which controls which voltage is delivered.  Notice that the switch is set of 3V.

Now take a careful look at both sides of the breadboard adapter.  The right side is labeled VC/GND while the other is labeled 5V/GND.

Yup … you guessed it, even with the switch set at 3V, the right hand side connectors were at 3V as desired but the left were at 5V.  In my circuits, just by chance, I had been using the right rail most of the time and hence all had been working … but in the last couple of days I have been using the left rail … and cooking my 3.3V ICs.

Attaching a nRF24 to a breadboard


The nRF24 is a great little communications device however it is far from breadboard friendly.  It has pins which are spaced 0.1″ apart in the horizontal … but also in the vertical … as such, you can’t simply plug it into a breadboard or into strip board for construction.



One solution to this problem is to buy female headers which have exceptionally long legs which are designed for stack-ability.  Items like this can be bought from eBay (example supplier) for about $4 for 10 (40 cents each).



These can then be cut to be the correct length which, for our purposes is 4 pins wide and then the pins can be bent twice to produce new right angles.



The nRF24 (or other device with similar pins) can then be plugged into the header and the pins from the header will now fit perfectly into your breadboard or strip board.



Here we see a nRF24 happily placed on a board.



An additional suggestions is to place a drip of cyanoacrylate between the touching headers to bond them forever but that is not a requirement for success.

Of course, this technique should work for any module/device which has a similar pin-out such as the ESP8266-1.

See also:

Environment Customization

When working in my computing environment, I like to change the environment to suit my needs.  This is a record of some of the changes I make and why.

Acrobat Reader

I use Adobe Acrobat Reader to read many PDFs.  On my large monitors, I find the brilliant white background of the page to be distracting so I change the color to be a darker grey.  We can do this from:

Edit > Preferences > Accessibility -> Page Background

Angular and require.js

The combination of Angular, jquery and require.js are extremely powerful. Here is an example
template illustrating them all used together.

<!DOCTYPE html>
<meta charset="ISO-8859-1">
<title>Template page<    itle>

<!-- Include jQuery and jQuery UI -->
<link href="" rel="stylesheet" type="text/css" />
<!-- End of jQuery -->

<!-- AMD -->
<script src=""></script>
<!-- End of AMD -->

        baseUrl : "src",
        paths : {
            "jquery" : "",
            "jquery-ui" : "",
            "angular" : ""
        shim : {
            "jquery-ui" : {
                deps : [ "jquery" ],
                exports : 'jQueryUI'
            "angular" : {
                exports : "angular"
    // End of shims
    require([ "jquery", "angular", "jquery-ui" ], function($, angular) {
        var module = angular.module("myApp", []);
        // more here
        angular.bootstrap(document, ["myApp"]);
    }); // End of require
<!-- End AMD -->
    <h1>Test Page</h1>

Eclipse …

Eclipse is a powerful open source IDE for building Java, Web and other types of application.  It hinges on the notion of “plugins” that allow it to be extended.

There are thousands of plugins available but in a virgin install of Eclipse, the following are the ones that I personally find necessary:

  • Path Tools – Working with the paths and files of the underlying file system.
  • Log Viewer – Tail tool within Eclipse
  • Eclipse Web Developer Tools – HTML and JavaScript editors.
  • JavaScript Development Tools – JavaScript tools.
  • MyLyn Wiki Text – Markdown editor.

In a virgin environment, the following are my preferences for settings:

  • General > Web Browser → Use external web browser – Define which web browser to use
  • General > Workspace → Workspace name – The name of the workspace as shown in the task bar.
  • General > Appearance > Colors and Fonts > JavaScript > JavaScript Editor Text Font → Font Size: 11

When working with angular and custom HTML tags:

  • Web > HTML Files > Validation -> Elements → Unknown tag name = Ignore
  • Web > HTML Files > Validation -> Attributes  → Undefined attribute name = Ignore

Using JSDoc


JSDoc is a documentation mechanism for JavaScript.

Use with Eclipse

When editing JavaScript with an Eclipse editor, we see an Outline view on the right of the editor.  This utilizes JSDoc tags to identify the names of the exposed functions as well as whether or not they are public or private.

Documenting with markdown

By default,  JSDoc uses HTML as the documentation language however we can switch this to use Markdown.


Primary References

See also: