Category Archives: Aggregated

Introducing Raspberry Pi HATs

via Raspberry Pi

Just over two weeks ago, we announced the new Raspberry Pi B+ with immediate availability. We’ve been very pleased at the response from the community and press about the B+, and most people seem to appreciate why we decided to evolve the Model B in the way we did – lots of you have been in touch to tell us how much you’re enjoying your new B+.

There are many great new features built into the B+, but today we want to talk about one new feature we are particularly excited about.

One of the brilliant things about the Raspberry Pi has always been the ability to attach physical hardware to the Raspberry Pi’s GPIO (General Purpose Input/Output) connector. There are so many third party add-on boards that attach to the Raspberry Pi and extend its functionality: motor controllers, LEDs, buttons, sensors, microcontrollers, LCDs, ADCs and DACs; you name it, someone has almost certainly created an add-on board that makes it usable with the Raspberry Pi.


Model B’s 26W vs Model B+’s 40W GPIO connectors

On the Raspberry Pi models A and B, the GPIO connector has 26 pins. Users attaching an add-board to the model A or B Pi usually have to work out which drivers are required for their specific board, and then edit the relevant Linux files to make them load at boot time before the board is usable (or load them by hand from the command line). The Raspberry Pi has no knowledge of whether it has a board attached or not, and the various drivers, when loaded, will simply assume that they can make exclusive use of the GPIO interface. Most of the time this all works OK, but it can be a bit challenging for new users. Linux drivers blindly assuming GPIO pins are available can also occasionally cause confusion.

The Raspberry Pi B+ has been designed specifically with add-on boards in mind and today we are introducing ‘HATs’ (Hardware Attached on Top). A HAT is an add-on board for B+ that conforms to a specific set of rules that will make life easier for users. A significant feature of HATs is the inclusion of a system that allows the B+ to identify a connected HAT and automatically configure the GPIOs and drivers for the board, making life for the end user much easier!

Before we go any further, it is worth noting that there are obviously a lot of add-on boards designed for the original model A and B boards (which interface to the original 26 way GPIO header). The first 26 pins of the B+ GPIO header are identical to those of the original models, so most existing boards will still work. We are not breaking compatibility for existing boards; we’re creating a specification that B+ add-on board designers can follow (if they so wish), which is designed to make end users’ lives much easier.

So what is a HAT?


B+ sporting a (mechanical sample of a) HAT and showing camera and display connections

In a nutshell a HAT is a rectangular board (65x56mm) that has four mounting holes in the (nicely rounded) corners that align with the mounting holes on the B+, has a 40W GPIO header and supports the special autoconfiguration system that allows automatic GPIO setup and driver setup. The automatic configuration is achieved using 2 dedicated pins (ID_SD and ID_SC) on the 40W B+ GPIO header that are reserved for an I2C EEPROM. The EEPROM holds the board manufacturer information, GPIO setup and a thing called a ‘device tree‘ fragment – basically a description of the attached hardware that allows Linux to automatically load the required drivers.

What we are not doing with HATs is forcing people to adopt our specification. But you can only call something a HAT if it follows the spec.

So why are we bothering with all this? Basically, we want to ensure consistency and compatibility with future add-on boards, and to allow a much better end-user experience, especially for less technically aware users.

The HAT specification is available on GitHub for those wishing to design add-on boards for the B+. As previously explained, there is no requirement to follow the HAT specification, but we encourage people to think about following it if possible, as it will make the world a better place for end users.

One final bit of good news:  we have used a surface mount connector on our internal prototype HAT which works very nicely. As you can see from the pictures it solders to the top of the board and then fits over an extension header (the extension header pins push through the HAT from underneath). As the extension headers push through like this it is possible to either use a short, flush mounting extension or a version with longer pins that poke out above the HAT and allow further access to the GPIO pins for debugging.


HAT using extender with longer pins

For HAT designers wanting to use these connectors, we have secured discounted pricing through Toby Electronics. The connector part numbers are:

Toby tell us they are getting stock in now, which should arrive for the 5th August.

Please post technical questions about the specification to the forum.

Arduino Trick: Double Upload Speed

via SparkFun Electronics Blog Posts

“Double your upload speed” sounds like a spammy internet site. There is however a really simple way to double the speed you upload to your Arduino.

Arduino Preferences

Deselect Verify code after upload in the preferences window and click ok. That’s it. Don’t believe me? Open this big sketch that takes up ~30k of flash (nearly all the flash on a standard Uno). With the box checked it will take about 24 seconds to upload the file. With the box unchecked it will take about 13 seconds.

What’s going on here? By default the Arduino IDE verifies that everything was written correctly:

Program Step:

Arduino IDE: Hey
Uno: Oh hi
Arduino IDE: I've got some new code for you
Uno: Great! Send it to me
Arduino IDE: Here it is... [30k of bytes]
Uno: Got it, thanks!

Verify Step:

Arduino IDE: Hey
Uno: Oh hi
Arduino IDE: I'm not sure I trust you got everything correctly. Send your flash to me.
Uno: Ok, here it is... [30k of bytes]
Arduino IDE: [Compares Arduino bytes to original bytes] Hmm, looks ok. Please proceed.

This is how almost all programming routines work: send the code then verify if there were any errors during transmission. By skipping the verification step you reduce the number of bytes that have to be passed back and forth by half. What you may not realize is that there are at least two other error checks: one at the bootloader level (each frame of the STK500 bootloader has a cyclic redundancy check) and even lower at the USB to serial communication level (each USB frame has a CRC). If any communication gets corrupted it is caught and corrected at these levels. It is highly unlikely1 that your sketch will be recorded incorrectly to the Arduino when you hit Upload.

Why does this matter?

Many sketches are a few thousand bytes so turning off verification will only save you a few seconds per upload. But how many times do you upload a sketch when you’re working on a project? 10 times? 50? It’s more than you might like to admit. And how many projects might you work on? I’ve probably uploaded tens of thousands of sketches over the past few years. Now multiply by all the Arduino users out there and you end up with a tremendous amount of wasted time.

Nathan: 25 sketch uploads * 100 days a year * 6 years = 15,000 uploads
Time wasted: Avg time savings of 5 seconds per upload * 15,000 uploads = 75,000s = 1250min = 20 hours
Arduino users (wild guess): 3,000,000 * 20 hours = 60,000,000 hrs = 2.5m days = 6,849 years of wasted time

These numbers are obviously unscientific but you get the idea. We’ll all be better off by spending less time watching the TX and RX LEDs blink.

Times when you might want verification

Verification failure error

What a failed verification looks like in Arduino IDE

There are times when you may want to verify your code. If you’re going to deploy your Arduino into a satellite or into a final project you may sleep better knowing the code is correct. If you’ve got an extraordinary connection to an Arduino like a 50ft USB cable or a 2km connection over RS485 you may want to verify after upload. It’s still unlikely an error will slip through the CRCs so use your own judgement.

What boards does this trick work on?

This works with any Arduino that uses a serial to USB IC (Uno, Pro Mini, LilyPad Simple, Fio, etc). These boards all use the same avrdude bootloader that use the verification flag by default.

Any board using the Catarina booloader (Leonardo, Micro, etc) or the Halfkay bootloader (Teensy boards) have much faster bootloaders that don’t see much, if any speed advantage.

[1] It’s perhaps better than 1 in a million but I’m not sure how to calculate the odds so please let me know if it has been. In 11 years of hammering on microcontrollers with serial bootloaders I’ve never seen an incorrect record to flash. Any firmware errors were always because of my own fault or faulty bootloader design.

Save time, trust your toolchain, and uncheck the box!

comments | comment feed

Sonic Pi Competition

via Raspberry Pi

Coding music on a Raspberry Pi with Sonic Pi has quickly become a great way to learn programming concepts and to pump out some thumping beats. Last year I worked with Dr Sam Aaron, live coder and academic at the University of Cambridge, to teach KS3 pupils text-based programming on Raspberry Pis as part of their ICT & Computing lessons. Since then Sonic Pi has proved incredibly popular in classrooms worldwide. The scheme of work we used is available for free in the ‘Teach’ section of our resources for any educator wanting to teach computer programming in a fun way.


Since our classroom collaboration, Sam has been busy working on Sonic Pi version 2.0 and together we have been wowing attendees of Picademy with the potential of Sonic Pi for the classroom. We have also been working on Sonic Pi: Live & Coding, a digital research project to turn a Raspberry Pi into a musical instrument with Sonic Pi, working with schools, artists, academics and the Cambridge Junction, which will culminate in a Sonic Pi: Live & Coding Summit this November. In fact, this week at the Cambridge Junction, 60 children have been participating in the project, having coding music battles, and jamming with musicians.

Sonic Pi

Push Sam’s buttons and watch his eyes pop at Sonic Pi Live and Coding!

To coincide with the summit, we will be launching a Sonic Pi: Live & Coding competition in September to find the best original sonic pi composition created by a child or young person in three age categories. We will have a significant number of Raspberry Pis to give away at random for those who take part, and the semi-finalists of the competition will be invited to perform their original work live at the summit in November in front of an audience and panel of judges to potentially be crowned the first ever Sonic Pi Competition winner!

So what are you waiting for? Download Sonic Pi version 2 for your Raspberry Pi by following these instructions, and then take a look at the Sonic Pi 2 article by Sam in the MagPi magazine, and our new Sonic Pi Version 2 Getting Started resource. Take this opportunity to practice and get a head start on the competition!

Get your pratice in for the Sonic Pi version 2 competition with our new resource.

Get your practice in for the Sonic Pi version 2 competition with our new resource.

Why the NSA Can’t Listen to His Mixtape – Interview with David Huerta

via Arduino Blog


David Huerta is a technologist who recently published a provocative work to make everyone think a little bit more about privacy and what governments should be allowed to do or not:

I work outside the Pokemon business model of catching every user’s data or abusing it for state surveillance. I work instead surrounded by priceless art and in giving it a voice inside and outside the thick, Faraday cage walls of the museum it lives in.

He created an encrypted mixtape and sent it to NSA. The device runs on Arduino and other open hardware and for David is a:

machinery that can be trusted not to spy on you because of the disclosure of its design, schematics and bill of materials to anyone who wishes to inspect, build, or build upon the device. The device contains a soundtrack for the modern surveillance state. It’s designed to be enjoyed only by people I have consented it to be listened to. A second copy of this device will also be sent to the NSA’s headquarters in Maryland, but without the private key needed to decrypt it; a reminder that the rules of mathematics are more powerful than the rules of even the most powerful states.

We got in touch with him and was happy to answer a couple of questions for the blog:

Z: What makes you more uncomfortable about NSA actions which made you react and build this device?

D: The NSA’s mass surveillance encompasses a lot of programs which run counter to what I feel is a fundamental right to privacy. In the US Constitution there’s an expression of that in its fourth amendment.
What the NSA is doing goes against the spirit of that much like petting a cat backwards; It’s the wrong direction to go towards and a cat/society will swipe its paw at the offender.


Z: Arduino community is always interested in understanding how things are made. Where we can find source code and technical specs to build one? It would be great if we all could share more practical knowledge on these topics.

D: The mixtape device is basically just an Arduino and Adafruit wave shield. The code to play each wave file on the SD card on a loop (when unencrypted) is right off their list of examples.
I made one slight modification, which is to turn on a purple LED to indicate when it’s working. Purple is not an easy LED color to source, but it’s the global Pirate Party color and I wanted to give them subtle props for working towards a free and secure internet on the policy side of things.

I will at some point publish a way to do the encryption part of this using a Beaglebone Black and CryptoCape to make it a fully open hardware proof-of-concept, but in this case the SD card encryption was done off-device. I also plan on going through a full tutorial based on that at this year’s Open Hardware Summit in Rome.

Z: You said: “The NSA can read my stupid Facebook updates but without my consent it will never be able to listen to my kick-ass mix tape, even if it’s sitting right in front of them.” – What makes you believe that your encryption is strong enough?

D: The truth is that everyone sucks at information security, including myself, so no one can really make the claim something they’ve built is “NSA-proof.” Generally though, the less hardware and software you have, the less complexity and thus, opportunity for attack vectors or human errors there are. The playlist was kept offline, is not on the Arduino sketch, or anywhere in the hardware except encrypted in the SD card. The only place the audio existed aside from in the various sources I collected it from was on the hard drive of the PC I used to compose the mix tape, which has since been removed and stored offsite and offline. The encryption was also ran by a different machine, and one that I generally keep on my person. This goes beyond mass surveillance capabilities and into TAO/FBI “partyvan” surveillance; I can’t imagine an intelligence analyst is going to go to their very serious boss to explain that they need to expense a vehicle to go after some guy’s mix tape in a city where they won’t even be able to find a parking spot close enough to run a tempest attack from.

ZDo you have the pictures of the inside showing the components and the circuits?

D: They’re not too exciting since its just the Arduino + Wave Shield, but I attached a photo of the unencrypted version (clear acrylic instead of red clear acrylic), which I’ll also be bringing with me to the Open Hardware Summit.



Looking forward to meet him at Open Hadware Summit!

We Love Libraries!

via SparkFun Electronics Blog Posts

Last week, the Longmont Public Library invited my co-worker, Angela and me to teach one of our favorite, fun workshops called the e-Textile Art Pin at their Stay Curious This Summer event series.


The workshop was open to the public, and about 35 people showed up to participate. The attendees were from all different walks of life - some with a knack for technology and others not as much, but it didn’t matter. The greatest part about the evening was that every person successfully created a pin. It was our main mission for teaching that night. It didn’t matter where the person came from or what his or her background was. Everyone there had the motivation to try something new and succeeded at it. What’s great about this activity is that it shows you the basics of circuitry and how to sew, but it also offers up a tangible project that can be taken home at the end of the day. It’s a great way to get people interested in electronics and is an easy to grasp, quick, hands-on activity that delivers eye catching results.

Amanda's dragon pin

Within the last year or so the education department at SparkFun has been working more diligently with many libraries all over the country. We’ve been implementing professional development workshops for librarians and integrating SparkFun kits into library systems for patrons to check out and tinker with. We’ve worked with libraries near and far ranging from Los Angeles Public Libraries to The High Plains Library District in Colorado, Arlington Heights Memorial Library in Illinois, Varnum Memorial Library in Vermont, Chattanooga Public Library in Tennessee and many more. Our goal is to infiltrate our communities with easy access to emerging technology.

Let us know if you’re interested in becoming involved with these kinds of opportunities - we’d love to help!

While I’m at it here’s a picture of my dog. She really likes to exploit her cuteness on the internet.




comments | comment feed

July Caption Contest

via SparkFun Electronics Blog Posts

July is drawing to a close, so let’s sneak a quick caption contest in before it’s too late.

  • Leave your funniest clean caption to the photo in the comments section below. We reserve the right to delete captions that we deem inappropriate. We’re not too stingy, but try to keep it moderately PG-13.
  • Captions submitted any other way besides in the comment section will not be accepted! That means do not use the feedback form!
  • Captions will be accepted from the moment this post goes live until Friday, August 2nd at 10 a.m. Mountain Time.
  • A crack team of humor experts will pick the winner and we will announce it next week.

Here’s the photo:

alt text

The winner will receive $100 in SparkFun credit to buy anything on the site! Good luck and may the best caption win!

comments | comment feed

Submit your application to the Raspberry Pi Education Fund

via Raspberry Pi

Got a great idea or project to teach kids about computing?

Need some help raising the finance to make it a reality?

We have some good news: the Raspberry Pi Education Fund is finally open for applications. As a reminder, thanks to all the Raspberry Pis bought by the community over the past 2 years, we have been able to put together a £1 million education fund to help fulfil our charitable mission.

Applications are invited from organisations looking to fund projects that encourage young people to learn about computing or illustrate how computing can be used enhance education in STEM or the creative arts.  You can find more details on the eligibility criteria and submit your application here.


Coding Marathon at the Cambridge Centre of Computing History sponsored by Raspberry Pi Foundation

Go on, what are you waiting for? This is your chance to make a difference.

Changing Unipolar Steppers To Bipolar

via Hackaday » » hardware


If you’ve been a good little hacker and have been tearing apart old printers like you’re supposed to, you’ve probably run across more than a few stepper motors. These motors come in a variety of flavors, from the four-wire deals you find in 3D printer builds, to motors with five or six wires. Unipolar motors – the ones with more than four wires – are easier to control, but are severely limited in generating torque. Luckily, you can use any unipolar motor as a more efficient bipolar motor with a simple xacto knife modification.

The extra wires in a unipolar motor are taps for each of the coils. Simply ignoring these wires and using the two coils independently makes the motor more efficient at generating torque.

[Jangeox] did a little experiment in taking a unipolar motor, cutting the trace to the coil taps, and measuring the before and after torque. The results are impressive: as a unipolar motor, the motor has about 380 gcm of torque. In bipolar mode, the same motor has 800 gcm of torque. You can check that video out below.

Filed under: hardware

SparkFun Rummage Giveaway

via SparkFun Electronics Blog Posts

As you may have heard by now, SparkFun is moving soon! Not far actually - just a mile or two north of where we are now. But, as it turns out, we’ve acquired quite a bit of stuff while in our current building and over the last few weeks we’ve been doing some serious cleaning efforts. Which brings us to today’s giveaway - the Rummage Giveaway!

We’ve found a lot of old kits, parts, unused swag and other goodies around. So we’re taking the best of it, boxing it up and sending it out! Are you interested in winning the gear? Entering is simple.

alt text

We’ve created a very quick two-question survey (three questions if you count the one asking for your email address so we can contact you if you win). Simply answer the two questions and you’re entered to win! If you’d rather not answer the questions (though we’d love if you would), just put whatever you want in the answer boxes and provide your email - you don’t have to answer to be entered.

We’re going to collect responses for the next week (from the time this post goes live until 9 a.m. MT on Monday, August 4th). Then we will randomly select four winners and send them their boxes of gear! Good luck!

comments | comment feed

Fritzing is out with a new release including Arduino Yún microcontroller!

via Arduino Blog

Fritzing is an open-source hardware initiative that makes electronics accessible as a creative material for anyone. You can easily learn how to build a circuit for you project and also design your own PCB.

Last week, the Fritzing team announced the new release with a number of new parts, especially a number of popular microcontrollers, among which also Arduino Yún:

We have upgraded to their latest version Qt5, which brings stability and speed improvements (especially for Mac OS X users). This also enables us to port fritzing to Android, iOS, etc.

You can download Fritzing 0.9.0b at this link.


100 years since World War I: build a Morse code virtual radio

via Raspberry Pi

On this day 100 years ago, Austria-Hungary declared war on Serbia in response to the assassination of the heir to the Austro-Hungarian throne. As the dominos began to tumble Russia mobilised against Austria-Hungary, causing Germany to declare war on Russia. Germany then invaded Luxembourg and declared war on France; and on the 4th of August the United Kingdom declared war on Germany. So began one of the bloodiest conflicts in human history, that would draw in all of the great economic powers of the world, lasting until November the 11th 1918.

A century later the effect of this war is still with us. Every one of us has some kind of connection to it, whether it be an impact on our family history or on the place we live. This year events are taking place all over the world to commemorate and remember the millions of people who lost their lives. You can visit to find out more.

QST May 1942

The cover of QST magazine showing a call for women radio operators.

We expect lots of schools will be taking part in these events, and in the spirit of commemoration we have put together an educational resource called the Morse Code Virtual Radio. This allows you to simulate and experience the main form of radio communication that was used back then, using your Raspberry Pi. If you have an ancestor who was an ex-telegraph operator or world war serviceman, you may have an old Morse Code key in your attic which you could use.

antique key

An antique Morse Code key.

Invented by Samuel Morse in the year 1836, Morse Code is a method for sending and receiving text messages using short and long tones. It was adapted for early radio communication, before it was possible to send or receive voice, and was used extensively during both world wars.

Morse Code is also a really great skill to have. There is a very human element to it which is difficult to quantify and describe. Human skill is required to key in Morse Code correctly which takes only minutes to learn, but a lifetime to master. Skill is also required to listen to the tones and decode them. Our educational resource provides learning opportunities for both aspects.

Want to have a go? You’ll find everything you need here on our resources pages.

An Automated Flappy Bird Player

via Hackaday » » hardware

game Flappy Bird has been ported to just about every system imaginable, including but not limited to the Apple II, Commodores, pretty much every version of the Atari, and serves as a really great demonstration of the TI-99’s graphics capabilities. Porting is one thing, but having a computer automate Flappy Bird is another thing entirely. [Ankur], [Sai], and [Ackerly] in [Dr. Bruce Land]‘s advanced microcontroller design class at Cornell have done just that. They’re playing Flappy Bird with a camera, FPGA, and a penny wired up to a GPIO pin to guide the little 8-bit-bird through Mario pipes.

The setup the team is using consists of a webcam that records the screen of a smartphone, an FPGA, and a little bit of circuitry to emulate screen taps. Inside the FPGA, the team is looking at the video stream from the phone to detect the bird, pipes, and gaps. The ‘tapper’ unit is a US penny, placed right above the ‘tap’ button, wired to a GPIO port. This was found to be the ideal contact for a capacitive touch screen – taps that were too small weren’t registered, and taps that were too big registered as two taps.

For spending an entire semester on automating Flappy Bird, the team has a lot of knowledge to show for it, but not the high score: the bird only makes it through the first pipe 10% of the time, and the second pipe 1% of the time. The high score is three. That’s alright – getting the algorithm right to play the game correctly was very, very difficult, and to nail that problem down, they estimate it would take at least another semester.

Filed under: hardware

A Router-Based Dev Board That Isn’t A Router

via Hackaday » » hardware

Here’s somethirouterng that be of interest to anyone looking to hack up a router for their own connected project or IoT implementation: hardware based on a fairly standard router, loaded up with OpenWRT, with a ton of I/O to connect to anything.

It’s called the DPT Board, and it’s basically an hugely improved version of the off-the-shelf routers you can pick up through the usual channels. On board are 20 GPIOs, USB host, 16MB Flash, 64MB RAM, two Ethernet ports, on-board 802.11n and a USB host port. This small system on board is pre-installed with OpenWRT, making it relatively easy to connect this small router-like device to LED strips, sensors, or whatever other project you have in mind.

The board was designed by [Daan Pape], and he’s also working on something he calls breakoutserver There’s a uHTTP server written specifically for the board that allows any Internet connected device to control everything on the board. There’s also an HTML5 app they’re developing which could be pretty interesting.

All in all, it’s a pretty cool little device that fits nicely in between the relatively simplistic ‘Arduino with an Ethernet shield’ and a Raspi or BeagleBone.

Filed under: hardware