Code Craft: When #define Is Considered Harmful

An icon of Computer Science, [Edsger Dijkstra], published a letter in the Communications of the Association of Computer Machinery (ACM) which the editor gave the title “Go To Statement Considered Harmful“. A rousing debate ensued. A similar criticism of macros, i.e. #define, in C/C++ may not rise to that level but they have their own problems.

Macros are part of the preprocessor for the C/C++ languages which manipulates the source code before the actual translation to machine code. But there are risks when macros generate source code. [Bjarne Stroustrup] in creating C++ worked to reduce the need and usage of the preprocessor, especially the use of macros. In his book, The C++ Programming Language he writes,

Don’t use them if you don’t have to. Almost every macro demonstrates a flaw in the programming language, in the program, or in the programmer.

As C retrofitted capabilities of C++, it also reduced the need for macros, thus improving that language.

With the Arduino using the GNU GCC compilers for C and C++ I want to show new coders a couple of places where the preprocessor can cause trouble for the unwary. I’ll demonstrate how to use language features to achieve the same results more cleanly and safely. Of course, all of this applies equally when you use any of these languages on other systems.

We’re only going to be looking at macros in this article but if you want to read more the details about them or the preprocessor see the GNU GCC Manual section on the preprocessor.

Continue reading “Code Craft: When #define Is Considered Harmful”

Show A Quadcopter Flight On Google Earth For Under Ten Bucks

[Joop Brokking] wanted to know where his quadcopter was and had been. He thought about Google Earth, but assumed it would be difficult to get the GPS data and integrate it with Google’s imagery. But he discovered it was easier than he thought. He wound up spending around $10, although if his ‘copter didn’t already have GPS, it would have been more.

Hardware-wise, [Joop] made a pretty straightforward data logger using a small Arduino (a Pro Mini) and an SD Card (along with an SD breakout board). With this setup, NMEA data from the GPS comes in the Arduino’s serial port and winds up on the SD Card.

Continue reading “Show A Quadcopter Flight On Google Earth For Under Ten Bucks”

Hacklet 80 – Gigahertz Projects

Somewhere between the HF projects many of us have worked on, and the visible light spectrum lies the UHF, EHF, SHF, and THF. That’s Ultra, Extremely, Super, and Tremendously High Frequency for those who aren’t in the know. All of them involve frequencies in the gigahertz and terahertz range. While modern computers have made gigahertz a household term, actually working with signals in the gigahertz frequency range is still a daunting prospect. There have always been an elite group of hackers, makers, and engineers who tinker with projects using GHz frequencies. This week’s Hacklet is about some of the best GHz projects on Hackaday.io!

radar1We start with [Luke Weston] and Simple, low-cost FMCW radar. For years people like Hackaday’s own [Gregory L. Charvat] have been building simplified radar systems and documenting them for the rest of us. [Luke’s] goal is to make radar systems like this even more accessible for the average hacker. He’s put all the specialized parts on one board. Rather than large Mini Circuits modules, [Luke] went with Hittite microwave parts in chip scale packages. Modulation comes from a Microchip MCP4921 mixed signal DAC. The system works, and has demonstrated transmission and reception 5 GHz to 6 GHz bands. [Luke] has even demonstrated detection of objects at close range using a scope.

Continue reading “Hacklet 80 – Gigahertz Projects”

Intel And Arduino Introduce Curie-Based Educational Board

This week, Intel and Arduino are releasing their first product pushed directly on the education market, the Arduino/Genuino 101 board powered by the Intel Curie module.

The Intel Curie Module

genuino101The Arduino/Genuino 101 is the first development platform for the Intel Curie modules which are a recent development from Intel’s Maker and Innovator group. The button-sized Curie is a single package encapsulating microcontroller, Bluetooth, a 6-DOF IMU, and battery charging circuitry; the requisite hardware for anything marketed as a ‘wearable’. The Curie’s brain is a 32-bit Intel Quark microcontroller with 384kB of Flash 80kB SRAM, giving it about the same storage and RAM as a low-end ARM Cortex microcontroller.

Called a module, it needs a carrier board to interface with this hardware. This is where the Arduino/Genuino 101 comes in. This board – the third such collaboration between Intel and Arduino – provides the same form factor and pinout found in the most popular Arduino offering. While the Curie-based Arduino/Genuino 101 is not replacing the extraordinarily popular Arduino Uno and Leonardo, it is going after the same market – educators and makers – at a similar price, $30 USD or €27. For the same price as an Arduino Uno, the Arduino/Genuino 101 offers Bluetooth, an IMU, and strangely the same USB standard-B receptacle.

Intel has further plans in store for the Curie module; In 2016, Intel, [Mark Burnett] of reality television fame, and United Artists Media group will produce America’s Greatest Makers, a reality show featuring makers developing wearable electronics on TV. No, it’s not Junkyard Wars, but until the MacGyver reboot airs, it’s the closest we’re going to get to people building stuff on TV.

Intel’s Prior Arduino Offerings

In 2013, Intel and Arduino introduced the Galileo board, a dev board packed with I/Os, Ethernet, PCIe, and an Intel instruction set. This was a massive move away from all ARM, AVR, or PIC dev boards made in recent years, and marked Intel’s first foray into the world of education, making, and an Internet of Things. In 2014, Intel and Arduino released the Edison, a tiny, tiny board designed for the embedded market and entrepreneurs.

Intel CurieThe Arduino 101 and Genuino 101 – different names for the same thing and the first great expression of arduino.cc’s troubles with trademarks and the Arduino vs Arduino war – are targeted specifically at the ‘maker’ market, however ephemeral and hard to define that is. The form of the Arduino 101 follows directly in the footsteps of the Arduino Uno and Leonardo; The 101 has the same footprint, the same pinout, a single USB port as the Leonardo.

Being the ‘maker market Arduino’, this board is designed to bring technology to the classroom. In a conference earlier this week, [Massimo] framed the Arduino 101 as the educational intersection between technology, coding, art, and design. Students who would not otherwise learn microcontroller development will learn to program an Arduino for art and design projects. The Arduino/Genuino 101 is the board that puts the STEAM in STEM education.

Where the Curie is Going

Intel has big plans for the Curie module, with a few products in the works already. The Intel Edison has made its way into consumer electronics and wearables, including an electronic ski coach that will tell you when to pizza and when to french fry. The Curie will be available independently of the Arduino/Genuino 101, with both products being released in early 2016.

Random Parcel Launches Steganographic Compulsion

A mysterious CD arrives in the mail with a weird handwritten code on it. What should you do? Put it in the computer and play the thing, of course!

Some might be screaming at their screens right now… this is how modern horror films start and before you know it the undead are lurking behind you waiting to strike. Seasonal thrills aside, this is turning into an involved community effort to solve the puzzle. [Johny] published the video and posted a thread on reddit.

We ran a similar augmented reality game to launch the 2014 Hackaday Prize solved by a dedicated group of hackers. It’s really hard to design puzzles that won’t be immediately solved but can eventually be solved with technology and a few mental leaps. When we come across one of these extremely clever puzzles, we take note.

This has all the hallmarks of a good time. The audio spectrogram shows hidden data embedded in the file — a technique known as steganography. There are some real contortions to make meaning from this. When you’re looking for a solution any little hit of a pattern feels like you’ve found something. But searching for the decrypted string yields a YouTube video with the same name; we wonder if they’ve tried to recover steganographic data from that source?

[Johny] mentions that this parcel was unsolicited and that people have suggested it’s a threat or something non-sensical in its entirety. We’re hoping it’s a publicity stunt and we’re all disappointed in the end, because solving the thing is the best part and publicity wouldn’t work if there was no solution.

The bright minds of the Hackaday community should be the ones who actually solve this. So get to work and let us know what you figure out!

73 Computer Scientists Created A Neural Net And You Won’t Believe What Happened Next

The Internet is a strange place. The promise of cyberspace in the 1990s was nothing short of humanity’s next greatest achievement. For the first time in history, anyone could talk to anyone else in a vast, electronic communion of enlightened thought, and reasoned discourse. The Internet was intended to be the modern Library of Alexandria. It was beautiful, and it was the future. The Internet was the greatest invention of all time.

Somewhere, someone realized people have the capacity to be idiots. Turns out nobody wants to learn anything when you can gawk at the latest floundering of your most hated celebrity. Nobody wants to have a conversation, because your confirmation bias is inherently flawed and mine is much better. Politics, religion, evolution, weed, guns, abortions, Bernie Sanders and Kim Kardashian. Video games.

A funny thing happened since then. People started to complain they were being pandered to. They started to blame media bias and clickbait. People started to discover that headlines were designed to get clicks. You’ve read Moneyball, and know how the use of statistics changed baseball, right? Buzzfeed has done the same thing with journalism, and it’s working for their one goal of getting you to click that link.

Now, finally, the Buzzfeed editors may be out of a job. [Lars Eidnes] programmed a computer to generate clickbait. It’s all done using recurrent neural networks gathering millions of headlines from the likes of Buzzfeed and the Gawker network. These headlines are processed, and once every twenty minutes a new story is posted on Click-O-Tron, the only news website you won’t believe. There’s even voting, like reddit, so you know the results are populist dross.

I propose an experiment. Check out the comments below. If the majority of the comments are not about how Markov chains would be better suited in this case, clickbait works. Prove me wrong.

Bell Clock Ain’t Your Grandfather’s

Here’s a rather obscure clock that rings your bell. Literally. It’s a minimalist approach to the grandfather chime.

bell-striker-relayYou’ll want to check out the video below to see the electronic base very nonchalantly striking the bottom of the handbell. It makes a nice ring and brings a smile to your face at how clever [Iam5volt] was with the fabrication. There aren’t any hints available on that video, but we searched around and found the original build details published about 5 years ago. The striker is a hacked mechanical relay!

The case of the relay is removed. A piece of stiff steel wire is affixed to swing along with the relay’s switch. This way, when current is applied to the proper inputs of the relay, the wire moves and a small screw head at the end strikes the bell. See what we mean by clever?

[Iam5volt] built this second revision of the clock in answer to our call for building clocks for social good. The display-free clock chimes the hour using a bell and only has a single button  to reset time to HH:00:00

Continue reading “Bell Clock Ain’t Your Grandfather’s”