Stripboard – how to solder quick prototype for DIY project

Quick prototype

Quick prototype

DIY project usually is prototyped using breadboard. Big mess of wires, and some chips between :) It is very convenient build it that way. Rewire connections? No problem, just switch some wires.

However, when project is done and You want to use this prototype in the filed, it turns out, what was advantage has suddenly become burden. Any moment You can pull some wire by accident and thats usually mean broken circuit. In most cases You won’t even remember where that wire was…

How to create fast but solid DIY prototype?

Continue reading

Wireless temperature sensor programmed with Arduino IDE

tinyBrd is small development board, with ATtiny84 and NRF24L01+ connector. With software provided by us, You get easy to use board which can send data by radio to Raspberry Pi or Arduino UNO and run many days (our most recent tests show it will run at least 2-3 weeks in this scenario) on single CR2032 battery.

When in sleep mode whole board with NRF24L01 and DS18B20 takes as low as 5 µA!

Tools and materials

To build this example You will need:

Of course You will need tools like solder iron, wire cutter, etc.

To receive data we suggest use Raspberry Pi and our NRF-Hat – simple board to connect NRF24L01+ directly to RPi, without mess (no cables required).

Continue reading

What new we have learned about NRF24L01

Nettigo tinyBrd i Raspberry Pi z NRF-Hat

Nettigo tinyBrd with RPi and NRF-Hat

In recent weeks we did a lot tests to our tinyBrd. This was due to new Nettigo tinyBrd Core (integration with Arduino IDE). With v1.1b release we have lowered current consumption even more.

Now, in sleep mode tinyBrd with NRF24L01+ and DS18B20 takes only 4-5 µA (vs 9-10 µA on previous software). During sending data it takes 15 mA (vs 18 mA before).

Our test case is sending data (temperature) read from DS18B20 to RPi every 30 seconds and tinyBrd is powered by singe coin battery (CR2032). How does it work?

Continue reading

Using tinyBrd library on Arduino to connect via NRF24L01

Our tinyBrd has very simple and easy to use interface for NRF24L01 radio. This library was bundled with Nettigo tinyBrd Core, add-on for Arduino IDE to program tinyBrd. Now we have extracted it as standalone and can be used on Arduino UNO and other boards.

Changes are minor, since we need to remove name conflict with bundled Radio library. Arduino IDE library manager was taking our Radio library as library for FM chips. So let us introduce RadioNRF24 library. With library name change we have changed main object name so all old examples are valid, just use new object name:

  RadioNRF24.begin(address, 100);

There is no other changes. With UNO You have use different begin form:

  RadioNRF24.begin(address, 100, 8, 7);

On tinyBrd CSN i CE are fixed so there is no need to give them in initalizer. That is not true with UNO, so in former example 8 is CSN pin and 7 i CE pin. Exactly as it is shown on following diagram – how to connect NRF24L01 to Arduino.

Connecting nRF24L01 and Arduino

Connecting nRF24L01 and Arduino

Library is for now available only on GitHub: https://github.com/nettigo/RadioNRF24

We will prepare more easy to use form as .zip file. Also – there are some examples as  gists: https://gist.github.com/netmaniac/dfd7eb4f884d58346480. Remember – as for today library bundled in tinyBd Core is still using  Radio name, so all code on tinyBrd should use Radio.begin and similar. On UNO use RadioNRF24. In future, we will update tinyBrd Core to use RadioNRF24 name.

Arduino YUN – how to get older system images

On Arduino.cc  You can always find and download most recent Arduino YUN system image (firmware).  What to do, if You need older one?

Arduino YUNOlder firmware for Arduino YUN

First, You need to know which firmware You need. Browse all release notes on  GitHub. Knowing which one You need, insert revision number into link replacing XXX:

https://downloads.arduino.cc/openwrtyun/1/YunSysupgradeImage_vXXX.zip

So, if You need 1.4.2 link for download is:

https://downloads.arduino.cc/openwrtyun/1/YunSysupgradeImage_v1.4.2.zip

And for Release 1.3:

https://downloads.arduino.cc/openwrtyun/1/YunSysupgradeImage_v1.3.zip

 

tinyBrd – getting stuff installed

This post is part of bigger series. You can get all tinyBrd related information here.

Before You do any work with tinyBrd You have to install required libraries. We have prepared instruction how to do it.

Requirements

This tutorial was tested against Arduino IDE 1.6.7 from Arduino.cc and we assume You are using this version. To program tinyBrd You need some kind of ISP programmer, we recommend easy to use USBasp

Getting info

First You  need to know, where You have to install our code. Locate folder with Your sketches – check Arduino IDE preferences (Ctr+,).

IDE preferences

IDE preferences

In this example it is /home/seba/sketchbook15. In this folder create (if it doesen’t exists yet) folder hardware. Then get our Nettigo tinyBrd Core http://static.nettigo.pl/tinyBrdCore-current.zip and unzip it. Restart Arduino IDE and in menu Tools/Boards You should see new entries. Choose Attiny84 @ 8 Mhz.

Now, open example File/Examples/01. Basics/Blink and change LED pin from 13 to 0. Upload example to tinyBrd (if You have USBAsp just connect it and upload from IDE as usual). You can test with multimeter or LED connected to D0 that Blink is working.

Examples

We have prepared some examples, You can download it from http://static.nettigo.pl/tinyBrdExamples-v1.0.zip Unpack it to Your sketchbook folder.

All of them, in most current version You can get from GitHub: https://github.com/nettigo/tinybrd-examples

Raspberry PI

tinyBrd is meant to communicated with some central node. Raspberry PI is great for that! We have created Python library to get NRF24L01 going.

We assume You are using our NRF Hat to connect modem NRF24L01 to Your Raspberry.

You have to install pip for Python3 if You don’t have it on Raspberry:

sudo apt-get install python3-pip

Now just install our library directly from GitHub:

sudo pip-3.2 install git+https://github.com/nettigo/pyNRF.git

NRF uses SPI protocol, which is not enabled by default on Raspberry, run sudo raspi-config choose option Advanced config next A6 SPI and answer yes to next questions. Now reboot Raspberry, it is ready to work.

Revision history (this article and core versions):
  • 12-09-2015 – initial version
  • 30-12-2015 – core updated to work with Arduino IDE 1.6.7
  • 4-02-2016 – v1.1b – lower current consumption – only 4-5 µA in sleep mode

tinyBrd – NRF24L01 radio connectivity in Arduino style

Check tinyBrd page

All, most current and up to date documentation can be found on tinyBrd documentation page: http://starter-kit.nettigo.eu/tinybrd-documentation/ (since Mar 2016)

Previous content:

At Nettigo we did a lot work with NRF24L01. As a result we created small board, with ATtiny84 on board and connector for NRF24L01.

tinyBrd

This board is Arduino IDE compatible (You program it using Arduino IDE, most commands are ported), we have prepared some easy to use library for most important tasks: radio communication, power save modes and more.

With easy to use software interface You can get in few minutes running remote sensor, sending data to central unit and in power save mode using only ~10µA! For example – DS18B20 sensor sending data to central unit each 30 seconds can work on two AA batteries few weeks.

Hardware:

We have prepared some Polish documentation, now we start to translate it to English:

  1. Install required software to Arduino IDE and on Raspberry Pi (optional): http://starter-kit.nettigo.eu/2015/tinybrd-getting-stuff-installed/
  2. Build minimalistic temperature sensor working weeks on single CR2032 battery: http://starter-kit.nettigo.eu/2016/wireless-temperature-sensor-programmed-with-arduino-ide/
  3. How to receive and send data on Arduino using NRF24L01 and tinyBrd Radio library: http://starter-kit.nettigo.eu/2015/using-tinybrd-library-on-arduino-to-connect-via-nrf24l01/

Serial port busy for avrdude on Ubuntu with Arduino Leonardo Eth

Arduino Leonardo Eth

Doing test with new Arduino Leonardo ETH on Ubuntu (14.04) we had problem with programming this board:

avrdude: ser_open(): can't open device "/dev/ttyACM0": Device or resource busy avrdude: ser_send(): write error: Bad file descriptor Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

On Ubuntu (or other distro with ModemManager) ModemManager tries to connect to each new serial port. MM tries if this serial port is GSM modem. This is very convenient for most users, but it keeps serial port open, and Arduino IDE can not communicate with Arduino Leonardo. There is a list of ignored devices by ModemManager, but for now most Arduinos from Arduino.org are not included.

What to do? Just add own rule telling ModemManger to ignore all USB devices from Arduino.org. Open new terminal (Ctrl+Alt+T) and issue command:

sudo echo 'ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"' > /etc/udev/rules.d/77-arduino.rules

echo ‘ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"‘ | sudo tee /etc/udev/rules.d/77-arduino.rules

As noted in comments, there should be other form used, first one won’t work – will not write rule into file, will return Permission denided, thus this update

next You have to reload rules:

sudo udevadm trigger

That’s all.

Debug sketch on Arduino Zero Pro with GDB and OpenOCD

Arduino is simple platform but empowers it’s users to do fantastic projects. People with experience in writing software for bigger computers can get strange feeling when they have no access to debugger. Debugger is tool for tracing program execution – You can examine/modify variables, going through code step by step and many more. In other words it let’s You know why program does not behave as expected. It is very useful tool, especially when You have to deal with more complex programs. But Arduino does not have such tool, only debugging method is to write messages via Serial class.

Arduino Zero Pro for rescue

We have Arduino Zero Pro in our offer. This board has 32-bit ARM Cortex-M0 processor. New feature is interface for debugging sketches on board. You can do it with JTAG/SWD adapter, or just connecting board to PROGRAMMING USB port. This article will show You how to access debugger feature with free and open tools.

Debug in progress

Debug in progress

 

How to start?

Test were done with computer running Linux, but all required software is bundled with Arduino IDE, so this tutorial should work also on Windows and MacOS without any significant changes.

Arduino ORG

It is important to note, that we will need Arduino IDE from Arduino.org not from Arduino.cc. At this moment (Apr/May 2015) only IDE on Arduino.org has support for Arduino Zero Pro.

We need to download and install Arduino IDE 1.7.3 or newer. Next step is to increase number of messages given by IDE during sketch compilation. Open preferences (Ctrl+,) and near  Show verbose option during mark compilation.

For our first debug target we will use Blink. Open it  (menu Files/Examples/01. Basic/Blink), connect Arduino Zero to computer using PROGRAMMING port, in IDE select also Arduino Zero Pro (Programming) and upload sketch to board (Ctrl+U).

OpenOCD

ARM consortium has agreed on communication standard for Cortex-M0 processors. It is called CMSIS (more details about – link) and there is open software supporting this standard.

Let me introduce You – OpenOCD. OpenOCD binary files are bundled with Arduino IDE and You don’t have to install anything more.

Starting OpenOCD

Having our Blink sketch on board, we go to directory where is Arduino IDE and we start OpenOCD using this command:

./hardware/tools/OpenOCD-0.9.0-dev-arduino/bin/openocd -s hardware/tools/OpenOCD-0.9.0-dev-arduino/share/openocd/scripts/ -f hardware/arduino/samd/variants/arduino_zero/openocd_scripts/arduino_zero.cfg

Argument after -s defines folder where are configuration files for OpenOCD, and after -f switch there is configuration file defining Arduino Zero Pro capabilities.Result for running this command should be similar to this:

Open On-Chip Debugger 0.9.0-dev-g1deebff (2015-02-06-13:06)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'cmsis-dap'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 01.1F.0118
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints

GDB

OpenOCD is ready to work. It listens on ports  4444 and 3333. On first port there is telnet server and second one hosts GDB server.

GDB is open source software for debugging programs. It is also bundled with Arduino IDE. It is important to have GDB with support for ARM architecture, so use binaries attached to Arduino IDE.

To proceed we need file with compiled program in  ELF format and with included informations required to properly debug code. Such file is prepared by Arduino IDE during compilation and is stored in temporary directory. To know where this file is we compile Blink again, this time without uploading to board. Just press Ctrl+R and examine output in IDE console window. In one of last lines You will see path and filename with .elf extension. See by Yourself, but note that console window is scrolled to the right, to see this file path:

Where to find ELF file location in Arduino IDE

Where to find ELF file location in Arduino IDE

 

We are ready to run GDB. In folder with Arduino IDE issue command:

./hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb -d examples/01.Basics/Blink/

Folder given after -d switch is place where GDB can find source files for our program. This is required by GDB to display it later to You when You will step through Your program. After issuing this command You should see GDB command line:

GNU gdb (GNU Tools for ARM Embedded Processors (Arduino build)) 7.6.0.20140228-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
.
(gdb) 

In this article I show You only basic steps to get debugger features, for more detailed info about how to use GDB dig by Yourself. In future we may prepare more detailed info about GBD.

First we have tell GDB where to find file with program and debug information:

(gdb) file /tmp/build4557814640826011475.tmp/Blink.cpp.elf
Reading symbols from /tmp/build4557814640826011475.tmp/Blink.cpp.elf...done.
(gdb) 

Command file is used to supply path and filename to program, just insert here path copied from Arduino IDE few steps earlier.

Now we need to inform GDB where it can find our live program:

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) 

Now we can take control over program execution, examine this GDB session output:

(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x000028b8 msp: 0x20002c08
(gdb) monitor reset init
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x000028b8 msp: 0x20002c08
(gdb) l loop
19    // initialize digital pin 13 as an output.
20    pinMode(13, OUTPUT);
21  }
22  
23  // the loop function runs over and over again forever
24  void loop() {
25    digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
26    delay(1000);              // wait for a second
27    digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
28    delay(1000);              // wait for a second
(gdb) b 25
Breakpoint 1 at 0x4120: file Blink.ino, line 25.
(gdb) cont
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, loop () at Blink.ino:25
25    digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
(gdb) c
Continuing.

Breakpoint 1, loop () at Blink.ino:25
25    digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
(gdb) 

Command monitor reset halt sends to our board processor instruction to stop sketch execution, now LED on Arduino stops blinking. monitor reset init resets Arduino CPU to empty state, and it becomes ready to start over.

l loop display loop function code (that is reason why we need tell GDB where are source files). Command b 25 sets breakpoint in line 25 of current source file. cont resumes program execution (well, actually it starts from beginning since we have issued  monitor reset init ). This is reason why after cont, program gets to line 25 and before LED is lit execution is halted. Next c commands allow to run code until it returns to line 25 .

What’s next?

This is simple example to illustrate new possibilities Arduino Zero Pro opens before You. People familiar with GDB are ready now to order Arduino Zero Pro  and start exploring new ways to debug sketches. Others can see on this short video, debugging on Zero Pro is quite easy.

But, since GDB is working nothing does stop us from using some graphical interface for GDB, list of such tools is quite long. We have used DDD (this time You have to install it by Yourself)

DDD during debug session with Arduino Zero Pro

DDD during debug session with Arduino Zero Pro

To use it with Arduino You have to tell DDD where is proper GDB:

ddd --debugger "hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb -d examples/01.Basics/Blink/"