Tag Archives: arduino

Pololu A-Star 32U4 Mini on Ubuntu

Recently I received a A-Star 32U4 mini board from Pololu, which I’d bought during the Black Friday for just $6.

Since this mico-controller board shares many similarities with Arduino Leonardo, I thought I could just upload the program using Arduino IDE by selecting Arduino Leonardo as the board type.
Unfortunately, that did not work even after I tried resetting the board as suggested in the following the error message logged by Arduino IDE in the console:

Binary sketch size: 4,826 bytes (of a 28,672 byte maximum)
processing.app.debug.RunnerException: Couldn’t find a Leonardo on the selected port. Check that you have the correct port selected.  If it is correct, try pressing the board's reset button after initiating the upload.
...

Next, I followed the instruction on this page to add the Pololu hardware add-on to the Arduino IDE. The guide only showed how to accomplish this on a Windows machine. On a Ubuntu system, possibly also on other distros, I need to drop a udev rule in /etc/udev/rules.d otherwise I won’t be able to upload any program to the board.
Fortunately, this file is provided in A-Star Software and Driver zip file (available on this page.).

I named that file /etc/udev/rules.d/99-a-star.rules.

SUBSYSTEM=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="0101", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="2300", ENV{ID_MM_DEVICE_IGNORE}="1"

Now, I could upload any program from Arduino IDE by selecting either Arduino Leonardo or Pololu A-Star 32U4 as the board type.

Ref:

Progamming Arduino using USBasp on Ubuntu

My USBAsp dongle arrived from China. It’s connected to the ISCP pins on an Arduino Nano, and also plugged to a computer via USB connection.

usbasp_nano

According to lots of intructions on the Internet, to upload a sketch to an Arduino, we need to do the following:

  • Tools -> Programmer -> USBasp
  • File -> Upload Using Programmer

Unfortunatly it did not work. Here is the error message produced by Arduino IDE:

avrdude: Warning: cannot query manufacturer for device: error sending control message: Operation not permitted
avrdude: error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc

To fix this, we need to add a udev rule to allow a normal user accessing the USBasp dongle. Let’s create a file with the following name: /etc/udev/rules.d/99-USBasp.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="plugdev", MODE="0666"

Ensure that your account is in group ‘plugdev’. I believe you can change the GROUP=”adm” to a different one to suit your situation. Then unplug the USBasp dongle, reconnect it and try to upload the sketch again.

It worked for me and should work for you too.

Source:

Arduino improving nRF24L01+ reliability

In the past few weeks, I noticed that data transmitting from one of sensor nodes got dropped dramatically. This sensor node is an Arduino Micro using nRF24L01+ as the transmitter.

NRF20L01+

NRF20L01+

Well, it’s suppose to send data to the base station once every 30 seconds; however the transmitting recurrence time exceeded 2 minutes. By default the transmitting rate is at 1MBit/s, so I dropped it to 250KBit/s to see if had any better improvement. It didn’t help.

Fortunately, while searching for an unrelated topic, I landed on this page http://blog.surserv.at/nrf24l01_wireless_modules/ which talked about nrf24l01+ and some issues witht the Arduino libraries I used.

If you have free time, go and read that post; however to jog my memory this is the changed I made in libraries/RF24/RF24.cpp:

333 void RF24::begin(void)
...
357   //write_register(SETUP_RETR,(B0100 << ARD) | (B1111 << ARC));
358   write_register(SETUP_RETR,(B0101 << ARD) | (B1111 << ARC));
...

509 void RF24::startWrite( const void* buf, uint8_t len )
...
513   // [2014-08-12:SS] http://blog.surserv.at/nrf24l01_wireless_modules/
514   //delayMicroseconds(150);
515   delayMicroseconds(500);
...

After the change to the library is made, I recompiled the Arduino sketch and uploaded to the mentioned sensor node. Now, the base station is able to receive data from that node every 30 seconds as expected. Yay!