Tag Archives: Arduino Nano

A Couple of Clone Arduino Linux Issues

A Couple of Clone Arduino Linux Issues

The serial port appears for a single second, and then vanishes before you can upload any code.

This has been happening to me with Pop OS, but apparently also happens with other Ubuntu variants. I can’t believe what the cause is, but if you check dmesg and you will possibly find the following occurring :

[   98.044600] usb 3-2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice=81.33
[   98.044606] usb 3-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[   98.044607] usb 3-2: Product: USB Serial
[   98.046052] ch341 3-2:1.0: ch341-uart converter detected
[   98.046409] usb 3-2: ch341-uart converter now attached to ttyUSB0
[   98.608979] input: BRLTTY 6.4 Linux Screen Driver Keyboard as /devices/virtual/input/input41
[   98.887664] usb 3-2: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
[   98.888541] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0

What we see happening is the OS finds the newly plugged in CH340 based serial device on your board and creates a new serial port, in my case, ttyUSB0. Excellent. But then, along comes “BRLTTY”. BRLTTY has decided it knows what this device is, removes the serial port and turns the device into an input / keyboard device. BRLTTY apparently knows best and claims all devices with the manufacturer / product ID of a USB to UART adapter chip, that is absolutely not always the product they think it is. This is really poor default behaviour, especially as this all happens silently. Apparently BRLTTY is accessibility software for the blind that is installed by default.

To solve the issue, assuming you’re not blind, simply type “sudo apt remove brltty” (without quotes) at the command line and it will be uninstalled, making the issue go away.

Not in Sync

The not in Sync error, where you get a repeated message such as the following :

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

… is an old one with many causes. One cause now seems to be that if you use a clone device, the Arduino IDE refuses to talk to it by default. The solution might be to change the “Processor” in the Tools menu to “ATmega328P (Old Bootloader)”. This would apply to boards such as Unos and Nanos. This might actually also apply to older genuine Arduino Boards.

As you might guess, I’ve had a slightly frustrating day. All I did was try to load a program into a clone board someone gave me the other day.

Rechargeable Battery Power

I’ve quickly cobbled together a rechargeable lithium battery circuit and stuck it into a box with an Arduino, a temperature / humidity sensor and a temperature / pressure sensor.

It hasn’t exploded yet.

This was the circuit I used to test it was working (using the battery charger and step up DC-DC converter to power my flammable gas sensing circuit, because it was within reach).

Charging Circuit

This evening I re-wrote an Arduino program of mine that takes measurements from a DHT22 temperature / humidity sensor and BMP180 temperature / pressure to make it work with and Arduino Nano with an LCD screen attached. I’ve not used a Nano in ages, but sadly, I needed the 3.3v regulator to drive the BMP180. Hopefully it won’t be drawing much current and so not wasting much energy, after I went to the effort of using a reasonably efficient step up converter. I did check, and the voltage straight from the battery is also too high. Future plans include… not using 3.3v sensors.

Here is a video of the box running off the battery.

I’ll tidy up the circuit – perhaps move it from breadboard and a pile of bits onto protoboard, make the charging port accessible, add a power button, menu buttons, battery voltage monitoring, auto power down for low battery / after inactivity and perhaps add an external 1 wire bus for DS18b20 sensors. At that point I’ll document what I’ve done a little better.