Posts | Comments

Planet Arduino

Archive for the ‘uart’ Category

The basic 16×2 LCD is an extremely popular component that we’ve seen used in more projects than we could possibly count. Part of that is because modern microcontrollers make it so easy to work with; if you’ve got an I2C variant of the display, it only takes four wires to drive it. That puts printing a line of text on one of these LCDs a step or two above blinking an LED on a digital pin on the hierarchy of beginner’s electronics projects.

What’s that? Even four wires is too many? In that case, you might be interested in this hack from [Vinod] which shows how you can drive the classic 16×2 with data and power on the same pair of wires. You’ll still need a microcontroller “backpack” for the LCD to interpret the modulated voltage, but if you’ve got an application for a simple remote display, this is definitely worth checking out.

The basic idea is to “blink” the 5 V line so quick that a capacitor on the LCD side can float the electronics over the dips in voltage. As long as one of the pins of the microcontroller is connected to the 5 V line before the capacitor, it will be able to pick up when the line goes low. With a high enough data rate and a large enough capacitor as a buffer, you’re well on the way to encoding your data to be displayed.

For the transmitting side, [Vinod] is using a Python script on his computer that’s sending out the text for the LCD over a standard USB to UART converter. That’s fed into a small circuit put together on a scrap of perfboard that triggers a MOSFET off of the UART TX line.

We actually covered the theory behind this technique years ago, but it’s always interesting to see somebody put together a real-world example. There might not be too many practical uses for this trick in the era of dirt-cheap microcontrollers bristling with I/O, but it might make a fun gag at your hackerspace.

We’ve all been there. When debugging a microcontroller project, we just want to put in a print statement to figure out what’s going on with the microcontroller in real time. However, advanced embedded programmers know that printf statements are verboten: they’re just too SLOW. While not fixing this plight entirely, [Atakan Sarioglu] has come up with a clever way to create readable debug messages with minimal runtime overhead.

[Atakan Sarioglu]’s innovation, called BigBug (Github), is a dynamically-generated codebook. The codebook translates abbreviated messages sent over serial (UART here) to longer-form human-readable messages. To generate the codebook, BigBug automatically parses your comments to create a lookup between an abbreviation and the long-form message. When you are running your program on the microcontroller, BigBug will translate the short codes to long messages in real-time as you send log/debug data over serial.

For example (not restricted to Arduino-only), if you write Serial.println("HW") //@BB[HW] Hello World!, BigBug will translate the received characters HW\n to Hello World!. In this simple example, the abbreviation uses 3 characters while the fully readable message uses 13 characters, for a savings of ~75% with no loss of clarity. More advanced usage lets you log data: Serial.println("DT 1 1") //@BB[DT] Today's Date is: {0}/{1} becomes Today's Date is 1/1. You can also use enumerated variables (last example could showToday's Date is Jan. 1 with the same print command).

In terms of real-world benefit, using a 115200 baud connection (with 8N1 encoding) this is 115200 bits per second /(8+1) bits per byte = 12800 bytes/sec = 1 byte every 80 microseconds. Sending 13 bytes of Hello World!\n (in a naive, blocking UART implementation) takes ~1 ms of CPU time. With the shortcode HW\n, it would take ~0.25 ms to send essentially the same message (then decoded by BigBug). Note that because this just operates on serial data, BigBug is language independent

If you’ve been constrained by serial throughput for debugging, this looks like a well-polished tool to solve your problems. If you are just using an Arduino and throughput is no issue, then try this tool to debug Arduino programs. Or you could always double-down and use a microcontroller to debug another microcontroller.


Arduino And IR Remote Turn Off Raspberry Pi

arduino, arduino hacks, IR, Raspberry Pi, remote, remote control, shutdown, uart Commenti disabilitati su Arduino And IR Remote Turn Off Raspberry Pi 

With all of the cool features on the Raspberry Pi, it is somewhat notable that it lacks a power button. In a simple setup, the only way to cut power to the tiny computer is to physically remove the power cord. [Dalton63841] found that this was below his wife’s tolerance level for electronics, and built a simple remote control for his Raspberry Pi.

[Dalton63841] started this project by trying to use the UART TX pin, but this turned out to be a dead-end. He decided instead to use an Arduino to monitor the 3.3V power rail on the Pi. When the Pi is shut down in software, the Arduino can sense that the Pi isn’t on any more and disconnect the power. The remote control is used to turn the Pi on. The Arduino reads the IR code from a remote and simply powers up the Pi. This is a very simple and elegant solution that requires absolutely no software to be installed on the Raspberry Pi.

We know that this isn’t the most technically complex project we’ve ever featured, but it is a good beginner project for anyone just getting started with a Pi, Arduino, or using IR. Plus, this could be the perfect thing to pair up with a battery-backup Raspberry Pi shutdown device that allows it to power itself down in a controlled way when a power outage is sensed.

Filed under: Arduino Hacks

Getting an ESP8266 wifi module to work with Arduino

arduino, ESP8266, uart, wifi Commenti disabilitati su Getting an ESP8266 wifi module to work with Arduino 



Last night was another BuildBrighton nerd-meet-up and, luckily, we had a couple of these new fangled ESP8266 wifi modules to try out. In case you’ve been living in a cave with a tin can tied to the end of piece of string as an internet connection, you’ll probably know that these are the ultra-cheap wifi modules currently flooding out of Chinese factories and onto “hacker benches” all over the world.

The reason they’ve created such a stir is that a) they’re cheap and b) the firmware can be (relatively) easily upgraded. So hackers and makers all over the world have been busy trying to access the onboad microcontroller and utilise the extra GPIO pins, to create a single-chip, all-in-one wifi controller.

Our interests are less adventurous – the modules are sold as UART-to-wifi plugin devices, and that’s exactly how we’re going to use them.

Getting an ESP8266 wifi module to work with Arduino - [Link]


ALCAM-OEM – Serial camera module

arduino, BMP, camera, i2c, jpg, SPI, uart Commenti disabilitati su ALCAM-OEM – Serial camera module 


Serial camera module that captures time-lapse and stop-motion videos plus images to uSD card. Use with any micro like mbed and Arduino.

ALCAM allows any embedded system with a serial interface (UART, SPI or I2C) to capture JPG/BMP images and also to record them right onto an SD card. Also, ALCAM gives you the ability to create time-lapse and stop-motion AVI videos and save them directly to the SD card. All done through a set of simple and well documented serial commands. ALCAM can also capture images and videos though a special pin, without the need to send any commands.

ALCAM-OEM – Serial camera module - [Link]


Using Router SoCs as WiFi Modules (Yet Again)

arduino hacks, Microcontroller, microcontrollers, uart, USR WIFI232-T, wifi, wireless, wireless hacks Commenti disabilitati su Using Router SoCs as WiFi Modules (Yet Again) 


8-bit AVRs and 32-bit ARMs do one thing, and one thing well: controlling other electronics and sensors while sipping power. The Internet of Things is upon us and with that comes the need for connecting to WiFi networks. Already, a lot of chips are using repackaged System on Chips to provide an easy way to connect to WiFi, and the USR-WIFI232-T is the latest of the bunch. It’s yet another UART to WiFi bridge, and as [2XOD], it’s pretty easy to connect to an AVR.

The module in question can be had through the usual channels for about $11, shipped straight from China, and the only purpose of this device is to provide a bridge between a serial port and a wireless network. They’re not that powerful, and are only meant for simple tasks,

[2XOD] got his hands on one of these modules and tested them out. They’re actually somewhat interesting, with all the configuration happening over a webpage served from the device. Of course the standard AT commands are available for setting everything up, just like the ESP8266.

With a month of testing, [2XOD] has found this to be a very reliable device, logging temperatures every minute for two weeks. There’s also a breakout board available to make connection easy, and depending on what project you’re building, these could be a reasonable stand-in for some other popular UART -> WiFi chips.

Filed under: Arduino Hacks, Microcontrollers, wireless hacks

Banguino – 8-bit Processing Module

arduino, Banguino, microSD, uart, USB Commenti disabilitati su Banguino – 8-bit Processing Module 



Banguino brings the most popular hobby and DIY development platform in the world into a single chip DTX module and offers full backwards compatibility with the most used worldwide Arduino board – the model ‘Uno’.

Bonus features include an on-board power supply to generate +5V and +3.3V to the user’s external circuit, a microSD connector and additional 10 configurable digital I/O ports. There are also two software controllable LEDs on board as well as a USB-to-UART bridge. Banguino provides a highly integrated solution for building simple or complex circuits and benefiting from the large variety of already existing Arduino-compatible code.

Banguino – 8-bit Processing Module - [Link]


Digispark Pro – tiny, Arduino ready, mobile & usb dev board!

arduino, Digispark, Digispark Pro, i2c, SPI, uart, USB Commenti disabilitati su Digispark Pro – tiny, Arduino ready, mobile & usb dev board! 

Digispark Pro - The tiny Arduino IDE ready, usb and mobile dev board and ecosystem – cheap enough to leave in any project! Wi-fi, BLE, and 25+ shields!

Serial over USB debugging, USB programmable, 14 i/o, SPI, I2C, UART, USB Device Emulation, Mobile Development Ready, Optional BT, BLE, Mesh, and Wi-Fi.

The super small, dirt cheap, always open source, Arduino compatible, USB (and Mobile and Wireless!) development (and production) platform, and follow-up to the original Digispark.

Easier to use, more pins, more program space, more features, more reliable – supporting the entire existing Digispark ecosystem of 25+ shields and adding Wi-Fi, Bluetooth, BLE shields and more! Ready for all your projects – including mobile hardware development! All still super affordable!

The Digispark Pro Ecosystem is the cheapest, Arduino compatible development platform for Mobile and Wireless hardware development.

Digispark Pro – tiny, Arduino ready, mobile & usb dev board! - [Link]


Zero-wire serial auto-reset for Arduino

arduino, reset, TTL, uart Commenti disabilitati su Zero-wire serial auto-reset for Arduino 


Ralph shared his auto-reset feature of his Arduino board. He writes:

Various versions of the Arduino will reset the board by toggling the serial DTR line, a feature called auto-reset. Since it relies on the DTR line, it won’t work with TTL serial adapters that don’t break out the DTR line. After writing my half-duplex serial UART, I thought of using the TTL serial break signal which holds the line at 0V for several ms. Normal serial communications would also send 0V, but at 57.6kbps, it would never last more than 160us before returning to the idle high voltage state. So what I needed was a circuit would not reset when the line is low for 160us, but would reset when the line is low for 100ms or more.

Zero-wire serial auto-reset for Arduino - [Link]


Software Half Duplex UART for AVRs

arduino hacks, attiny, ATtiny Hacks, half duplex, software uart, uart Commenti disabilitati su Software Half Duplex UART for AVRs 

One Wire Serial

If you have worked with very low cost microcontroller in the past, such as the ATtiny series from AVR, you’ve probably been stuck without a UART peripheral. The usual answer to this problem is to implement the UART in software. It’s not fast, but it works.

Lets say you’re even more limited on resources, and only have a single pin for UART. [Ralph] created a software library and a small circuit that enables half duplex UART using only one pin. With the above circuit, and a 62 byte Arduino compatible library, you can add UART to the tiniest of ATtinys.

In this circuit, the Tx/Rx pin is on the AVR, and the Tx and Rx pins are another device. The circuit relies on the idle state of UART being a logic high signal. When the Tx pin is idle, the transistor stays on. This allows the Tx/Rx pin to pull Rx low when the AVR sends a 0. When the Tx pin sends a 0, the Tx/Rx pin gets pulled low through the diode.

It’s a clever hack, and could definitely help add communication to your next tiny project.

Filed under: Arduino Hacks, ATtiny Hacks

  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook