You can buy all sorts of 5V relay modules on Amazon for as little as $3-4 (probably even less if you get really cheap). They even sell boards with multiple relays if you need to switch more than one thing. Since I had all of the necessary parts I built my own. Yesterday I finished the board, because I had to do something before National Week of Making ended.
It worked great switching power from a 9V battery, but the real test was hooking it up to mains power. Electricity gets a lot more dangerous at 120V! It was a little scary plugging everything in and flipping the input, especially after reading so many warnings online, but there were no sparks.
I need to pick up a plastic outlet box to house everything so it’s safer with the exposed soldered circuit board in there; I don’t know what I was thinking when I bought a metal one. I’ll publish a more detailed post this weekend when it’s complete.
Update: I realized the relay I used in this module can’t handle the amount of current I need, so I ordered a different type of relay and will be making a new module. I’ll take the opportunity to make a more compact design as well. I did shrink this one a bit and cut off some of the board. I’ll save this module in case I ever need it for a project.
When I read The Hardware Hacker, the part that stood out the most was when bunnie discussed Shenzhen, China. I don’t remember ever hearing about the city until recently and it was actually in relation to the book. Shenzhen is where most of our electronics or (and components) come from. Foxconn, located in Shenzhen, is probably the largest electronics manufacturer in the world. They make most of Apple’s devices as well products for other big companies like HP and Microsoft.
With all of the factories producing electronics in the area, they also have the largest electronics component market in the world where you can buy anything you can imagine. Due to the supply chain and access to manufacturing, if you hook up with the right people in Shenzhen you can get a first prototype of your product created in as little as a few days. Plus, the costs there are much cheaper than anything you can buy or get done in the United States. In his book bunnie wrote…
The trouble is that aside from the label on the product that says “Made in China” or “Made in the USA,” consumers really don’t care about the manufacturing process. What markup would you pay for a gadget that said “Made in the USA” on it? The cost premium for US labor is 10 times what it is in China. Think about it: can the average US factory worker be 10 times more productive than the average Chinese factory worker? It’s a hard multiplier to play against.
Remember this the next time Trump says Apple should manufacture everything here instead of in China. Would any of us pay several thousand dollars for an iPhone? I doubt it.
With access to so much technology in Shenzhen, there is a subculture there called the shanzhai. They’re responsible for most of the copycat products you’ve probably heard about. For example, a really good iPhone clone in China might sell for 1/7th the price of a real one in the States. As you might have guessed, IP is treated differently in China than in the United States.
To give a flavor of how this is viewed in China, I heard a local comment about how great it was that the shanzhai could not only make an iPhone clone, they could improve it by giving the clone a user-replaceable battery. US law would come down on the side of this activity being illegal and infringing, but given the fecundity of mashup on the web, I can’t help but wonder out loud if mashup in hardware is all that bad. I feel there is definitely a bias in the US that “if it’s strange and it happens in China it must be bad”, which casts a long shadow over objective evaluation of new cultural phenomenon that could eventually be very relevant to the US.
The speed at which the shanzhai operate and iterate is impressive and exciting. I’ve read about it being similar to the early days of computers, where people like Steve Jobs and Steve Wozniak were sharing their projects and it was pretty much all open source hardware at the time. Some of that is coming back with the maker movement, but it seems like IP and copyright stall innovation so much in the United States. This is why I’m so proud to work for Automattic, where we place a high value on sharing with the world by open sourcing as much as we can.
bunnie teamed up with WIRED for a documentary on Shenzhen. Here’s the trailer for it.
MicroUSB port for programming and debugging with Arduino IDE
USB port can act like serial port, keyboard, mouse, joystick or MIDI
10 x mini NeoPixels, each one can display any color
1 x Motion sensor (LIS3DH triple-axis accelerometer with tap detection, free-fall detection)
1 x Temperature sensor (thermistor)
1 x Light sensor (phototransistor)
1 x Sound sensor (MEMS microphone)
1 x Mini speaker (magnetic buzzer)
2 x Push buttons, left and right
1 x Slide switch
8 x alligator-clip friendly input/output pins
Includes I2C, UART, and 4 pins that can do analog inputs/PWM output
All 8 pads can act as capacitive touch inputs
Green “ON” LED so you know its powered
Red “#13” LED for basic blinking
With so many features, Circuit Playground is a perfect board for someone learning to program. There are endless possibilities for fun projects. I ordered one to support the program. I’m hoping they’ll get some of the new Circuit Playground Express boards in stock and extend this promotion to those because I’ve been tempted to get my hands on one. If they do, I’ll gladly place another order.
I successfully built the second piece to a large project I’m working on. I’ve essentially built my own XL Raspberry Pi HAT (Hardware Attached on Top). Since I’m not following the specs, I shouldn’t really call it a HAT.
I’m not sure how, but once again I correctly connected everything on the first try. Either I’m extremely lucky, my attention to detail is paying off, or a combination of the two. I’m just waiting for some catastrophic failure to happen soon when I solder things the wrong way one of these days. Every one of my solder bridges worked. I did run continuity tests on all of the early bridges, which I’m sure was a big factor to my success.
Any guesses on what this board does? Leave your best guess in the comments. It’ll be at least a month before I share more details because I need to finish the entire project first.
Yesterday I posted about multiplexing 7 segment displays, but it’s actually been weeks since I got that circuit working. After 2 weeks of travel and a busy weekend, I finally got some time on Wednesday night to start moving the circuit from the breadboard to a more permanent home. I stocked up on a variety of different sized circuit boards, but unlike a breadboard each hole on these is independent. It was time to learn how to make solder bridges. After fumbling through about 10 bridges I started to get the hang of it. They won’t win any beauty contests, but they’re functional, which is what matters.
In round 2 last night I tried a couple of tricks. The first method is using a small wire or the discarded end of a lead (this happened to come from trimming off the ends of a resistor) to bridge pads together.
Another trick is to bend over the ends of leads to create a bridge. In the left and right columns you can see this type of bridge used. The middle column shows bent leads I’ll use when I connect more wires.
Both methods worked a lot better than trying to use mountains of solder to jump the connection pads.
By the way, I find soldering (no matter what it’s for) to be extremely relaxing. Maybe it’s something to do with the order of the entire process; physically connecting things to make a circuit work. I typically do it late at night with some music and a cold beer.
I picked up a 10 pack of these 7 segment red LED displays for less than $5. Since each display requires connecting to a minimum of 8 of the 10 pins (9 if using the decimal point), they aren’t exactly easy to work with. Sure, you can buy these where 2 or 4 displays are already connected in a nice package, controlled with the help of an integrated circuit, but where is the fun in that?
If you need to use more than 1 or 2 displays (at 8-9 pins per display), you’ll quickly run out of pins on your microcontroller or Raspberry Pi. The most common way to work with several of these displays is called multiplexing. It’s a method where you briefly turn on one display, turn it off, turn on the next one, and turn it off. You repeat this through all of your displays and then start over. If you do this fast enough, the human eye thinks all of the displays are on at once. It’s pretty slick!
The advantages of multiplexing are:
Fewer wires/pins needed to drive the displays.
Lower power consumption since the LEDs on only one display are lit.
Let’s get our hands dirty, shall we?
Seven of the pins on one of these displays match up to the 7 segments (labeled a through g), one pin is for the decimal point (DP), and the two remaining pins can be used for the common cathode (cc), though you only need to connect one or the other. Over to the right you can see how all of the pins and LED segments are arranged. Pretty straight forward.
I’m using 6 of these displays in a project, so I needed a lot of wires. It got complex and tangled in a hurry, but amazingly, I connected all the wires without a single mistake on my first try. 🙂 For the most part, I based my circuit design off of this schematic…
The end result is something like the Fritzing screenshot below. With so many wires overlapping, it’s not easy to see what’s really going on here. I suggest grabbing wiring.fzz from my GitHub repo and playing around with it in the Fritzing app.
When I went to write my proof of concept code, I decided to use the Gpiozero Python library to simplify working with the LEDs. The library allowed me to set up a couple of arrays for the LED segments and the 6 digits (displays)…
segment_leds = 
for i in range( len( segment_pins ) ) :
segment_leds.append( LED( segment_pins[i] ) )
digits = 
for i in range( len( digit_pins ) ) :
digits.append( LED( digit_pins[i] ) )
Then I could easily loop through and toggle the LEDs in a display as necessary…
for i in range( len( digits ) ) :
for j in range( 7 ) :
if ( numbers[ digit_values[i] ][j] ) :
To make sure things worked I count up from 999000 and then start back at 000000 after hitting 999999. You can see the full code on GitHub.
Now for some visual proof that I actually got it all working! Here it is running when I keep one digit lit for 5/10,000th of a second before turning it off and lighting the next digit.
You’d never know that only one digit is turned on at a time, would you?
If I change from 0.0005 to 0.05 of a second you can start to see that only one display is on at any point in time.
You may also notice it’s counting up a low slower due to the way this code increments the counter. Don’t worry about that.
When I keep each digit turned on for half of a second you can really see how this works.
An issue I’m running into on a Pi Zero is when the processor gets busy doing other tasks, there is a bit of flicker across the displays. You can see this a couple of seconds in to the first video. I’m guessing the code would perform much better on a Raspberry Pi 3B. For my project it’s not a concern, but I want to mention it in case you follow this for your own project. You may also pick up what looks like random flickering of a single digit here and there but that’s due to video timing; the human eye doesn’t see any of that when it’s in front of you.
If necessary, you can take multiplexing a step further and only light up an individual LED on each display at a time, with a method called charlieplexing. It will use even less power, but due to the speed at which you need to switch from one LED to the next, especially across an array of multiple displays, you lose brightness to the human eye.
The reviews for these were good and any issues people had were resolved quickly by the seller. I figured it was worth the little bit of risk to try out these boards as a way to have some WiFi capabilities on hand. When they arrived, I ran a few quick tests in the Arduino IDE and had no problems uploading code or connecting to Adafruit IO with some of the example programs. The boards are slightly wider than the Feathers I’m used to working with, so there is just a single row of holes on either side when plugged into a breadboard. One other difference is no JST connector for a Lithium Ion battery.
If you’re looking for a cheap intro to Arduino or a way to get an electronics project on your network, check out these microcontrollers.
The title is misleading; The book’s main focus is on the manufacturing of hardware. Even though I’ll probably never manufacture a hardware product, I did learn a lot and enjoyed the read. Many of my favorites parts of the book centered around China. More to come in an upcoming blog post, once I do some research and learn more about a few topics.
I’ve been wanting to see this movies, so I jumped all over it when I saw it in the Delta options. Really enjoyed it. We take computers for granted so much and it’s pretty amazing to think that we made it into space with so much of the math being done by hand. The movie was a good reminder of how far we’ve come with gender and racial equality in the last 50 years. We still have so far to go.
Pretty sure I’ve had this on my Kindle for at least 5 years, maybe even since it was released in October of 2011. After reading the Hardware Hacker and learning so much about electronics lately I felt it was a good time to dive in.
Amazon says the book has 657 pages, so it’s no wonder I didn’t finish it. I think I’m just over 1/3 done.
I’m actually glad I waited so long to read the book; getting a better understanding of how electronics work and tinkering with them is allowing me to appreciate Jobs’ early years more than I would have before.
An enjoyable feel-good story. Doesn’t hurt that Will Smith, Keira Knightley, and Edward Norton all starred in it; they are some of my favorites.
Jack Reacher: Never Go Back
Does Tom Cruise ever age? I liked the first one better. Most of the fight scenes were pretty poor in this.
So when part 3 of this series turned out to be a bit uneventful, I wasn’t expecting a grand finale with fireworks. I was right about it being more difficult though.
Through numerous failed attempts I was running into trouble isolating the signals between the rows and columns. Everything was getting connected in one big circuit. Then I realized it was a perfect place to use diodes! Each button needed 2 though; one for its connection to the row and one to the column. I have a bunch of 1N4148 signal diodes so I wired everything up.
Although the Fritzing is using a different board than in the implementation pictured above, it’s much easier to follow the wiring…
I’m glad I continued down this path with keypad experimentation. I learned a lot. In the beginning I was wondering why the keypads you can buy these days work the way they do and not how I had wired up the old phone keypad to function. Turns out what ended up being a simple solution for me was due to how the old phone keypad made its connections mechanically inside the device. The keypad solutions I showed in part 3 are much easier to create as I’ve now proven by recreating the circuit above.
I’m still curious if I could wire up the old phone keypad to work with the Arduino Keypad library. I guess if I ever get my hands on another old phone, I’ll have to continue with a part 5 of this series.