In wiring terms, we connect the GPIO 17 to an inner row (row 57) on the breadboard (via the brown wire). The inner rows are connected by metal strips underneath the cover (but not the inner columns). When you plug something into a row, the circuit will continue to any other item that is also plugged into that row. In our case the circuit will find an LED.

Your sleeping position may be a determining factor in how long it takes you to get used to sleeping in earplugs or whether you love them. Back sleepers typically experience the least amount of problems. Stomach and side sleepers may find that certain earplugs may backfire and make noise as they come in contact with the pillow. Selecting earplugs that don't stick out of your ears will help side sleepers avoid this.

The best kind of earplug for sleeping will depend on preference, although the good options will fit snugly in your ear canal without causing discomfort. During our testing, we found the best earplugs for sleeping to be:

You don’t need a keyboard or monitor for this tutorial – if your Pi is on the network you can log in via ssh and do everything from a terminal.

Aside from the fact that they could be shaped for a perfect fit, these earplugs were soft and comfortable. They stayed completely flat on my ear opening, so they didn't hurt to wear. They also stayed in all night; a feat that many standard earplugs haven't been able to accomplish.

No earplugs block completely block out sound. When testing, we found that Mack’s Pillow Soft Silicone Putty Earplugs did a great job blocking snoring and other ambient noise.

We tested the Original Discovery Pack, which means a package of earplugs comes in small, medium and large sizes for you to choose from. The earplugs are small and straightforward and fit inside the ear canal well. The recycled material earplugs come in black. The earplugs made from ocean plastics are green and reduce two additional decibels of sound.

Usually, yes, as long as you use them as directed. There are side effects you should be aware of. Earplugs may cause earwax buildup and cause ear canal damage if used incorrectly. You also shouldn't use them if you have signs of an ear infection, like drainage or pain.

Warning: From this point onwards it matters whether you have a revision 1 or 2 Raspberry Pi. Why? Because the GPIO pins are in a different order on the revision 2 boards. You can completely fry your Pi if you get the wiring wrong, so make sure you have a pin mapping to refer to. I will point out differences (I use a revision 1 board), but your Pi is counting on YOU to wire it up correctly.

You can also use them for sleeping at home, but only if you're strictly a back sleeper. The earplugs have a stem that sticks out straight from your ear canal, so not only are they uncomfortable when you're sleeping on your side, but they could also get pushed too far into your ear and cause problems.

The comfort level was also similar, although the Eargasm Squishies had a slight advantage since I could break off a piece and make it a little smaller. The Eargasm Squishies also comes in a convenient carrying case with eight reusable pairs.

When selecting the best earplugs for sleeping, we tested them the only way you can: by wearing them to bed. While testing, we noted each selection's fit, comfort and quality for the best earplugs for sleeping. We also considered how many decibels the earplugs could reduce, or noise reduction ratings when they were available. Official noise reduction ratings are usually slightly different (and lower) than the average decibel or sound reduction listed because they take into account other factors, Vibes says on its website.

A breadboard is a way to create electrical circuits without having to use a soldering iron. Very handy. You can get them in shops (like Maplin in the UK) that sell electrical components, or buy them online. They come in various sizes. I’m using a “full size” board, with two power buses (the outer columns), 63 rows, and 10 inner columns. You can use a half size board – as long as it has at least 31 rows you won’t need to change the wiring in this tutorial. My breadboard looks like this:

Second, the number of bands – this is where it becomes a little more complex. I’m using resistors with 4 bands (orange, orange, brown, gold) and resistors with 5 bands (orange, orange, black, black, brown):

Getting a good night's sleep is essential for your health and well-being. A few factors play a key role in determining the quality of your sleep, such as a dark room, the right temperature, and most importantly, quiet surroundings. However, if you live in a noisy neighborhood or have a snoring partner, it can be difficult to get solid uninterrupted sleep. This is especially true if you're a light sleeper or have sensitive ears, the slightest of sounds can wake you up and prevent you from getting quality rest. Wearing earplugs can block out excessive noise and help improve your sleep and overall health. With a pair of earplugs, you're bound to have soundless, restful nights ahead.

Mack's Slim Fit Foam Earplugs are specifically made for small ear canals. Finding the right earplug size makes a huge difference in effectiveness, so keep that in mind. If you don't have small ears, you can still take advantage of Mack's advanced snore-blocking technology with its Snore Blockers or Original Soft Foam Earplugs. If you go with any of these options from our best sleep earplugs list, make sure you thoroughly read the directions before putting them in your ears. One of the most common reasons these types of earplugs get a bad review is because they're not inserted properly.

So there we go – part 1 complete. In part 2 we’ll wire up some more components and edit our program to create the K.I.T.T light bar.

The Eargasm Squishies are another moldable silicone option similar to Mack's Pillow Soft Silicone Putty Earplugs. The biggest difference, besides the color, is in the directions. Mack's silicone earplugs must be used whole; you can't break them or cut them apart.

The six pairs also come neatly packaged in a plastic carrying case, which keeps the silicone clean and free from debris between uses; a small but appreciated touch.

Loud or abrupt sounds can be harmful to your sleep quality, but not everyone will benefit from earplugs. Besides sleep earplugs, here are other products you can use to help drown out unwanted or disruptive noise and get a good night's sleep.

There’s lots of info on using Python on the Pi, but you know I’m from an old-school embedded background, so we’ll be doing all this in the C programming language instead.

In essence all you need to do is ask for 330 ohm resistors, but the info above will help you if you are given blue ones or brown ones and you don’t want to feel like an idiot for asking what the difference is (like I did – I knew I should have paid more attention when I was little and my Dad was fixing the telly).

If you’ve never wired anything before, this can be a mysterious art. What we’re doing here is creating a circuit – a continuous path from our Pi, onto the board, through the LED, through the resistor, and back to the Pi.

Lots of connectors and components are termed male/female in electronics depending on whether they (to put it bluntly) stick in or out. We want male-female connectors because the Pi has GPIO pins that go into the female end, and the breadboard has holes that require the pins on the male end:

As I said in the intro, we’re going to use the wiringPi library to talk to the GPIO pins on the Raspberry Pi. It was written by Gordon Henderson and I have been so impressed with its ease of installation and use.

Note that when you CTRL-C out of the program, your LED may remain on – this will happen if you interrupt the program before the GPIO pin is told to stop the output. It will be reset when you run your code again, but you may want to avoid pulling wires in and out when the GPIO pin is active, just in case.

At CNET, our experts have years of experience testing sleep-related products. From the best mattresses to sleep trackers, we know what it takes to actually help you sleep better at night. Check out our picks for the best earplugs for sleeping.

There we go. Now you’ve got all your stuff together, put it to one side and let’s focus on getting the code ready before we do any connecting up.

If you are a light sleeper, investing in high-quality earplugs that completely block out external noise can be a game changer.

I shouldn’t need to tell you any more about the Pi and power adapter – I’m assuming you’ve either got one already or are thinking about buying one. Onto the components:

Based on reviews, these Loop earplugs seem to work well for some side sleepers. From our testing with side sleeping, they would require some getting used to for longer or everyday use. Due to their easy movement and sleek look, these earplugs would come in handy when you want to turn down the volume and focus. They're available in mint green and other fun colors.

In this section we’ll install the wiringPi library on the Raspberry Pi, connect up a single LED, and write a simple program in C to make it flash.

This is the list of items you’ll need. If you want clarification on any of these (buying electrical components is a bit of a leap in the dark the first time you do it), have a look at the pictures and further info below. If you’re pretty familiar with these things, then grab the list, skip the details and move onto Step 2.

The Mack's Slim Fit Foam Earplugs look like any regular old foam earplugs, but if you have small ears, you may feel the difference in quality immediately. They quickly formed an airtight seal and muffled sound instantly. Loud snoring went from a roaring thunderstorm to a minor distraction that was easy to tune out. These particular earplugs have a noise reduction rating of 31 dB. For reference, most earplugs on the market have a rating of 0 to 30 dB, and the higher the number, the more effective they are.

These reusable silicone earplugs come fixed with a "loop" for making easy adjustments once they're in your ear. Loop Quiet Earplugs come with four sizes of tips you can choose from to fit your ear canal, which is more selection than a lot of brands. Fixing a new tip size back onto the earplug isn't the easiest process and requires some focus and finesse. Hopefully, you'd only have to switch tips once or twice to find your size, and then only when you clean them.

First of all, the bands. The colours represent numbers – this is just easier than printing teeny, tiny font on them. There are lots of online calculators and explanations for the colours, so I’ll leave that up to you to read about later.

There are countless options to consider when shopping for the best earplugs to wear while sleeping. You'll want a pair that fits snugly in your ears without irritation and helps cut out ambient noise so you can fall asleep with ease. We've compiled various options, including traditional foam earplugs and models with different materials, like silicone, that filter noise.

I’m going to give you a little background on resistors, because I use two different types in this tutorial for no other reason than that’s what I had available. However, it’s worth understanding the different types so when you go shopping for yours you understand what you are buying.

If you're strictly a side sleeper, Mack's Pillow Soft Silicone Putty Earplugs are the best sleep earplugs for the money. They're made of soft, fully moldable silicone that conforms to your ear opening and forms an airtight seal that blocks out noise.

Image

Happy Ears is a Swedish company known for its sustainable packaging and recycled material for its earplugs. Happy Ears makes earplugs from ocean plastics and recycled plastics. There is also an "original" earplug that isn't made from recycled plastics. Even if you don't buy recycled earplugs, the Happy Ears packaging is recyclable, biodegradable and compostable.

The earplugs come with three different ear tip sizes, so you can find the ideal fit for your ear canal and a small carrying case that makes them easier to travel with.

Eargasm says if the earplugs are too big, you can break off a piece to get that perfect fit. This is helpful if you have small ears and find that using the entire silicone earplug feels too intrusive.

This is the first part of a two-parter on creating the K.I.T.T. light bar with LEDs using your Raspberry Pi (I know, awesome, right?).

Image

You can’t go far wrong with these. They come singly and in multi-packs (I bought a pack of 10), and although there are specifics such as light angle, colour, brightness, etc., for our purposes any old working LED will do, so don’t spend more than you need to:

If you have reusable earplugs, make sure to follow the directions and regularly clean them. Always throw away the disposable earplugs. Using earplugs that have bacteria on them can lead to an infection.

There's a lot of variety in earplugs. What works for someone else might not be the best choice for you due to size, shape and material. Here are a few things to look out for.

Most importantly, these moldable earplugs did an excellent job at blocking snoring and any other ambient noise (like three large cats play-fighting in the middle of the night).

I’m going to assume at this point that you have a Raspberry Pi that is up and running on the network. If you haven’t, then the Raspberry Pi website is the best place to start, or you can look at my post on headless boot of the Pi, if you like a challenge ;-).

The resistor bridges row 55 onto the negative bus (or ground). The buses on the outside of the board are connected in two columns – the opposite of the inner rows. So we now have a connection between our resistor and our white jumper lead. The white lead finally goes back to the ground GPIO pin on the Pi.

Image

The Vibes Hi-Fidelity Earplugs are different from the others on this list. They're actually designed for live music festivals, so rather than blocking out noise, the intent is to lower the decibels of the sound around you to make the noise more manageable. This makes them the ideal choice for traveling when the noise can get overwhelming but you don't want to be completely checked out from the world as you take a quick snooze. When tested at a store and coffee shop, they did an excellent job blocking out voices, reducing pitches and dulling loud music.

Our advice is expert-vetted and based on independent research, analysis and hands-on testing from our team of Certified Sleep Coaches. If you buy through our links, we may get a commission. Reviews ethics statement