Catching up on Electronics Projects

I’m behind on a bunch of electronics subscription boxes and projects, so I’m just going to list out a bunch of stuff. None of its worthy of its own post anyway.

One of the projects for HackerBox #0023 was to build a custom antenna out of PVC, copper wire, and glue. I did a pretty piss poor job of drilling my holes in a straight line (as you can see in the picture), but I connected it to a microcontroller and was able to scan for Wi-Fi networks in the area. Success?

img_0591.jpg

I need to make more time to work with the pan and tilt system built with HackerBox #0024.

The camera that came with the project can only do 640×480, which sucks. One of these days I’ll connect the system to a Raspberry Pi and use one of my unused Pi cameras instead. Would be neat to mount at the front door to track anyone who comes to the house when I’m not home. The face tracking stuff is pretty awesome, even with the shitty camera. Here’s a really rough video of it.

I had to modify the code a lot to get everything working and I put it all on GitHub. If I work on this project more I’ll update that repo.

There wasn’t a lot to do with HackerBox #0025. It was mostly a soldering and look at the blinky lights project. Here are the 3 badges I made. I turned the star and rectangle (with a “Let’s Party” sticker in place) into pins and gave them to my nieces.

The skull badge has a buzzer on it, so I wrote some code (it’s on GitHub) to make it play the Star Wars theme and display some light animations.

Over the holidays I messed with AdaBox006 a bit. The 38 I posted on my birthday was a light painting taken with the Slow Shutter iOS app. I got it the light paintbrush working on both the Circuit Playground classic via a customized Arduino sketch and on the Circuit Playground Express through MakeCode. Both are available in the adabox-006 repo on GitHub. Using MakeCode is a fun way to program and I think it’s going to change the way people learn. Look at how simple and visual that version of the program is…

adabox-006-make-code-light-paintbrush.png

I did solder everything for HackerBox #0026 and verified some of the functionality, but haven’t done much with it. It was one of the most fun projects so far from HackerBoxes because of how many components were on this PCB. I find soldering to be so relaxing and satisfying.

I added the code for the temperature sensor I mentioned and showed in my post Why Are Thermostats Still on the Wall? to a new dht11-low-pass-filter repo on GitHub. Very simple, but useful.

HackerBox #0024: Vision Quest

A quick unboxing of HackerBox #0024: Vision Quest.

Prices I found online (Amazon Prime unless noted):

  • HackerBoxes #0024 Collectable Reference Card – $1 (estimate)
  • Three Bracket Pan and Tilt Assembly – $19
  • Two MG996R Servos with Accessories – $18 ($9/ea)
  • Two Aluminum Circular Servo Couplers (included with the pan and tilt kit above)
  • Arduino Nano V3 – 5V, 16MHz, MicroUSB – $3.99
  • Digital Camera Assembly with USB Cable – $10 (estimate)
  • Three Lenses with Universal Clip Mount – $3.33 (AliExpress)
  • Medical Inspection Pen Light – $2.23 (AliExpress)
  • Dupont Male/Female Jumpers – $0.50 (estimate)
  • MicroUSB Cable – $2.40
  • Exclusive OpenCV Decal – $1 (estimate)
  • Exclusive Dia de Muertos Decal – $1 (estimate)

Totals out to $62.45 but I couldn’t find the model on the back of the camera module anywhere. I wouldn’t expect that estimate to be off by more than $5 though and maybe even cheaper. The servos feel pretty hefty compared to the micro ones I have. This will be another neat box to play around with.

Unboxing – HackerBoxes #0023: Digital Airwaves

I was able to avoid spoilers on this month’s HackerBox again, even though something happened with my shipping over the weekend. It arrived Monday instead of Saturday like it was originally scheduled.

Unique box. I’m excited to go through the Instructable for this box and learn some stuff about antennas and WiFi. The PVC pieces and copper wire are for making a custom antenna, which will be fun. I checked my box of goodies to see which WeMos board I had recently bought and it was the Mini Lite. I think I have one of each of their tiny boards now.

I tried to come up with a value for the box again. All prices are from Amazon (with my Prime account) unless noted.

  • HackerBoxes #0023 Collectable Reference Card – $1 (estimate)
  • USB Wi-Fi Interface Device with RT5370 Chipset – $5.89
  • WeMos D1 Mini Pro-16 – $5 + 1.81 shipping (AliExpress)
  • WeMos I2C OLED Shield – $4.50 + 1.58 shipping (AliExpress)
  • WeMos ITX to SMA Antenna Coax – $4.95
  • Exclusive PCB Yagi-Uda Antenna Kit – $5 (estimate)
  • Exclusive CPVC Yagi-Uda Antenna Kit – $1 (estimate)
  • SMA male to RP-SMA male Coax Adapter – $5 (estimate)
  • Mini Tripod with Shoe Mount – $7.79
  • USB Extension Cable – $3.35
  • MicroUSB Cable – $4.16
  • Exclusive Yagi-Uda Antenna Decal – $1 (estimate)
  • Exclusive Digital Airwaves Iron-on Patch – $2 (estimate)

This was a hard box to price out, so there are a lot of estimates. I didn’t see the PCB antenna anywhere and the parts for the PVC antenna are obviously DIY. The random bag of connectors doesn’t seem to be from a kit of any kind. There was also another antenna in my box not on this list. So I’ll add another $10, which all adds up to $64.03.

HackerBox #0020: Summer Camp

I managed not to look at any spoilers before HackerBox #0020 arrived, so I recorded a video when I opened it and talked through the items, trying to figure out what the theme was.

 

So, yep, it’s a badge inspired by the badges for Def Con (I had seen this story a week or two before, which HB shared as a hint on their Facebook page). Due to vacation, it was a couple of weeks before I was able to put this thing together. Hope you enjoy all of my mistakes in the assembly video. 🙂

There is a lot more to think about when recording what you’re doing and trying to keep talking throughout. I think it was an improvement over the video I did for the 5v relay module though. I really need to build a tripod or overhead mount of some kind so the GoPro is more stable. I may look into a newer GoPro as well with better battery life and a screen.

More details about the badge and demo code provided by HackerBoxes can be found on the Instructable page for this box. My customized demo code is in a hackerbox0020-demo repo on GitHub.

Update: I’ve updated my demo code to have examples of how to use the SD card that is on the back of the TFT.

Code with Microsoft for Beginners and Makers

It’s been quite some time since I’ve used any Microsoft products. They are really stepping up their game when it comes to makers and creating tools to teach people how to code.

Makecode (by Microsoft) is a site similar to Scratch. Both are great way for kids (or adults) to get started with programming. The powerful part is the drag and drop interface which simplifies coding. Instead of having to remember the syntax of a for statement, in the block editor you drag over a for block and fill in a couple of fields with the values for the variables. You don’t even need to buy a board to get started because the site has an emulator built right in.

makecode-circuit-playground-light-rotate.gif

Makecode has support for a bunch of microcontrollers aimed at beginners. Currently it works with micro:bit, Circuit Playground Express, Minecraft, Sparkfun Inventors Kit, and Chibi Chip. I selected the Circuit Playground Express for my example above.

They’ve also built a Visual Studio Code extension for Arduino, which is now open sourced. I downloaded VSC and installed the extension. I didn’t play with it very long, but it looks like it’ll be my new editor for Adruino projects. It does things that every programming IDE should do, like code completion, which the Arduino IDE still does not do. I also installed some Python extensions, so I’ll have to see how it compares to the Atom editor, which is what I’ve been using for Python programming.

visual-studio-code

Makerfocus ESP8266

One of the recommended products that came up recently for me on Amazon was a set of 2 Makerfocus ESP8266 NodeMCU boards for $15.99. I’m familiar with the chip from using the Adafruit Feather HUZZAH with ESP8266 WiFi that came with AdaBox003. That board runs for $16.95 though.

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.

Phone Keypad Hacking: Part 4

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…

2x3-custom-keypad-wiring.png

This obviously is a lot more complicated circuit than the examples in part 3 of this series. It was a success at what I set out to do though and it works great with my custom keypad code. I’ve also added the actual Fritzing file for this circuit to the repo.

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.

Phone Keypad Hacking: Part 3

In parts 1 and 2, I walked through my journey of repurposing the keypad out of a phone from 1980. I learned that a more modern keypad matrix doesn’t exactly function (behind the scenes) in a way I’d expect. I wanted to understand it better so I set out to recreate a 2×2 keypad (kept it simple to make wiring easier) that would function the same way as something you can buy today. It would be a success if it worked with the Arduino Keypad Library.

adafruit-3x4-keypad

From my earlier looks through the code I knew it pulsed power out to a column pin and then read in each row’s key from that column before switching to the next column and repeating the process. I figured that should be enough for me to wire this up and try example programs without going back to look at the library’s code again.

I don’t know why I was thinking this would be more complicated and at least a little more exciting, but it was unbelievably easy. I guess I should be celebrating I understood how it worked. Literally all you do is connect one side of every button in a column to a pin and one side of every button in a row to a pin. No need for connections to power, or ground. No pull up/down resistors.

2x2-keypad-matrix-wiring.png

It immediately worked with the Arduino Keypad library examples, even the MultiKey one. I guess being able to detect multiple key presses at once is where the advantage to this implementation comes in. It worked flawlessly when pressing 2 of the 4 buttons, but when you get to 3/4 there are too many connections to distinguish the keys.

Just to be sure I had it figured out, I added a 3rd column to make it a 2×3 grid and it was just as easy.

2x3-keypad-matrix-wiring.png

I love the beauty of how simple this is. I’ve added Fritzing for both of these to my phone-keypad GitHub repo (2×2 & 2×3). If you check this PDF, in the How it Works section it has a really good explanation and shows the row and column connections exactly like I came up with.

Naturally now I need to do a part 4 and attempt to recreate the keypad implementation I ended up with from the old phone. Due to how it mechanically makes the electrical connections I think it’s going to be a bit more complicated than this was. We shall see…

Update: Read part 4.

Phone Keypad Hacking: Part 2

Go back and read Part 1 if you want to the full story on this little project. I did decide to get rid of the PCB on the old phone keypad. Good thing I’ve been getting a lot of desoldering practice. In order to remove the PCB, I first had to remove the wires I had added to the column and row contact points. That was easy and getting the PCB off was a pretty smooth process as well.

PCB and new look of the back side of the keypad.
Other side of the PCB. The white rectangle is the back of the 557D IC.

Now that I didn’t have the PCB to carry power and ground around everywhere, I had to solder in my own wires. I also had to solder back in all of my connection points to provide the outputs I’d feed into a microcontroller (I used an Adafruit Feather 32u4 Basic Proto).

Once all of the wires were in place and then connected to my microcontroller I wasn’t getting expected results from a simple little program I wrote to display the values. Took far too long for me to remember I needed to use pull down resistors to prevent floating values. I put 10k Ω resistors in each of the circuits…

img_8994
Prototyping with pull down resistors.

Output from the pins couldn’t get any better…

phone-keypad-row-col-values.png

I loaded an example from the Arduino KeyPad library, which gave me very weird behavior. After looking at the underlying code, I realized it wanted the outputs of the keypad to be HIGH when a key was not pressed and LOW when it was. Well, my circuit was doing the opposite, so I had to have to invert everything. I didn’t have any inverter ICs, so I used NPN transistors to create an inverter circuit on each output.

img_8993
Prototyping by inverting the output of the keypad column and row values.

Progress. Now I was able to get the library to correctly recognize some key presses. 95% of the time it seemed to think everything was coming from column 1 (1, 4, 7, *) though. The library comes with a MultiKey example. When I ran that, it was reporting every key on the row as being pressed. WTF?!

For the life of me I could not figure out what caused this. I checked wires, measured voltages, did continuity tests, resoldered connections, changed boards, used different GPIO pins, and countless other things. Nothing made a difference. My own code was working beautifully though. Eventually I gave up on the library. It wasn’t worth the effort and I was out of ideas.

Update: Later on I went back and read the KeyPad library code again because it was bugging me. Turns out these keypads don’t actively read the column pins like they do the row pins. My assumptions about how they worked was very wrong because I hadn’t read far enough into the code before. When checking for key presses, typical keypads iterate through the columns to send a pulse which feeds over in to the rows, which are then read in. How a Key Matrix Works has a pretty good explanation with visuals. If I get my hands on another similar keypad maybe I’ll try to recreate this functionality.

I rewired everything to use the pull down resistors again (video of soldering). A huge benefit of the decision was it drastically simplified my circuitry. This would save me 49 solder points! I probably would have needed to use a half-size perma-proto board instead of the 1/4 size I ended up using.

I decided to put in a piezo buzzer to add sounds. I also used a tiny LED, which I had salvaged from some old computer speakers, to show when power is switched on to the backlight.

The finished board. Isn’t it a thing of beauty?

 

Side view before bending the output wires off to the sides.

I tried a couple of different methods of producing touch tones (DTMF) to match up with each key, but with the microcontroller I’m using and the small piezo buzzer, the sound was terrible. I would need something a little more capable I think.

Here’s a demo video.

Hard to see the OLED screen in the video, but I was only using it to output each key press. Something like this…

phone-keypad-oled-output.jpg

All of the code and Fritzing wiring are available in my phone-keypad repo on GitHub.

I even went out of my comfort zone and did a quick share of this on Adafruit’s Show and Tell. If the video doesn’t start at the right spot you can skip ahead to the 12:42 mark. Going back to watch, my demo kind of sucked since it’s hard to hold something up to the Mac camera and push buttons at the same time.

Update: Continue on to Part 3, where I create a matrix of buttons to act as a keypad.