Posts

Trade storage for code - stretching a font in real time

Image
I've published several Arduino libraries for controlling inexpensive OLED and LCD displays, for example, my oled_96 library drives SSD1306/SH1106 OLEDs. It's gone through several iterations with additional functionality added. Recently I was using it on a new ATmega32u4 (Arduino Leonardo) project and ran out of FLASH space. I wanted to keep using the large fixed font for the project, but the font data takes up 6K of the 28K available. My first idea was to just #ifdef the font out of existence on targets with small amounts of FLASH memory. I couldn't move forward with my project until I solved the space problem and then decided that a slightly blocky looking large font would be better than no large font. The code to stretch the pixels isn't very complicated, so I added the logic to draw the large font as a 2x2 stretch of the 8x8 font.  AVR target MCUs tend to have very little FLASH space, so I singled them out as the target which would get this font stretching. Luckil...

Controlling lots of OLED displays with a few GPIO pins

Image
On my mission to learn as much as possible about "IoT" and all of the accessories/sensors/displays that are popular in the market, I came across some projects which were using multiple OLED displays to form dashboards and control panels. I hadn't thought about this usage, but it makes sense considering how inexpensive (and small) they are. The challenge presented with this idea is that the inexpensive hobby parts either have a fixed I2C address (usually 0x3C) or a single jumper to select an alternate address (usually 0x3D). The photo above shows a collection of readily available and inexpensive I2C OLED displays . The top 3 have a single address selection jumper. The bottom 2 don't show any specific jumper for changing the address, although one or more of the SMD resistors might control it. Either way, most hobbyists are not prepared to work with tiny, surface mount resistors. If they all are set to the same I2C address, then in order to get more than 1 display...

Optimizing your nRF24 range with a simple test rig

Image
I'm working on a commercial project and I need a low power wireless interface to send data reliably in a crowded indoor environment. There are many standards and protocols to choose from, but the Nordic Semiconductor nRF24 and its 'shockburst' small packet protocol seemed like the best fit for the job. Three advantages of the nRF24 are its incredibly simple interface, that it uses very little power when idle and that it operates in the unlicensed spectrum near 2.4Ghz. Bluetooth low energy (BLE) could potentially do the same job, but the available devices and RF protocol are a bit more complicated and more expensive than this project requires. I started by buying some inexpensive nRF24L01+ development boards from Amazon that cost around $1 each. I wired them up to some ATmega328's for testing and tried the simple "Hello World" chat app; they worked as expected. Next, I added them to my product prototype and that's where the trouble began. My project h...

How low can it go? (optimizing for power)

Image
Background The Arduino (and later the Raspberry Pi) have created a huge marketplace of kits, modules and discrete parts. Vendors all over the world offer a large selection of sensors, displays, motor controllers and micro controllers for every need. This has opened up huge opportunities for individual makers to experiment and learn. Devices like these used to be very difficult to source and use in single piece quantities. If you're on a tight budget and have a lot of patience, vendors in China are willing to sell low quantities of parts directly to you at prices much lower than local vendors can offer. Over the last few years, one of my personal goals has been to familiarize myself with "The IoT". This has mostly involved buying parts, reading the datasheet, writing software to drive it and then sharing the results on GitHub . The only way I've been able to afford to acquire and test all of these parts is by buying them from China. My mailbox receives a steady stream...

My adventures in writing an OTA bootloader for the ATmega128RFA1

Image
This adventure begins with the acquisition of a low priced gadget from the secondhand market. The SMART Response XE was designed to be a classroom communicator that allowed students to vote and submit answers in real time to the teacher. Support ended a few years ago and what once cost $100-200 each are now available on eBay for $10 or less. The hardware is just asking to be hacked. Inside is: 60-key keyboard 384x136x2-bpp monochrome LCD ATmega128RFA1 MCU (128K Flash, 4K EEPROM, 16K RAM, integrated 802.15.4 MAC) 1Mb (128KB) SPI flash 4xAAA battery power supply This particular MCU is part of the AVR family of products and that makes it easy to write code using the Arduino IDE. I initially spotted this on Hackaday because a group of people in the Arduboy community decided that it could be fun to run their games on it. My interest is more in the learning side. For me, this device was a good way to learn about: Serial (SPI) FLASH memory AVR Bootloaders 802.15.4 wireless...

Software Optimization Specialist - cos'è?

Recently I've been talking with potential clients and have needed to explain in detail what it is that I do. My title and resume don't do a great job of conveying that information, so I thought it would be useful to collect my ideas here. Lately, the majority of my time is spent making other people's code run faster, but I also work with bits, bytes, pixels and embedded devices. The following are anecdotes from working with various clients. For security reasons, specific project details may be omitted. Back End / Server A while ago, I cold-called a company with a proposition. They run a "software as a service" that processes tons of images for clients using their own server machines. I asked if they were using open source software to run their business and if they were satisfied with the performance. It turns out that I caught them at a good time because they were having performance problems and were about to purchase more servers to handle their growing list...

With software, there's always a better way to do it

Image
Warning I will be naming and shaming a specific tech company, but most companies are guilty of the same thing. Scenario You define a standard used in the software industry and provide the reference code to make use of it. The standard is complex enough that developers don't want to re-invent the wheel by writing their own implementations. The reference code is incorporated into commercial products and used by millions (billions?) of people around the world. There is a slight problem - the reference code isn't properly optimized, so all of your users are wasting additional time+energy working with the data you've standardized. The Specifics The subject of this blog post is the OpenEXR image file standard created by Industrial Light & Magic . I'm not directly involved in working with these images, but my client is and I saw an opportunity to improve their productivity by optimizing access to them. There's nothing particularly wrong with the reference impl...