Have any fun projects or articles you’d like to share? Send a description and any pictures to Melinda KG5NWD and we’ll get them posted!
Dave WA5X – Introduction to MicroControllers and MicroComputers
I have been fooling around with microcontrollers for several years now so I decided to share some of my experiences with the folks in the ham club. First let me describe some devices and how to program them.
Probably the simplest and least expensive is the Arduino. Arduinos were developed in Italy but were soon copied and mass produced by the chinese. They are easy to set up and program with the Arduino IDE. The Arduino IDE can run on Windows PCs, Macintosh and also Linux machines. One drawback to the Arduino IDE is the requirement that each program must be compiled and loaded before it will run.
The programs can range from very simple to extremely complex. One of the first programs to run in any programming language is the old familiar “Hello World” program that prints to a screen or terminal. The hello world program for the Arduino is the “blink” program that turns on the built in LED on the Arduino, pauses for a set amount of time, then turns it off and pauses again followed by turning it on again.
The Arduino Nano clones are available on Ebay and Amazon for under 4 dollars and are an excellent place to start. There are many different Arduino models with increased clock speed and memory. Another favorite of mine is the Raspberry Pi microcomputer. The Raspberry Pi is a complete computer on a board. You can connect a keyboard, mouse, and monitor and have a fully functioning computer capable of running Linux. The Raspberry Pi also has a 40 pin expansion header that allows you to interface it to external sensors and devices.
The Raspberry Pi costs more than the Arduino and has different abilities. It can be programmed in python which does not have to be compiled to run. Python is versatile and powerful. Python is an interpreted language which can be interacted with on the command line. For example you can type in “print 3 + 4” at the prompt and Python will give you a 7 on the next line without being compiled first.
The Raspberry Pi foundation has recently released a new controller called the Raspberry Pi Pico which sells for 4 dollars and and can be programmed with Micropython.
I have recently been making clocks with the Arduino and various displays. I have used 2 line by 20 column lcds, vacuum fluorescent character displays, 7 segment leds, and more recently Neopixel arrays and led arrays driven by the MAX7219 chip. The MAX7219 is simple to interface and only requires 3 i/o pins in addition to power and ground. A single MAX7219 can drive an array of 8×8 leds or eight 7 segment displays with decimal points and as many as 8 MAX7219s can be daisychained together on the same 3 i/o pins giving you the ability to individually control 512 individual leds.
The brains of the clocks I have been making have been Arduino Nanos, ESP8266s, and ESP32s. The ESP8266 and ESP32 both have built-in wifi and are able to connect to the internet and get time information from the various time servers available via the internet.
I have also made data loggers that record information from the i/o pins such as temperature or voltage and written to a SD card with a timestamp. I recently used this setup to analyze the defrost cycles in my refrigerator and freezer.
I hope this sparks some interest among the group and I look forward to seeing some of the projects that others come up with.
Dave WA5X – 6 Digit Station Clock
One of my recent projects has been a 6 digit clock. For many years I have had an old salvaged school clock hanging in my living room. It was an early model that was placed in schools to replace the analog clocks that were deemed way to difficult for school children to read. My clock was a 4 digit red led clock with 4” tall numbers. It has a pair of buttons marked fast and slow for setting the clock. It also had an interface for a master clock. The fast/slow buttons only changed the time in a forward direction which made it a real pain every time we changed from CST to DST. I was lucky to get the time closer than one minute since seconds were not shown.
After hanging on my wall for many years the small power transformer gave up the ghost. I was able to replace it with a small +12 supply but decided to start looking for a replacement. Enter the ESP8266. The 8266 can be had for less than 5 bucks when you buy several. I had a couple of the 8266’s in my arduino box and decided to do a clock with it. I also had some DS3231 real time clock modules. After studying several different example codes I was able to piece together parts of several examples into a working clock.
The clock connects to a time server on the internet every time it is powered on or reset. The internet time is compared to the real time clock module time and if they are different by one second the real time clock module is updated with the internet time server time. The clock can be powered by a micro-usb cable and an old cell phone charger if it has the usual usb a port.
The display is an array of neopixel led units arranged in an 8×32 grid. I have complete control over the color and configuration of the digits. It is capable of displaying any color and brightness. Also it can be set to sync with any time zone and can display time in 12 or 24 hour modes. I prefer the 12 hour mode for normal time display but it comes in real handy for displaying UTC or Zulu time in the 24 hour mode for station logging.
Bill of materials:
- 8×32 LED Matrix 256 Pixels WS2812B strip $24
- DS2321 real time clock module $2-9
- ESP8266 ESP-12E developement board $4-8
- jumpers or switches
Connect the modules as follows:
- D1 on 8266 (SCL) to the SCL pin on the DS3231 module – i2c
- D2 on 8266 (SCA) to the SCA pin on the DS3231 module – i2c
- 3.3 V on 8266 to VCC on the DS3231 module
- GND on 8266 to GND on the DS3231 module
- D5 (GPIO pin 14) on the 8266 to neopixel array via a 1k to 2k resistor
- D7 (GPIO pin 12) on the 8266 to ground via a jumper or switch to enable daylight savings if needed
- VIN on 8266 to VCC on neopixel array
- GND on 8266 to GND on neopixel array
- .1uf cap across the neopixel VCC and GND
- Set the output voltage on a small buck converter to +5.0 – 5.1 volts
- Connect output of a small buck module to the 8266 VIN and GND terminals
- Power the buck converter from 6 to 18 VDC from a small wall-wart transformer.
I used a win10 pc running the Arduino programming environment to program the ESP8266 module. In order to program a ESP8266 with the arduino you must first add the ESP8266 board definitions to the arduino IDE. After adding the board definitions you must select which board you are using with the TOOLS menu of the arduino IDE. I used “NodeMCU 1.0 (ESP-12E Module)” which was the correct setting for the ESP8266 board that I bought from amazon. It helps to bring up the Windows Device Manager to determine which port the ESP8266 is connected to.
Several things in the code must be modified to work on your wireless network. First you must enter your networks SSID and Password. Next you must set your timezone offset in seconds from UTC. Leave offset to zero if you desire a UTC clock. (CST = -21600 CDT = -1800 GMT = 0). Other items that can be modified in the code is digit color, digit brightness, and whether or not to display leading zero on the hours in 12 hour mode.
If you are interested in building this clock I will be happy to email you the code.
Dave Opitz WA5X — firstname.lastname@example.org