Monday, June 26, 2017

Fourth of July Lights

With my grandchildren coming for the Fourth of July, I went looking for projects to do. This is one, thanks to John Wargo--original and Fourth of July Version.

I made slight modifications to the Fourth of July version, using a Trinket instead of the Pro Trinket, because I had some of the smaller ones inventory. I also decided to leave off the LiPo charging backpack,  used a pushbutton switch, and used perf board for tidiness.

I used John Wargo's code almost exactly. The only difference is that he used pins 9, 10, and 11 but the Trinket does not have those pins.  Only pins 0, 1, and 4 on the Trinket handle PWM, so I replaced the array provided in the code "int ledPins[] = { 9, 10, 11 };" with "int ledPins[] = { 0, 1, 4 };".

Fritzing Diagram of Circuit


Parts (references to Radio Shack are good as of writing--no guarantee how long they will last)
  • Adafruit Trinket 3V
  • pushbutton switch (example--any SPST switch will do)
  • Radio Shack Dual Proto Board (or any perf board)
  • Wire Light LED Strands (1 each red, white, and blue)
  • 47 Ohm Resistors (3)
  • JST-PH Breakout Board
  • 1 Quart Ball Mason Jar (any jar with a lid will do--this size works well)
  • Wire Light LED Strands: Red, White, and Blue (note that these are NOT what's shown in the Fritzing diagram--I used the closest image they had in the parts bin).
  • 47 Ohm Resistors (3, one for each LED strand): see Adafruit descriptions of the lights, above--no resistor is needed with coin cells, but " If you want to use a 4.5V power supply, use 20-220 ohms (or larger)"--so I chose 47 for the 3,3V Trinket (having noticed how much brighter the LEDs were off the Trinket vs. off the CR2032s with no current-limiting resistor).
  • Tinned copper bus wire  and hookup wire-- like this, for example--depending on distances and how much insulation you need
  • Gaffer Tape
  • 500 mAh LiPo battery
  • JST-RCY cable Note:  the battery I used (see link above) has a JST-RCY connector and the JST breakout board has a JST-PH connector, I needed this cable and the next to use it. If yours has a different connector, you may not need these at all,  or you may need something instead of the -RCY cable. The 100mAh version shown in the Fritzing diagram, and most (or all) of Adafruit's LiPos, have JST-PH connectors, making all this unnecessary. I could have just cut the -RCY connector off and spliced on the -PH cable, but that was too permanent for me...and now I have a useful -RCY to -PH adapter.
  • JST-PH 2-pin Cable
  • Drill (I used my drill press--you just need a way to drill holes)
  • Step Bit (I needed ~16mm for my switch--different switches will have different requirements)
  • Wire tools: strippers, flush cutters, etc.
  • Normal soldering equipment: iron, sucker, helping hands, etc.

The bulk of the time was spent in design--mostly how to fit everything where I wanted.  The mason jar lid cramped my style. Even thought the Trinket is small, it took some maneuvering to get the perf board, theTrinket, and the JST breakout next to the whole I drilled.
  1. I laid out the space requirements on the inside of the lid, then cut the perf board to size and experimented with positioning until I was no unhappy
  2. I drilled the hole in the lid for the switch
  3. I made the RCY to PH JST cable to connect the battery: I just soldered the 2 together and heat shrinked
  4. The LED strands referenced above come with coin cell battery holders. I needed to cut the leads from the battery holders to use them, taking care to note which lead is positive (mine had white markings on the + lead, but I tested it to be sure and marked each with red and black Sharpies).
  5. Wire it up
  6. Test and correct as necessary.
  7. Solder.
    I used tinned copper bus wire to make a ground bus down one side of the perf board, fed by the negative pin on the JST-PH breakout.
    To that, I soldered the GND pin on the Trinket and the negative leads of all 3 LED strands.
    I soldered one resistor to each positive LED lead and heat shrinked it for insulation, then soldered the other leads of the resistors to the proper Trinket pins. 
  8. I used gaffer tape to secure the circuit to the lid and the battery to the jar



Saturday, June 10, 2017

Worked All States!!

I did it! Yesterday afternoon I had a JT65 QSO with a station in Hawaii. When I checked my Logbook of the World account this morning, it was confirmed.  That completes my 50 states (mixed). I have other Worked All States (WAS) awards to pursue, but I'm really happy to have this completed.

Twenty Meters was great yesterday--I made this contact with Hawaii before I repaired my antenna (one of my side of my G5RV Jr. had broken loose from the cord that ran from the dogbone to a tree...later yesterday with help from another ham I inserted a bungee cord, re-tied the cord, and raised and tightened the antenna).

Tuesday, June 6, 2017

Vintage Clock Radio Teardown

Yesterday my wife presented me with a 1966 Sears Silvertone Clock radio, model 6048.  The clock turned on but the radio did not.  I opened the case to find it was a vacuum tube device, so before I tore it down I took it a meeting of one of my amateur radio clubs, which happened to be last night, to see if anyone wanted to play with it. There was some curiosity, but no takers, so I tore it down.
Case open, pre teardown
Torn down
Salvaged Parts
After all that, I wound up with pretty much what I expected: a speaker, some knobs, 2 POTs, and some screws.  I also kept the transformer for the speaker--cursory research reveals that a permanent magnet speaker may need a transformer. I do not know if that's a function of the radio or the speaker--but I will try to find out.  I also kept the internal antenna, just for grins.

So, a piece of history bites the dust, but hopefully I will have some use for the parts.

Friday, May 26, 2017

Head Move Donkey V02: progress

After this post on my donkey update I learned some things, much of it from Adafruit Support on the forum in this thread.

First I was concerned with a statement in the MusicMaker Learning Guide "Don't forget to make sure you have a good strong 5V power supply - especially if you're using the 3W 4 ohm speakers! " It turns out that I was able to do what I needed with the 3.7V LiPo--I noticed no difference in output using the 5V 2A  wall wart.  I was even able to run everything off the 4xAA battery pack (using NiMHs only give 1.2V each, 4.8V total).  However, when I added the second Servo. I needed 2 power supplies.

Second I had trouble getting decent volume from an 8Ohm .5W speaker. I was directed to use 4Ohm 3W speakers.  I tried an 8Ohm 2.5W speaker I took out of a CRT television amd that was fine, but it's too big for the donkey.  I got some 1.25" 4Ohm 3W speakers off ebay, but they did not produce enough sound.  The smaller Adafruit version did the trick.

Third, I cooked an SD card and a MusicMaker.  I think it was while I was experimenting with power options...I may have mis-connected something.  First symptom was that it could not initialize the SD card.  I replaced it, and it got past initialization and said it was playing music but it wasn't.  Back to Adafruit for replacement board.

The reason for the second Servo is that I decided to move the donkey's tail, too.  I move the Servos in opposite directions, just because for grins.

Here's my appearance with the project on Adafruit's Show and Tell. I'm on from about 11:30 to 14:00.

Sunday, May 7, 2017

49 States!

I've been working HF for just over a year, and have been looking forward to qualifying for the ARRL "worked all states" (WAS) award.  After starting digital modes in February, I got up to 48 states, leaving just Maine and Hawaii.  I did not think ME would be a problem, since I live in Massachusetts, but it proved to be difficult.

This weekend is the New England QSO Party, so I figured that this would be my chance. I am not hearing a lot on 40 meters today (the most likely band for me to hear ME on), but I did get 1 ME confirmed now I just need Hawaii.

Any HI hams out there wanna help me out?

73, W1LEM

Monday, May 1, 2017

Head Move Donkey V02 in-process

Adafruit Feather M0, with MusicMaker and PWM/Servo FeatherWing stacked, running the Head Move Donkey code: plays
"Donkey Serenade" while moving the servo about 60 deg right and left to move the head.
As described in detail in this post, I recreated a wind-up toy that I bought for my daughter (an infant in 1978) with a Pro Trinket 3V and other components.  In the 2.5 years since, I've gotten a little smarter and the available technology has gotten a lot better, so I thought I'd try a version 2.  The biggest difference is that I needed fewer components. 
Donkey V01 
In the original, I needed an SD card reader, an amplifier, and a PWM/Servo Board. I still need those things, but the Adafruit Feather System makes it a lot simpler, eliminating most of the wiring and some of the code.  Also the Feather uses a ATSAMD21G18 @ 48MHz with 3.3V logic/power and 256KB of FLASH + 32KB of RAM while the Trinket uses the ATmega328P  at 12MHz with 28K of flash, and 2K of, the M0 is much more powerful.

Power management is slightly different. I was able to power the Trinket from a 4xAA battery pack, using the 3V output to power the SD card and the 6V to power the Amp and servo driver.  Logic levels were not a problem.  I power the M0 from a 3.7V LiPo and the Servo Wing from the 4xAA--again, the Servo is forgiving with respect to logic levels.  I probably should have had separate power sources in V01. One twist is that I'll need a DPST switch to turn on both power sources together.


Donkey V02 Circuit Working

Next steps are to construct and enclose the completed circuit and re-stuff the donkey.  Since the enclosure will be smaller, I'm going to try to get the batteries inside the donkey this time.
Fritzing Diagram of Circuit

Wednesday, April 19, 2017

Fun with Robots, IR Decoding, LED Matrix, etc.

Fig 1: Three experiment--two with the samsung remote on the left, one with the Radio Shack remote on the right--to control a +Adafruit Industries 8x8 Bicolor LED Matrix
I haven't posted in a while because several interests have kept me very busy. This all started withe the +Parallax Board of Education (BOE) Robot kit. I asked for and received on for Christmas a couple of years ago and let it ripen until I was ready.  I decided that it would make a good project to do with my 7-year-old granddaughter when she visits this summer--but first, I should make sure that I can build it without a lot of fumbling. Fumbling is good, but watching me figure out what dumb thing I did is not always interesting to a 7yr-old. I followed the tutorial and learned quite a bit, The last project that I did used infrared for proximity sensing to avoid obstacles. At the same time, +Adafruit Industries, via The Desk of Lady Ada, provided some great information on IR. So, I decided to play and learn further.
Fig 2: +Parallax BOE Bot with 2 IR transmitters aand 2 IR receivers

IR Decoding the Hard Way

Following the +Adafruit Industries tutorial on IR Sensing, I was able to decode only some of the buttons on my Samsung TV Remote (see Figure 1). Using the remote is a 2-step process: first decode the signals send by the buttons, then use the decoded signals in a different sketch that takes action based on the buttons. Using this method (see the Raw IR Decoder and ircommander code on github), I was able to decode some of the buttons and use them in a sketch.  

Quick diversion:  I have had big plans to use a 32x32 LED Matrix that I bought in a parking assistant project that will display faces to convey the emotions evoked by a car getting increasingly closer. I decided to use the 8x8 bicolor matrix and backpack to prove the concept, and use the remote to signal which face to display. Figure 1 shows the initialized yellow face (looks orange to me). So, I needed to follow the tutoral for the matrix and backback library.

I was able to merge code from the bicolor8x8 example code in the Adafruit LED Backpack library with code from the ircommander sketch referenced above. After adding the decoded remote buttons to a newly created library (see the IR Sensor tutorial and the project video cited at the end of this post), I was able to change the face on the matrix based on the remote buttons.

I found both the coding aspect and the operation of the technique to be less than perfect.  Maintaining a separate library with very long sequences of numbers just to test what button  was pressed seems a bit much. In operation, the code seems to reset itself randomly, and only respond to buttons when it feels like. This may be me, and I will investigate, but read on to see a much neater technique.

IR Decoding an Easier Way

After working through the above, I watched Lady Ada work through Chris Young's IRLib2 in one of the Desk of Lady Ada epdisodes cited above.  Chris, aka cyborg5, is a frequent visitor to the Adafruit Show and Tell, and has done a lot of great work (see his blog).  Both the decoding and the processing techniques are simplifies greatly, and his library handles several IR protocols. The IRLIB2 tutorial describes it all very well.  You wind up with one simple code that you supply in a sketch so you can determine what button was pressed--straightforward, and I was able to decode all the buttons with no missed presses. From there it was a matter of simplifying the sketch I wrote earlier to display faces on the LED matrix.  Again, the project video shows all this.

Controlling Motors with IR

Since we started with robots, I thought it would be interesting to control motors with IR.  It was a simple matter to modify the IRLib2 sketch above to direct the continuous rotation servos.  I took code from the BOE-Bot project, and code from the Adafruit_PWMServoDriver library tutorial, and it went smoothly.  The servos in the BOE-Bot are different from the Adafruit ones, so I had to go to the data sheet to see what values to use to get them to move as I wanted. I was able to decode all the buttons on the Samsung remote, and used the arrow keys to simulate moving the robot forward, back, left, and right.

I first did this without the PWM Servo FeatherWing. Because the feather is 3V logic, I needed a level shifter to handle the signals from the board to the servos. That worked, but added a few connections and I used the Arduino servo library as opposed to the Adafruit library which allowed for simpler code.

Another thing I needed to worry about was timer conflicts. I had come across this before, in my Donkey Project, but Chris' tutorial gave a straightforward explanation and solution. The problem is that the servo library uses Timer1 and on the 32u4 Feather IRLib2 does too. It was necessary to go into one of the associated libraries and change one line of code to re-assign the timer.  You'll get better instruction in the tutorial than I can give here.  Again, the project video shows the results.
Controlling 2 FS90R continuous rotation servos from an Adafruit BLE Feather and PWM Servo FeatherWing

Trying a Different Remote

A while back, Radio Shack sold some MAKE project kits, including robotics. During an earlier RS bankruptcy, I acquired a RS remote at a big discount and still had it in inventory, so I decided to try it out. Using the IRLib2 approach to decoding, I found the the protocol was not one of supported ones. A look at the datasheet for the PT2248 chip in the remote revealed that ot used the Toshiba protocol. So, I had to go back to the hard way, and I got that to work.  See the video.

IR Affects the BOE-Bot

Just for grins, I took out the BOE-Bot, let it runon the floor, and chased it with a remote.  The bot's IR retrievers detected the transmissions, and the bot reacted accordingly (moving left or right as if it had detected an obstacle).

Project Video

See the project video on YouTube