Code Craft-Embedding C++: Hacking the Arduino Software Environment

The Arduino software environment, including the IDE, libraries, and general approach, are geared toward education. It’s meant as a way to introduce embedded development to newbies. This is a great concept but it falls short when more serious development or more advanced education is required. I keep wrestling with how to address this. One way is by using Eclipse with the Arduino Plug-in. That provides a professional development environment, at least.

The code base for the Arduino is another frustration. Bluntly, the use of setup() and loop() with main() being hidden really bugs me. The mixture of C and C++ in libraries and examples is another irritation. There is enough C++ being used that it makes sense it should be the standard. Plus a good portion of the library code could be a lot better. At this point fixing this would be a monumental task requiring many dedicated developers to do the rewrite. But there are a some things that can be done so let’s see a couple possibilities and how they would be used.

Continue reading “Code Craft-Embedding C++: Hacking the Arduino Software Environment”

Christmas Bauble is neither spherical nor runs Arduino

[Jordan Wills] was tasked by his company, Silicon Labs, to build some Christmas Baubles to give away to co-workers. While the commissioned units were designed to be simple battery and LED affairs, he decided to make one of his own with bells and whistles. His Mario themed Christmas Ornament uses a Silicon Labs FM972 micro controller, capacitive sensing, PWM controlled 8 bit audio, and blinky lights.

The interesting part is some of the construction techniques that he used. The finger-joint style cube is built from circuit boards. Electrical connections between panels were routed using solder wicking copper braid. That’s a interesting trick which we’ll keep in mind along with some of our favorite creative structural uses of PCB.

The top of the cube has four LED’s which light up the Mario “Question Mark” symbols on the four sides of the cube while the base contains all of the electronics. The outside of the base piece was a large copper plane to act as the capacitive sensing element. This meant all electronics needed to be surface mounted with tracks laid out on one side – which posed some layout challenges. Adding the Capacitive sense function was a cinch thanks to support from the in-house design team. PWM output from the micro controller takes care of audio, and the output is routed through a buffer to boost the signal. A bandpass filter then cleans up the PWM output before feeding it to the speaker.

Continue reading “Christmas Bauble is neither spherical nor runs Arduino”

Reading Smart Cards from a PLC (with a Little Arduino Help)

If you’ve spent any time on a factory or plant floor, it is a good bet you’ve run into PLCs (Programmable Logic Controllers). These are rugged computers that do simple control and monitoring functions, usually using ladder logic to set their programs. [plc4u] wanted to connect a smart card reader to an Allen Bradley PLC, so he turned to an Arduino to act as a go-between.

The Arduino talks to a USB card reader using a USB host shield. Then it communicates with the PLC using an RS232 link and the DF1 protocol that most Allen Bradley PLCs understand. You may not need a smart card, but once you know how to communicate between an Arduino and the PLC, you could do many different projects that leverage other I/O devices and code available on the Arduino and connects to existing PLC installations. Just remember that you’ll probably need to ruggedize the Arduino a bit to survive and be safe to the same level as a PLC (which might include a NEMA enclosure or even an explosion-proof box).

Continue reading “Reading Smart Cards from a PLC (with a Little Arduino Help)”

Ball Balancing Arduino-Style

If you have a good sense of balance, you can ride a unicycle or get on TV doing tricks with ladders. We don’t know if [Hanna Yatco] has a good sense of balance or not, but we do know her Arduino does. Her build uses the ubiquitous HC-SR04 SONAR sensor and a servo.

This is a great use for a servo since a standard servo motor without modifications only moves through part of a circle, and that’s all that’s needed for this project. A PID algorithm measures the distance to the ball and raises or lowers a beam to try to get the ball to the center.

Continue reading “Ball Balancing Arduino-Style”

Encryption for Arduino with Spritz user [Abderraouf] has written an implementation of the new(ish) Spritz cipher and hash for Arduino. While we’re not big enough crypto-nerds to assess the security of the code, it looks like it’s going to be pretty handy.

Spritz itself is a neat cipher. Instead of taking in fixed blocks of data and operating on them, it allows you to process it in (almost) whatever chunks it comes in naturally, and then extract out the encrypted results piecewise. It works both as a two-way cipher and as a one-way hash function. It looks like Spritz is a one-stop-shop for all of your encryption needs, and now you can run it on your Arduino.

In case you are afraid of new implementations of new ciphers (and you should be), Spritz’s pedigree should help to put you at ease: it was developed by [Ron Rivest] to be a successor to his RC4 algorithm, and it incorporates a lot of the lessons learned about that algorithm over the past. This doesn’t exclude subtle flaws in the implementation of the library (no offence, [Abderraouf]!) or your work downstream, but at least the underlying algorithm seems to be the real deal.

[Abderraouf] links it in his writeup, but just for completeness, here’s the Spritz paper (PDF). What crypto libraries do you currently use for Arduino or microcontroller projects? We’ve been fans of XXTEA for ages, but more because it’s simple and small than because it’s secure. Spritz may be simple enough to implement easily, and still more secure. Sweet.

Light Duty Timekeeping: Arduino Berlin Clock

Just when we thought we’d seen all the ways there are to tell time, along comes [mr_fid]’s Berlin clock build. It’s based on an actual clock commissioned by the Senate of Berlin in the mid-1970s and erected on the famous Kurfürstendamm avenue in 1975. Twenty years later it was decommissioned and moved to stand outside the historic Europa-center.

This clock tells the time using set theory and 24-hour time. From the top down: the blinking yellow circle of light at the top indicates the passing seconds; on for even seconds and off for odd. The two rows of red blocks are the hours—each block in the top row stands for five hours, and each block below that indicates a single hour. At 11:00, there will be two top blocks and one bottom block illuminated, for instance.

The bottom two rows show the minutes using the same system. Red segments indicate 15, 30, and 45 minutes past the hour, making it unnecessary to count more than a few of the 5-minute top segments. As with the hours, the bottom row indicates one minute per light.

Got that? Here’s a quiz. What time is it? Looking at the picture above, the top row has three segments lit. Five hours times three is 15:00, or 3:00PM. The next row adds two hours, so we’re at 5:00PM. All of the five-minute segments are lit, which adds 55 minutes. So the picture was taken at 5:55PM on some even-numbered second.

The original Berlin clock suffered from the short lives of incandescent bulbs. Depending on which bulb went out, the clock could be ‘off’ by as little as one minute or as much as five hours. [mr_fid] stayed true to the original in this beautiful build and used two lights for each hour segment. This replica uses LEDs driven by an Arduino Nano and a real-time clock. Since the RTC gives hours from 0-23 and minutes and seconds from 0-59, a couple of shift registers and some modulo calculations are necessary to convert to set theory time.

[mr_fid] built the enclosure out of plywood and white oak from designs made in QCAD. The rounded corners are made from oak, and the seconds ring is built from 3/8″ plywood strips bent around a spray can. A brief tour of the clock is waiting for you after the break. Time’s a-wastin’!

Continue reading “Light Duty Timekeeping: Arduino Berlin Clock”

Arduino Powered Knife-Wielding Tentacle will Leave You in Stitches

Writing articles for Hackaday, we see funny projects, and we see dangerous projects. It’s rare to find a project which combines the two. This one somehow manages to pull it off. [Outaspaceman] is familiar with LittleBits, but he’s just starting to learn Arduino programming. He completed the blink tutorial, but blinking an LED just wasn’t enough fanfare for the success of his first Arduino program. He connected the Arduino Mega’s LED output to a pair of LittleBits which then switch a servo between two positions. A bare servo wouldn’t be much fun, so [Outaspaceman] connected a tentacle and a small Swiss army knife. Yes, a knife.

The tentacle in question is designed to be a finger puppet. There’s something about a tentacle waving a knife around that is so hilarious and absurd that we couldn’t help but laugh. We’re not alone apparently, as this video has gone viral with over 1 million views. It’s almost like a violent revenge of the most useless machine. For the technically curious, the tentacle’s seemingly random motion is analogous to that of the double pendulum.

Our readers will be happy to know that [Outaspaceman] has made it to the Arduino servo tutorial, and is now controlling the servo directly, no LittleBits needed. We just hope he has a good way to turn his creation off – without the need for stitches.

Continue reading “Arduino Powered Knife-Wielding Tentacle will Leave You in Stitches”