Friday, January 30, 2015

Product review of CT-UNO by Cytron

I received my CT-UNO, an UNO board made by Cytron and I'm doing a short review on this board.


The first question is, why another UNO board ?  The answer would be answered in my short review below.

This CT-UNO was used as part of the starter kit during my Penang Mini Maker Faire Arduino workshop in November.

The main factor I really like about this is the Micro-USB port instead of the gigantic USB B plug used by regular Arduino UNO boards. With so many USB micro cables all around, having a USB micro is a good decision made by Cytron.

Secondly, I always like the FTDI USB Serial chip. I'm still using the FTDI Breakout board on a regular basis to program the Arduino Mini Pro ...


On the subject of FTDI board, there is an Android app called FTDI UART Terminal that can accept a FTDI USB-Serial device so that you can plug in the CT-UNO directly to the Android Smatphone and view the Serial Monitor using this app with an USB OTG cable.

CT-UNO with FTDI connected to Android Smarthphone

As per most of the newer UNO board, this is a SMD version of the atmega328P, so you cannot remove the IC.


Another thing I really like about this board is that you can directly solder wires to the pins below the board for permanent connections. Here are some pictures of the CT-UNO on the sides and below the board.

Sides holes

Sie holes
CT-UNO back
Last but not least, this board is "Made in Malaysia", so please support Malaysian made products.
The only thing I didn't like about this board is the white colour of the PCB silkscreen but this is my personal opinion.

Overall, it is a very usable UNO board and very good to view Serial Monitor on Android Smartphone that support USB OTG cable.

It cost RM56 on Cytron online store and RM62 on retail stores.

A special thanks to Vincent Kok for sending me this CT-UNO for review.

Summary Links :-

Thursday, August 14, 2014

Arduino UNO nRF Adapter

nRF24L01 adapters

This blog entry is about my process in making an Arduino UNO nRF24L01 Adapter from start to the current version... ( If you would like to order a pair of the nRF Adapter, please click on nRF Adapter for Sale. )

Do you face the problems of messy jumpers cables like below when using nRF24L01+ with an Arduino UNO on a breadboard ??

nRF24L01 on breadboard
Or need to DIY your own adapter to sit in between the breadboard groove like the picture below ?

DIY nRF for breadboard

nRf24L01 on Arduino UNO

nRF24L01 with external antenna

With this problem, I started my journey to solve this problem with a nRF Adapter... below are pictures of the evolution of the adapter.

Perfboard first version

The orange and white wires fly across the UNO for the 3.3V power needed by the nRF24L01 radio.
nRF adpater with bottom wiring

nRF adapter with top wiring

PCB Version with 3.3V LDO ( PCB designed by ZXLee )

nRF20L01 adapter DIY PCB 1

nRF24L01 adapter DIY PCB 1

nRF24L01 adapter DIY PCB 1

PCB Version 2 with 2 buttons ( PCB designed by Vintronics )

nRF24L01 adapter DIY PCB 2 bottom

nRF24L01 adapter DIY PCB 2 top

We took the above design, dropped the 2 buttons , fine tuned it and made the final version for factory PCB. This is a joint collaboration project between Arduino for Beginners blog and Vintronics ..

Final factory made PCB version ( designed by Vintronics & myself )

This version have a AMS1117-3.3 at the bottom of the PCB.
nRF24L01 adapter PCB front

nRF24L01 adapter PCB back

Final version with headers soldered on PCB

nRF24L01 adapter PCB front

nRF24L01 adapter PCB back

nRF24L01 Adapter with radio

nRF24L01 adapter with radio

nRF24L01 adapter PCB with radio

nRF Adapter on Arduino UNO

The nRF adapter uses pin 8 for CE, pin 9 for CSN and pin 10 for Vcc (5V to 3.3V with the AMS1117-3.3V VR )

nRF Adapter on Arduino UNO

nRF Adapter on Arduino UNO
All the nRF adapters together ..

All nRF24L01 adapters

If you would like to order a pair of the nRF Adapter, please click on nRF Adapter for Sale.

Summary Links :-

- My RF24 repo fork with support of the nRF Adapter :
- Test your nRF24L01 transfer speed
- More info on nRF24L01

Monday, May 12, 2014

TinySafeBoot on attiny84

The TinySafeBoot, this is a small bootloader that will take up 550 bytes so you are left with around 7450 bytes of sketch left. Let me explain a bit of details and instructions as the TinySafeBoot site were not catering to Arduino users in terms of step by steps instructions for beginners.

The reason to install this TinySafeBoot is pretty obvious, you can directly program the attiny84 similar like Arduino UNO using on Serial Tx/Rx pins instead of using the UsbTinyISP. I am connecting a FTDI USB Serial module for both programming and debugging functions using <TinyDebugSerial.h>.

Attiny84 with FTDI

The above image is my prototype attiny84 with FTDI module Serial Debug / Monitor to pin PB0(tx) and PB1(rx).

The steps are as follows :-

1. Download TinySafeBoot from

2. Generate the bootloader hex for attiny84 :-

tsb tn84 b1b0  ( b1 = pin PB1/rx b0 = pin PB0/tx )

3. Burn the above generated hex bootloader to the attiny84

avrdude -c usbtiny -p t84 -U flash:w:<tsb_tn84_b1b0_20140414.hex>

4. Set the fuse bits on attiny :

avrdude -c usbtiny -p t84 -U efuse:w:0xFE:m ( Turn on SELFPRGEN bits )

5. To get the status of the bootloader, RESET the attiny84, wait for 2-3 secs and execute the commands :-

tsb COM5 i  ( get current status from the bootloader )


6. To burn a hex to the attiny84, RESET the attiny84, wait for 2-3 secs and execute the commands :-

tsb COM5 fw blink84.hex

( You can compile the hex under Arduino UNO by choosing the board attiny84 @ 8Mhz and copy the hex files to the tsb folder. To see where the hex is compiled and located, Under Arduino IDE Preferences, Click on "Show verbose output during [x] compilation" )

Final product on Tiny nRF V1.0

Tiny nRF V1.0

Summary Links :-

- TinySafeBoot
- Attiny84 Fuse calculator
- Arduino Tiny codes
- Arduino Forum on attiny84/85

Sunday, November 24, 2013

Stellaris Launchpad with nRF24L01+ communicating with Arduino UNO

Firstly I would like to thanks Premier Farnell (Element14) for sending me a sample Texas Instruments's Stellaris Launchpad. This development board platform from Texas Instruments is running on ARM Cortex-M4F based microcontrollers. The diagram below is directly taken from the datasheet showing all the pins, functions and other connectors.

Stellaris Launchpad
As I have lots and lots of female-female jumper cables, I kinda like the male headers on the Stellaris Launchpad. As this is not a review on the Stellaris Launchpad, I shall skip most of the features of the board and jump straight into the software needed to run this board.


Similar to Arduino, Stellaris have Energia, an open source multiple platform software development environment. You can refer to Stellaris LaunchPad Guide for all the pins and functions.

After installing the Energia development environment, it looks very similar like Arduino except it is red in colour like the Stellaris board.

So the first thing to do is to blink those three built-in RGB LED on the board itself and it looks very nice and useful to have RGB LED on the board itself. The second project that came into my mind is to get the Nordic nRF24L01+ radios working with this launchpad.

With some googling, I found the spirilis had written an Energia nRF24L01 library on the MSP430 ( forum. There is also a github repo from spirilis that I downloaded and install the Enrf24 library similar to installing Arduino libraries. This is great, no steep learning curve.

nRF24L01 Stellaris Launchpad

While loading the Enrf24 Tx example, I notice it was written for MSP430 launchad pins instead of Stellaris launchpad pins, so the pin name needed to be changed to matched the Stellaris pin names.

The changes made as follows :-

// PE_1 = CE, PE_2 = CSN, PE_3 = IRQ
// SPI pins : SCK = PB_4 , MOSI = PB_7, MISO = PB_6
Enrf24 radio(PE_1, PE_2, PE_3); 

Refer to the StellaPad

Just blindly hook up the nRF24L01 to the Stellaris Launchpad according to the pinout above and you are all set.

While hooking up the 3.3V power to the nRF24L01+ radio ( that requires 3.3V ) I accidentally hook up the jumper cables to the VBUS pins as they are just next to each other. The VBUS is the USB power measured at 4.4V on my multimeter and the left pins besides it is the actual regulated 3.3V power pins. Luckily, the higher voltage did not blew up the nRF radio.

After this minor incident, I got the nRF24L01 working and transmitting a ON/OFF payload to whichever devices that is listening on those configured address.

As I have experience is getting different nRF libraries working with each other, the few possible places to look are the addressing schemes ( either 3 or 5 bytes ), CRC is either off / on (8bit/16bit), does it implement dynamic or static payload and matching all the speed and channels.

After much tweaking on the Arduino UNO side, I still could not get Arduino UNO side to receive the payload so I did what everyone else would do, read the codes and ask the author of this library.

Within less than a few hours, the author spirilis replied me and after changing the CRC settings, the Arduino UNO running the RF24 library is talking to the Stellaris Launchpad. The Tx demo is working and I tried the Rx demo and both works flawlessly. Below are the settings needed to get them working together...

Stellaris Launchpad transmitter side :-
const uint8_t txaddr[] = { 0xDE, 0xDE, 0xDE, 0xDE, 0xE3 };

void setup() {
  radio.begin(1000000);  // 1Mbps, max TX power
  radio.setChannel(88); // Channel 88
  radio.setCRC(1,1);    // Enable CRC, 16-bit

Arduino UNO receiver side :-

const uint64_t pipes[6] = { 0xDEDEDEDEE7LL, 0xDEDEDEDEE9LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL, 0xF0F0F0F0E4LL, 0xF0F0F0F0E5LL };

void setup() {

Summary Links :-

Premier Farnell (Element14)
Stellaris Launchpad
Energia Development Environment
- Spirilis Energia nRF24L01 library
Forum link

Wednesday, August 14, 2013

Getting nRF24L01 working with attiny84


After getting the attiny85 (8 pins) working with nRF24L01, I find that while this chip is nice and small, the lack of extra pins is a real hassle when I need to add any sensors/actuators to the MCU.

When I received my attiny84 ICs from Element14, now the fun begins...

attiny84 pinout

As usual, I hook up the attiny84 and test a blink sketch to ensure the attiny84 is working correctly. The first thing I encounter is that the blink is very slow, about 8 to 10 secs slower and I was wondering why. By the way, I'm using this Arduino tiny-core as there are other tiny-cores available on the net with different settings.

After posting my problems on Arduino forum, I found out I need to do a Tools->Burn Bootloader to set the correct speed and fuses on the attiny84. After the "Burn Bootloader", the attiny84 was operating correctly at 8Mhz without an external crystal.

The above pictures are my test setup of the attiny84 on a breadboard with breadboard power supply running on 3.3V, nRF24L01 on an UNO adapter, USBtinyISP and logic analyzer and mini hooks.

The "fun" starts when trying to get the SPI pinout for attiny84 for running the nRF24L01. Since it uses the same tiny core was the attiny85 and I got the attiny85 working, it should not be too difficult, I guess.

After hooking up the attiny84 according to the above image and flashed the hex into the attiny84, I did not get correct settings on the four register I was monitoring on the serial/debug monitor. For troubleshooting, I have enabled "TinyDebugSerial" to read the four register, namely RF_CH, RF_SETUP, TX_ADDR and RX_ADDR.

I always needed to verify these settings and proper communications to the nRF24L01 as I used many different data rate, channel/frequencies and TX/RX address on all these nRF24L01 radios all the time.

  Mirf.readRegister(RF_CH, &rf_ch,sizeof(rf_ch));
  Mirf.readRegister(RF_SETUP, &rf_setup, sizeof(rf_setup));
  Mirf.readRegister(TX_ADDR, tx_addr, sizeof(tx_addr));
  Mirf.readRegister(RX_ADDR_P1, rx_addr, sizeof(rx_addr));

I also hook up a Logic Analyzer to the SPI pins to "see" what is going on during those SPI transfers. A proper SPI transfer would look something like below, with Enable/Slave Select (SS) pin held low during active SPI with Clock (SCK) supplying the clockrate for the MOSI/MISO.

SPI transfers

The issue seems to be SPI related as I do not get SPI patterns similar to the above, I immediately looked at SPI85 library that was downloaded from Arduino forum and it was working fine on the attiny85 on my earlier blog entry.

A bit about the SPI for the attiny, as the attiny does not have dedicated pins for SPI, it uses Universal Serial Interface (USI) for both SPI or I2C. See for details on the USI-SPI on Arduino playground.

By viewing this link on Arduino Playground, it gives *hint* NOT to use the MOSI/MISO pins for attiny as they are ONLY used for In-Circuit Serial Programming (ICSP) only.

By looking at the SPI85.cpp codes, there are two lines that seems to differentiate between attiny85 and attiny84.

#if defined( __AVR_ATtiny85__ )
const static uint8_t SS   = PB4;
const static uint8_t MOSI = PB1;
const static uint8_t MISO = PB0;
const static uint8_t SCK  = PB2;

#if defined( __AVR_ATtiny84__ )
const static uint8_t SS   = PA7;
const static uint8_t MOSI = PA6;
const static uint8_t MISO = PA5;
const static uint8_t SCK  = PA4;

Here are some snapshot from the datasheets as like most of you, I only 
will read through the datasheet as a last resort as they are not written for 
normal people like myself. I always wonder if the author even understand what 
he himself wrote if he reads it a few years later.

attiny x4 pinout

attiny x4 pin alternate functions
From the above info/snapshots from the datasheet, I will have to assume that whoever 
wrote the SPI85 library was just following putting support for attiny84 without actually 
tested an attiny84 before as clearly it shows the pins was incorrect.

The pin PA5, while listed as MISO (for ICSP), was also USI-DO (data out) and PA6 while 
listed as MOSI (for ICSP), was also USI-DI (data in). As stated above in Arduino 
playground, for attiny, the MISO/MOSI is used only for ICSP and not for USI-SPI.

That was easy to solve, just swapped PA5 and PA6 and everything will work fine, 
right.. but it turns out that the PA5 and PA6 is logically mapped to value of 5 and 6 
and when the codes does an Arduino code of pinMode and digitalWrite, it execute 
the wrong pins for the attiny. A Digital pin5 mapped to PA5 and Digital pin6 mapped 
to PA4 (the pin used for the SCK/USCK).. no wonder the SPI display on the 
logic analyzer goes haywire..

Once, I traced the issue and figure out the problems, I just had to hard code the Arduino digital pins
to the AVR_ATtiny84 defines as below and changed the MOSI/MISO source of confusing to 
USI_DO and USI_DI :-

#if defined( __AVR_ATtiny84__ )
const static uint8_t SS   = 3;
const static uint8_t USI_DO = 5; 
const static uint8_t USI_DI = 4;
const static uint8_t SCK  = 6;

After that, I was able to see the correct settings on the Serial Debug or the SPI patterns on the 
logic analyzer. I do not know enough about how the tiny cores was written to put the 
proper attiny84 pin names but it was finally working.

If you figure out on how to fix the attiny84 pins, please let me know. The nRF24L01 library
was located at the summary links below.

There is an example of attiny84 codes in the Mirf library at github repo.

Summary Links :-

Mirf (nRF24L01) libs for UNO/attiny84/attiny85 :-
Arduino tiny-cores :-

Friday, June 21, 2013

Electric Imp + Arduino + nRF24L01 = Fully Internet Wireless Solution

When we discovered the Electric Imp recently, we almost immediately ordered them directly from US to do research and coding on them. You can read more about the electric imp on their websites or view their videos on Makerfaire, in short, it is a awesome product. 

electric imp

What it does is to simplify the Internet connectivity of electronic projects and the ability to program your device or "things" over the Internet on a web based IDE is a really powerful concept made into reality.

Before the Imp, a few other options existed to have your device "Internet Enabled" and they are either too expensive or requires a lot of other stuff like router / firewall configuration, having a linux box in between like the Raspberry Pi version of Raspbian or plug in an Ethernet Shield on top of an Arduino. I've tried  them all out and could not find any other solution as simple as this.

Firstly, do not be confused by it SD card looking form factor, it is NOT a memory card but a powerful microcontroller plus wifi enabled radio all stuff into a tiny SD card otter shell. When it comes to connecting endpoints like smartphones and laptops to wifi, we are all aware of the trouble of choosing the correct access point and keying in the wifi password to gain access. 

How do you key in the access point name and wifi password to this small little SD card microcontroller ? The answer is light or blinking lights to transmit these wifi authentication information directly to the card itself. They have mobile apps for both iOS and Android platform. View this video demo on how it works.

With the Internet connectivity issue easily solved using an Electric Imp, my next questions is what if I want to connect more than one device ? Should I buy another electric imp and the Imp development board to house it or should I find an alternative (or more cost effective ) method to link up all my other devices/things in the house.

With my other projects all using nRF24L01 radio, the choice is quite obvious for a wireless solution, find a nRF24L01 driver for the electric imp platform. After a few google searches, I manage to find an initial driver for the electric imp on the forum  BUT it was totally not working and unfinished. This is what usually happens to open source and community projects, someone will write the codes when time and interests permits and abandon it when it is either not working or find something else more interesting project to do...

Since I have a little bit of experience forking the nRF24L01's RF24 library and making the RF24 drivers work for Arduino, Raspberry Pi and Atmel attiny85, I took up the challenge of writing the nRF24L01 driver for the electric imp at the same time learning a C like new object oriented programming language called Squirrel that was used on the Imp.

The nRF24L01 I wrote was a combination of RF24 codes with the Mirf codes as the Mirf codes was easier to understand and was originally written in C instead of C++ for the RF24. There were some issues on the SPI but with a help of a Logic Analyzer and Logic software, I was able to fix most of the SPI related issues   

The github repo for the Electric Imp nRf24L01 driver is at You can comment out all the debug output when everything the radio is running ok.

block diagram

My next task is to find a useful application for my wireless solution, since I had a RGB LED strip and always like to make an Internet enabled RGB lighting, I hook up everything like the block diagram above. The web portion is a jquery colour picker from farbtastic with some touchscreen add-ons for touchscreen smartphone/tablets. Do viewsource to see the javacript codes at

colour picker

The Arduino portion is a simple code to read the three RGB codes from the colour picker webpage via nRF24L01 in #RRGGBB in hex and convert them to decimal ( 0 - 255 ) for analogWrite to the PWM pins. I'm driving the 12V RGB LED strip using a ULN2803 IC similar to this page on ambient lighting.

Arduino + nRF24L01 + RGB
The electric Imp part of the hardware is an April development board with the Impee SD card with SPI pins connected to the nRF24L01 radio. Since both the Imp and nRF24L01 runs on 3.3V, I do not need power regulator for this.

Impee + nRF24L01
Those red mini hooks are connected to my logic analyzer when I was troubleshooting the SPI issues I faced earlier. 

In summary, this seems like a complex setup but in actual fact after removing all the nRF24L01 library/drivers, the lines of codes is only the below :-

Imp Server Side :-
  1. ===============================================================================================
  2. Electric Imp agent side ( cloud / server side ) :-
  3. ===============================================================================================
  5. http.onrequest(function(req, resp){
  6.     server.log("Got a HTTP request");
  7.     if (req.method == "POST"){
  8.         local body = http.urldecode(req.body)
  9.         server.log(;
  10.         device.send("agentBuffers",;
  11.         //device.on(recvfromImp,impBuffer);
  12.     }
  13.     resp.send(200"<head><meta http-equiv=\"refresh\" content=\"1;url=\"><html>OK</html></head>");
  14. });

Imp device to send to nRF24L01 ( radio.send() ) :-
  1. ===============================================================================================
  2. Electric Imp device ( the white wifi SDcard in yr home ) :-
  3. ===============================================================================================
  4.   function watchdog2() {
  5.         agent.on("agentBuffers",function(value) {
  6.         server.log("Got a buffer from agent/http");
  7.            if ( value.len() < 33 ) {            // Make sure nRF24L01 payload is only 32bytes or less
  8.            radio.send(value,value.len());          // Send the payload to the radio
  9.            }
  10.         } );
  11.         radio.powerRX();
  12.         imp.wakeup(1, watchdog2 );    
  13.     }

Arduino portion after getting the #rrggbb from nRF24L01 :-

  1.         HEXtoRGB(); 
  2.         analogWrite(RED_PIN,r);
  3.         analogWrite(GREEN_PIN,g);
  4.         analogWrite(BLUE_PIN,b);

Summary Links :-
- Arduino RGB code

Related Posts Plugin for WordPress, Blogger...