WS2812b Led Ring Christmas Tree

This tree design is based on the tree featured here: https://hackaday.io/project/18821-ws2812-christmas-tree

My plan was to cut the tree out on my CNC machine using a single fluted endmill. After shattering a couple of sheets of acrylic this idea was abandoned. The design file was sent to https://www.ponoko.com/ for laser cutting. The design fits into a P1 sheet and was cut using 0.118 inch clear acrylic. Here is the design file that can be uploaded to be cut: https://github.com/mdunakin/Ws2812bChristmasTree/blob/master/Design/tree5.svg

The code is just a configured version of the FastLED DemoReel1000 example code. It can be found here: https://github.com/mdunakin/Ws2812bChristmasTree

Construction was not super complex. The two tree pieces were hot glued together. The led rings were attached from smallest to largest. When the ring was attached it was wired with 30 awg wire wrap wires. The ground and vcc on the rings were connected together. The data out on the rings was connected to the next rings data in. As a small side note these wire strippers are amazing if you want to strip wire wrap wire https://amzn.to/2SaPNAG

Here is a picture of the constructed tree:

IMG_20181208_162236

Here is a video. The tree looks much better in real life.

https://www.youtube.com/watch?v=gBCcFjnqSJw

Advertisements

Solar Powered ESP8266 Wemos D1 WIFI sensor node for Domoticz using ESPEasy

This post will cover building a low power solar WIFI sensor node using a Wemos D1 module. The module is loaded with ESPEasy firmware and reports sensor data to a Domoticz server.

The sensor nodes can be used with any of the sensors the ESPEasy firmware can support. This includes temperature, moisture and a host of other physical and environmental inputs and outputs. A full list is located here: https://www.letscontrolit.com/wiki/index.php/Devices

Hardware:

Bill of materials:

Description Notes Qty
JST-XH 2 Pin Header Male 2
JST-XH 2 Pin Pigtail Female 3
1N4004 Diode 1
.1″ Header Female (8 Pin) 2
.1″ Header Male (8 Pin) 2
.1″ Header Male (2 Pin) For Sleep 1
.1″ Header Male to Female (8 Pin) 2
TP4056 DW01A Charger Board Module 1
Mini 12-cell Polycrystalline Solar Panel 6V 1
18650 or other lithium ion Battery 1
Wemos D1 1
Wemos D1 Mini LiPo Battery Shield 1
Heatshrink for battery wires 1
Dry Box 135*80mm*40mm 1
Optional PCB Gerber Link Below 1
Optional Target Sensor 1

The first two versions of this sensor node were built by hooking  .1″ headers together and fixing all the components inside a large dry box with double stick tape. Here is a photo of the first two versions:

These versions were somewhat time consuming to reproduce so a PCB was spun to help speed up build times.

KIMG1721

Here is a link to the gerbers: https://github.com/mdunakin/PCB/tree/master/WemosD1Plate

This PCB takes power in from a solar cell on the left JST-XH connector. This is fed through a 1N400X diode that is acting as a bypass diode. This then feeds into the Blue PCB shown at the top. This PCB acts as a charge controller. Ideally the charge controller on the Wemos D1 mini LiPo battery shield could be used but it lacks over discharge protection. This is the reason for the secondary charge controller. The left JST-XH connector is used to attach the LIPO battery and the red and black wire are fitted with a female JST-XH connector that plugs into and powers the Wemos D1 mini LiPo battery shield.

JP2 and JP3 are used to break out the IO pins on the Wemos D1 mini. The sleep jumper allows for the Wemos D1 to be put into a deep sleep mode conserving battery power. The sleep function is documented here: here: https://www.letscontrolit.com/wiki/index.php/Devices

KIMG1806

Configuration:

Before getting sensor readings you will need to get a copy of Domoticz from here: https://domoticz.com/ I recommend running this on a computer that will be on all the time and also running it as a Windows service.

You will also need to flash your Wemos D1 with the ESPEasy firmware https://www.letscontrolit.com/wiki/index.php/ESPEasy This was a simple process. You just grab the installer from the link above. Run the executable and point it at the correct serial port.

 

Hardware Configuration:

The hardware configuration can be broken down into two main parts. Configuring the ESP8266 to send the data and configuring the Domoticz server to receive the data.

Before configuring the sensor it needs to be created in Domoticz to get the IDX number so the ESP8266 knows where to send the data.

This is done by adding “dummy” hardware in Domoticz and then selecting the “create virtual sensors”  button.

Domo2

After that create a “Temp+Hum” sensor:

Domo6

Here is the configuration for the ESP8266 using ESPEasy firmware:

DHT22

Make sure that the Domoticz server is configured on the ESP8266:

WemosServer

Battery Monitor:

Battery voltage monitoring is described here:

https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/

Here is a setup screen on ESPEasy:

AnalogAdc

Here is the corresponding Domoticz setup:

Create a dummy Hardware device:

Domo

Click the create virtual sensors button

Domo2

Add a voltage sensor

Domo4

 

Sleep:

To get ESPEasy to sleep, configure each configured device to take readings at the interval you desire on the devices tab. Then under the config tab set the interval.

Domo5

After that cut power by disconnecting the battery and solar cell and set the sleep jumper on the PCB and re-power up the system. If everything is configured correctly the device will now sleep between readings. Note, when first powered up the ESP8266 will have a responsive web server for 30 seconds before going to sleep.

Here is some data that was collected from a previous sensor deployed during summer:

WemosTest2WemosTest

The PCB assembly and battery are packaged in a small dry box with a solar cell mounted to the lid. The DHT 22 will be placed into a Stevenson Screen that was purchased from: http://www.misolie.net/plastic-outer-shield-for-thermo-hygro-sensor-spare-part-for-weather-station-transmitter-thermo-hygro-sensor-p-515.html

KIMG1814

KIMG1810

Binary Compare Game

As a kid one of my favorite book series were Forrest Mims Circuit Scrapbooks. They were interesting to read and build the circuits out of. One of the projects that was in my opinion the most fun to play with is a binary guessing game from The Forrest Mims Circuit Scrapbook, Vol 1 page 121. Since prototype PCB prices have dropped recently due to competition in China this was a project that seemed interesting to convert to a PCB.

Schematic:

Capture

Changes to above schematic:

  • A 10K pullup was added to the 74193 side of S1 to prevent noise from loading new numbers to guess.
  • A .1 μF bypass cap was added to the 555 timer to prevent ringing in the output.
  • The circuit is powered by a 9V battery. This battery goes to a switch. After the switch a LM2596 buck module is used to drop the voltage down to 5V

Gerbers:

https://github.com/mdunakin/PCB/tree/master/BinaryCompare

Photo of finished PCBA:

KIMG1401

 

 

Door Ajar Sensor

This project was created to address an issue with the layout of my house. The door from the garage into the house overlaps with another door. If this door is left open it could get hit by the overlapping door. To prevent this from happening a visual indicator was installed to show if the overlapping door is left open.

Circuit:

Schematic

VCC is supplied by four AA batteries. The circuit is broken down into two parts. On the left is a circuit that shows if the door is open. On the right is a low battery indicator.  LED2 is a flashing led. This part was selected to lower current draw versus an always on led. U1 is an open collector voltage sensing chip that triggers at 3.6V.

Gerbers and BOM for the PCB can be found at:

https://github.com/mdunakin/PCB/tree/master/DoorAjar

Photos of completed and installed circuit:

Garden Time lapse with Security Camera

The goal of this was to get a long term time lapse of my garden growing each season using off the shelf hardware. The camera used for this is a SV3C SV-B01-1080PL bullet camera powered with POE.  The camera is mounted outside with a fixed view of the garden. At the start of this project a new gmail account was acquired to be used with only this camera. The email section of the camera was configured and tested. Then then camera was configured to send an image every hour to the above mentioned gmail account.

CameraConfig1

To date this has resulted in eleven thousand plus emails with photos. Manually downloading and extracting the photos seemed like a tedious and boring  process so a different route was found using the Thunderbird mail client. The client was installed and configured to use the gmail account. Then the attachment extractor extension was added.

attachment

This extracted all the attachments to a folder. The extracted images had varying degrees of brightness so the output folder was batch processed using  PhotoScape.

Capture

After the batch processing was done the group still contained images that happened during night times or photos with excessive shadows. Luckily the output files had a similar file nameing structure so a simple C# program was written to move and re-name photos shot during specific times of day. The paths will need to be tweaked to run it on a different system. Here is the code:

using System;
using System.IO;

namespace PhotoCleaner
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var folderLoc = @"C:\Users\media2\Desktop\New folder";
                var destFolderLoc = @"C:\Users\media2\Desktop\Output";
                var directoyInfo = new DirectoryInfo(folderLoc);
                var Files = directoyInfo.GetFiles("*.jpg");
                var counter = 1;
                foreach (FileInfo file in Files)
                {
                    Console.WriteLine(file.Name);
                    //file.Name = "IMG_chn0_TIMER_MNG_20170522164542_001.jpg"
                    var fileName = file.Name.Trim();
                    fileName = fileName.Replace("IMG_chn0_TIMER_MNG_", "");
                    var year = fileName.Substring(0, 4);
                    var splitFileName = fileName.Split('_');
                    if(splitFileName.Length == 2)
                    {
                        var rawDate = splitFileName[0];
                        var hour = rawDate.Substring(8, 2);
                        var hourInt = int.Parse(hour);
                        if(hourInt = 16 && year == "2018")
                        {
                            File.Copy(Path.Combine(folderLoc, file.Name), Path.Combine(destFolderLoc, $"frame{counter.ToString().PadLeft(4, '0')}.jpg"));
                            counter = counter + 1;
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadLine();

            }
        }
    }
}

After running the above code a folder with files named frame0001.jpg, frame0002.jpg… should be generated. To stitch the files together FFMPEG was used. After installing FFMPEG it was added to the system path. This blog helped figure out the different flags that needed to be set in FFMPEG http://notes.theorbis.net/2010/05/creating-time-lapse-with-ffmpeg.html The parameters suggested in the blog post were tweaked slightly to end up with this:

ffmpeg -r 12 -i frame%04d.jpg -qscale 0 -s hd720 -vcodec libx264 -preset fast -crf 25 OUTPUT.MP4

Here are the results:

2018 (short):

2017-2018 (long):

Improvements:

The above C# code could be improved by accounting for sunrise and sunset values in the time calculations. This should account for the sun shifting in other seasons and make the video have less of a strobe like occurrence from shadows.

Using ke5fx HP 7470 plotter emulator with a 54659B module on a 54600B oscilloscope

This write up will talk about modifying the ke5fx HP 7470 plotter emulation software to work with a 54600B oscilloscope using Microsoft Windows.

NOTE: make sure to use a null modem cable

Steps to setup computer:

      1. Get a working serial port on your computer with a USB to serial converter or a native serial port.
      2. Download the ke5fx software from: http://www.ke5fx.com/gpib/7470.htm
      3. Modify default_connect.ini Comment out the top line and add the second line (Make sure your com port is correct):
        ;interface_settings GPIB0
        interface_settings com3:baud=19200 parity=N data=8 stop=1

        also modify:
        is_Prologix 1
        To
        is_Prologix 0
      4. On the 54600B go to the print menu and make sure the scope is in DTR mode, also make sure the scope is set to 19200 baud.

Steps to print image to computer:

  1. Make sure that the com port your device is on matches the default_connect.ini file. If it does not then edit the file or use the device manager to change the assigned to serial port mappings.
  2. In the ke5fx 7470.exe software choose this option:scope1
  3. Press print screen on plotscope