Posts with «arduino» label

Optimizing GIF Playback For Microcontrollers

Despite being cooked up by Compuserve back in the late 1980s, GIFs have seen a resurgence on the modern internet, mostly because they’re fun. However, all our small embedded systems are getting color screens these days, and they’d love to join in the party. [Larry Bank] has whipped up a solution for just that reason, letting embedded systems play back short animated GIFs with limited resources.

[Larry] does a great job of explaining how the GIF format works, using LZW compression and variable-length codes. He talks about how the design of the format presents challenges, particularly when working with microcontrollers. Despite this, the final code works well, and is able to work with most animated GIFs of the right dimensions and construction. 24K of RAM is required, and image width is limited to 320 pixels. Images can be loaded from flash, memory, or SD cards, and he notes that best performance is gained with a microcontroller with fast SPI for writing to screens quickly.

It’s a great piece of software that promises to add a lot of charm, or silliness, to microcontroller projects. It also simplifies the use of animations, which can now be designed on computers rather than by using onboard graphics libraries. GIF really is the format that never seems to die; we’ve featured cameras dedicated to the form before. Video after the break.



Hack a Day 04 Aug 03:00

Electrochemistry at Home

A few years ago, I needed a teeny, tiny potentiostat for my biosensor research. I found a ton of cool example projects on Hackaday and on HardwareX, but they didn’t quite fulfill exactly what I needed. As any of you would do in this type of situation, I decided to build my own device.

Now, we’ve talked about potentiostats before. These are the same devices used in commercial glucometers, so they are widely applicable to a number of biosensing applications. In my internet perusing, I stumbled upon a cool chip from Texas Instruments called the LMP91000 that initially appeared to do all the hard work for me. Unfortunately, there were a few features of the LMP91000 that were a bit limiting and didn’t quite give me the range of flexibility I required for my research. You see, electrochemistry works by biasing a set of electrodes at a given potential and subsequently driving a chemical reaction. The electron transfer is measured by the sensing electrode and converted to a voltage using a transimpedance amplifier (TIA). Commercial potentiostats can have voltage bias generators with microVolt resolution, but I only needed about ~1 mV or so. The problem was, the LMP91000 has a resolution of ~66 mV on a 3.3 V supply, mandating that I augment the LMP991000 with an external digital-to-analog converter (DAC) as others had done.

However, changing the internal reference of the LMP91000 with the DAC confounded the voltage measurements from the TIA, since the TIA is also referenced to the same internal zero as the voltage bias generator. This seemed like a problem other DIY solutions I came across should have mentioned, but I didn’t quite find any other papers describing this problem. After punching myself a little, I thought that maybe it was a bit more obvious to everyone else except me. It can be like that sometimes. Oh well, it was a somewhat easy fix that ended up making my little potentiostat even more capable than I had originally imagined.

I could have made a complete custom potentiostat circuit like a few other examples I stumbled upon, but the integrated aspect of the LMP91000 was a bit too much to pass up. My design needed to be as small as possible since I would eventually like to integrate the device into a wearable. I was using a SAMD21 microcontroller with a built-in DAC, therefore remedying the problem was a bit more convenient than I originally thought since I didn’t need an additional chip in my design.

I am definitely pretty happy with the results. My potentiostat, called KickStat, is about the size of a US quarter dollar with a ton of empty space that could be easily trimmed on my next board revision. I imagine this could be used as a subsystem in any number of larger designs like a glucometer, cellphone, or maybe even a smartwatch.

Check out all the open-source files on my research lab’s GitHub page. I hope my experience will be of assistance to the hacker community. Definitely a fun build and I hope you all get as much kick out of it as I did.

Microcontrollers, Meet MicroBlocks

Physical Computing Software For Education That Runs Live, On The Microcontroller

Read more on MAKE

The post Microcontrollers, Meet MicroBlocks appeared first on Make: DIY Projects and Ideas for Makers.

Tiny Circuit Sculpture Keeps the Night Watch

If you’re planning to get into circuit sculpture one of these days, it would probably be best to start with something small and simple, instead of trying to make a crazy light-up spaceship or something with a lot of curves on the first go. A small form factor doesn’t necessarily mean it can’t also be useful. Why not start by making a small automatic night light?

The circuit itself is quite simple, especially because it uses an Arduino. You could accomplish the same thing with a 555, but that’s going to complicate the circuit sculpture part of things a bit. As long as the ambient light level coming in from the light-dependent resistor is low enough, then the two LEDs will be lit.

We love the frosted acrylic panels that [akshar1101] connected together with what looks like right angle header pins. If you wanted to expose the electronics, localize the light diffusion with a little acrylic cover that slips over the LEDs. Check it out in the demo after the break.

There’s more than one way to build a glowing cuboid night light. The Rubik’s way, for instance.

Hex Matrix Clock is Spellbinding

Just when we think we’ve seen all possible combinations of 3D printing, microcontrollers, and pretty blinkenlights coming together to form DIY clocks, [Mukesh_Sankhla] goes and builds this geometric beauty. It’s kaleidoscopic, it’s mosaic, and it sorta resembles stained glass, but is way cheaper and easier.

The crucial part of the print does two jobs — it combines a plate full of holes for a string of addressable RGB LEDs with the light-dividing walls that turn the LEDs into triangular pixels. [Mukesh] designed digits for a clock that each use ten triangles. You’d need an ESP8266 to run the clock code, or if you’d rather sit and admire the rainbow light show unabated by the passing of time, just use an Arduino Uno or something similar.

Most of the aesthetic magic here is in the printed pieces and the FastLED library. It has a bunch of really cool animations baked in that look great with this design. Check out the demo video after the break. The audio is really quiet until the very end of the video, so be warned. In our opinion, the audio isn’t necessary to follow along with the build.

The humble clock takes many lovely forms around here, including pop art.

Concentric Rings Keep this Calendar Perpetually Up to Date

The variety of ways that people find to show the passage of time never ceases to amaze us. Just when you think you’ve seen them all, someone comes up with something new and unusual, like the concentric rings of this automated perpetual calendar.

What we really like about the design that [tomatoskins] came up with is both its simplicity and its mystery. By hiding the mechanism, which is just a 3D-printed internal ring gear attached to the back of each ring, it invites people in to check it out closely and discover more. Doing so reveals that each ring is hanging from a pinion gear on a small stepper motor, which rotates it to the right point once a day or once a month. Most of the clock is made from wood, with the rings themselves made using the same technique that woodturners use to create blanks for turning bowls — or a Death Star. We love the look the method yields, although it could be even cooler with contrasting colors and grains for each segment. And there’s nothing stopping someone from reproducing this with laser-cut parts, or adding rings to display the time too.

Another nice tip in this write up is the trick [tomatoskins] used to label the rings, by transferring laser-printed characters from paper to wood using nothing but water-based polyurethane wood finish. That’s one to file away for another day.

Son of Rothult

We are continuously inspired by our readers which is why we share what we love, and that inspiration flows both ways. [jetpilot305] connected a Rothult unit to the Arduino IDE in response to Ripping up a Rothult. Consider us flattered. There are several factors at play here. One, the Arduino banner covers a lot of programmable hardware, and it is a powerful tool in a hardware hacker’s belt. Two, someone saw a tool they wanted to control and made it happen. Three, it’s a piece of (minimal) security hardware, but who knows where that can scale. The secure is made accessible.

The Github upload instructions are illustrated, and you know we appreciate documentation. There are a couple of tables for the controller pins and header for your convenience. You will be compiling your sketch in Arduino’s IDE, but uploading through ST-Link across some wires you will have to solder. We are in advanced territory now, but keep this inspiration train going and drop us a tip to share something you make with this miniature deadbolt.

Locks and security are our bread and butter, so enjoy some physical key appreciation and digital lock love.

Skee-Ball Scoring with Coin Slot Switches

Bowling is great and all, but the unpredictability of that little ball jump in Skee-Ball is so much more exciting. You can play it straight, or spend a bunch of time perfecting the 100-point shot. And unlike bowling, there’s nothing to reset, because gravity gives you the balls back.

In one of [gcall1979]’s earlier Skee-Ball machines, gravity assisted the scoring mechanism, too: each ball rolls back to the player and lands in a lane labeled with the corresponding score, which is an interesting engineering challenge in its own right. He decided to build automatic scoring into his newest Skee-Ball machine.

At the bottom of each cylinder is an arcade machine coin door switch with a long wire actuator. These had to be mounted so they’re close enough to the hole, but out of the way of the balls.

Each switch is wired up to an Arduino Mega along with four large 7-segments for the score, and a giant 7-segment to show the number of balls played. Whenever the game is reset, a servo drops a door to release the balls, just like a commercial machine.

The arcade switches work pretty well, especially once he bent the wire into hook shape to cover more area. But they do fail once in a while, maybe because the targets are full-size, but the balls are half regulation size. For the next one, [gcall1979] is planning to use IR break-beam targets which ought to work with any size ball. If you prefer bowling, you won’t strike out with break-beam targets there, either.

Bluepill Copies Code So You Don’t Have To

You really should learn to read Morse code. But if you can’t — or even if you can, and just want a break — you can always get a computer to do it. For example, [jmharvey1] has a decoder that runs on a cheap Bluepill dev board.

The device uses a touchscreen and a few common components. The whole thing cost about $16. You can see it at work along with a description of the project in the video below.

The code uses the Arduino-style setup for the Blue pill — something we’ve talked about before. As for the decoding method, the software employs the Goertzel algorithm which is akin to a single frequency Fourier transform. That is, while a full transform gives you information about the frequency component of a signal across a wide range, the Goertzel algorithm probes the signal for one or a small number of distinct frequencies.

The decoder table looks confusing at first until you realize that each “decode” value consists of a 1 as a start bit followed by a 1 for a dash and a zero for a dot. All bits to the left of the start bit don’t count. So an “E” codes as 02 hex — a start bit followed by a single zero or dot. A “C” is 1A hex (1 + -.-.). Once you find the matching code, you apply the same index to another table to look up the actual letter or string of letters.

If you buy a Bluepill to make one of these, you might as well get two and build something to send code, too.

Four on the Floor for Your Virtual Race Car

There was a time when building realistic simulations of vehicles was the stuff of NASA and big corporations. Today, many people have sophisticated virtual cockpits or race cars that they use with high-resolution screens or even virtual reality gear. If you think about it, a virtual car isn’t that hard to pull off. All you really need is a steering wheel, a few pedals, and a gear shifter. Sure, you can build fans to simulate the wind and put haptics in your seat, but really the input devices alone get you most of the way there. [Oli] decided he wanted a quick and easy USB gear shifter so he took a trip to the hardware store, picked up an arcade joystick, and tied it all together with an Arduino Leonardo. The finished product that you can see in the video below cost about $30 and took less than six hours to build.

The Leonardo, of course, has the ability to act like a USB human interface device (HID) so it can emulate a mouse or a keyboard or a joystick. That comes in handy for this project, as you would expect. The computer simply has to read the four joystick buttons and then decide which gear matches which buttons. For example up and to the left is first gear, while 4th gear is only the down button depressed. A custom-cut wooden shifter plate gives you the typical H pattern you expect from a stick shift.

Of course, the joystick doesn’t have a long handle like a true stick shift, so [Oli] added some extensions. In addition, a real shifter doesn’t require you to hold it in position as a joystick would. To rectify this, the shifter plate has magnets that grab the stick and hold it. They aren’t strong enough that you can’t move the stick, but they are strong enough to keep it from moving on its own.

We noticed that the design doesn’t allow for a clutch, so it isn’t quite the same as driving a real stick. However, [Oli] mentions several upgrades he has in mind and a clutch is one of them. Some haptics would be a cool addition so could feel the gears grind if you didn’t do the shift correctly.

The last shifter we saw like this was 3D printed. It is getting harder to find a car in the US with a manual transmission, but [Kristina Panos] is definitely a fan.