Saturday, March 25, 2023

Twitchboard - Prop controller with Triggered and Random Background Activation

Sometimes you just need a -little- chaos. 

So you’ve built or bought this amazing prop. You don’t want it on continuously, because that gets boring. You want it occasionally and unexpectedly going off in the background, and then you want it to really go off when triggered by an unsuspecting victim…errr, guest. You need a Twitchboard.

The new Twitchboard is the little sibling to the Twitch-n-howl board. Coming in at half the size, half the price, the Twitchboard is a trigger-able 12V prop controller that also provides an adjustable random background rate of activation.


Just like the Twitch-n-Howl board, the Twitch board can be triggered by a wide variety of sensors and buttons. Anything that runs on 5V and returns a "HIGH" signal put the board in "ON" mode where it gives more frequent activation. PIR sensors work great, but even simple buttons can add some fun interaction.

Random Background Rate

The (pseudo)random background event rate for the Twitchboard is based on a Poisson process. If you’re interested in traveling down that particular rabbit hole, click here to read my blog post on the topic. Otherwise, it’s sufficient to know that this results in a background frequency of events that feels less predictable. Events occur both earlier and later than your brain expects. The average frequency of these events is adjusted by the potentiometer and ranges from every 10 seconds to every 2 minutes. If you need something different, just let us know, and we'll adjust the code before we send it to you. 


The Twitchboard gives a 12V output signal. This can be used to activate lights, motors, and relays. The default duration is 200msec which works well for flashes of light and brief motor signals like door lock actuators or vibration motors. If you need a longer (or shorter) duration of signal for a motor driven prop such as a leering skeleton or cauldron creep, just let us know, and it can be set for whatever you like. If you want to run a smaller motor (6V for example) or a 12v motor more slowly, the PWM signal can be adjusted when we program the chip. Unfortunately, the Twitchboard does not have an output for sound. If you need audio, check out the Twitch-n-Howl board.

Open Source

The Twitchboard is open source (code and schematics) and fully end user modifiable. The code for the board runs on an ATTINY85. Jekyll-Labs loads the initial code, but this chip can be further programmed using most standard Arduino commands in the Arduino IDE. Sparkfun has a great tutorial on the subject. Take what we've created and make it your own.

Monday, March 13, 2023

Twitch-n-Howl board v2.2 — prop controller with sensor triggered and random activation of light, movement, and sound

It’s alive…

Movement is great. So are lights. But sometimes things are a bit too quiet and predictable.

Open source design. Open source code. Fully end-user modifiable. Footprint smaller than a playing card.

About a year ago I started working on a prop controller for my Halloween display. I wanted something that would deliver bursts of movement and synchronized audio. It needed to be trigger-able by a sensor, but also have some “background level” of activity that was unpredictable and added to the ambiance of the haunt. It’s taken some time, but I finally have something that’s ready to share with the haunt community. 

The Twitch-n-Howl board is a single sensor, single event (12v output plus sound) trigger board. In the untriggered state, events are randomly triggered at a modifiable low background rate. When triggered, the controller switches to an ON-state giving more frequent events. 

Sounds Great! How do I get one?

Check out the Jekyll-Labs Store and send me a message though the Contact Me box. If you’d like to learn more, keep scrolling down.


A variety of sensors and buttons can be used to trigger the Twitch-n-Howl board. I’ve tested it with buttons, PIR sensors, and capacitive touch sensors. It is set to respond to a “HIGH” state, so anything that connects the +5V line to the sensor line will trigger it just fine.

Random Background Rate

The (pseudo)random background event rate for the Twitch-n-Howl board is based on a Poisson process. If you’re interested in traveling down that particular rabbit hole, click here to read my blog post on the topic. Otherwise, it’s sufficient to know that this results in a background frequency of events that feels less predictable. Events occur both earlier and later than your brain expects. 


The 12v output can be used to run a multitude of props. I've set it up with flashes of light (for a cannon or for a jump scare) and a variety of motors (from 12v wiper motors to 3v small DC motors). If the prop has a button activation (for a try me sensor or a fog machine trigger) a Bosch automotive relay works perfectly. It's also easy to control AC (fans and lights) with a solid state relay. The duration of the output is controlled by the duration potentiometer dial. 


Sound effects are supplied by the JQ-8900 16P daughter board. This board has a USB port and when connected by a cable is recognized by most PCs as a USB thumb drive. It is a simple matter to rename your files as 0001.MP3, 0002.MP3… and then drag and drop them to the JQ-8900. When an event occurs (triggered or background), the board will randomly play one of the MP3 files. Audio is available as line level output or 3 watt amplified output which can run a medium sized speaker. 

Open Source

Jekyll-Labs builds products for makers. We want you to take what we’ve created and push it further. All of our designs are open source schematics and open source code. The Twitch-n-Howl board is fully end user modifiable. It uses the same chip as the Arduino Uno and new source code can be written and uploaded using the Arduino IDE. Make the Twitch-n-Howl board what -you- want it to be.


The Twitch-n-Howl board has a footprint approximately the size of a standard playing card. As such it will fit in a wide variety of different enclosures. The PCB was initially designed to fit in the Z&X G713 waterproof electrical box. It is a sturdy box with a nice silicone gasket. Jekyll-Labs does not recommend trying to set it on fire or leaving it underwater without additional sealing (as the manufacturer suggests), but for standard weatherproofing, it seems great. You can purchase the enclosure separately from amazon, but if you it from Jekyll-Labs, the case will also protect the device during shipping.

Links to Sample Projects (coming soon)

Additional Pictures

Saturday, March 11, 2023

Generating a Poisson Process from Uniformly Distributed Pseudo-random Numbers


Most microprocessors generate pseudorandom numbers that follow a uniform distribution. This is great for simulating things like rolling dice where the probability of rolling a 1 is the same as rolling a 4. It turns out, however, that for most natural processes, the time between events is more accurately modeled using an exponential distribution of random numbers. This results in both more clustering of events and larger gaps in between them. These are called poisson processes because the distribution of events-per-time-interval follow a Poisson distribution. 

In both of the two samples below, there are twenty events per time interval. In the first sample, events are spaced using a uniform distribution of random numbers. In the second sample, events are spaced using an approximate exponential distribution (thereby generating a Poisson process). 

It’s a subtle difference, but the exponentially spaced events seem less regular—they occur both earlier and later than expected. The Poisson distribution has been fitted to a wide variety of natural events. Events as varied as radioactive decay/clicks on a Geiger counter, lightning strikes, and Prussian soldiers killed by kicking horses have all been described as Poisson processes. 

This default code for the Twitch-n-Howl board uses a mathematical transformation to convert the uniformly distributed pseudorandom numbers into exponentially distributed numbers.

where u is the uniformly distributed random number and lambda is the rate parameter (# of events per unit time)

This same transformation is depicted graphically below. The blue line shows a uniform distribution of random numbers, while the red line shows an exponential distribution of random numbers. Both distributions have the same mean and area under the curve. 

These exponentially distributed random numbers are used to determine spacing between events. One can see that using an exponential distribution of random numbers to determine event spacing would result in some events closer together and some events further apart than would be present using a uniform distribution of random numbers for event spacing. This is one of the properties of a Poisson process and helps explain why natural random events seem so unpredictable. 

Friday, March 3, 2023

Flicker LED Amplifier

Flicker LEDs are nifty little components. Give them a tiny bit of current, and they produce a light that bounces up and down in a random-appearing fashion. It can bear a passing resemblance to the flame of a candle. The main problem with these LEDs is that they aren’t very bright. I have my Lightboard with a nice firelight effect, but I still wanted something cheaper and simpler with almost as nice of an effect.

Most of these LEDs have a small integrated circuit embedded in the plastic head that can seen if you look closely. 

image from Tim's Blog

There’s a great discussion of reverse engineering these flicker LEDs in Tim’s Blog post “Hacking a Candleflicker LED”. He uses a logic analyzer to look at current drawn by the flicker LED. This reveals what appears to be a PWM signal of varying intensity that controls the flicker effect.

He then goes on a really impressive deep dive quantifying the PWM levels and speculating on the pseudorandom sequence generation. —Go read it, seriously. It’s not long and really fascinating.—

Windell Oskay, over at Evil Mad Scientist, put together a great post "Does this LED sound funny to you?" in which he uses a PNP transistor to amplify the signal being drawn by the flicker LED. he then sends this to a LED and then a speaker. Unfortunately the STX790a transistor he selects has been discontinued, and I had some difficulty finding a similar spec’d transistor (ie stopped after 10 minutes of google-ing). I did have some PN2907 PNP transistors lying around. I tried one of those in Oskay’s circuit. 

The flicker LED would flicker nicely, but unfortunately just caused the transistor to continuously conduct. The secondary LED would just stay lit, perhaps a bit dimmer than usual. Interestingly enough, when I hooked the transistor up backwards (still in the same place in the circuit, but just swapping the collector and the emitter leads) both the flicker LED and the secondary LED would flicker. The effect seemed stable. The transistor was still working as a PNP transistor, but just with unknown specs. Seemed kind of sketchy and not exactly something I could recommend to others… So back to my parts box…

I have several "logic-level" N-channel mosfets lying around in my parts box, specifically the IRLB8721 and the FQP30N06L. I use both of these frequently for rapid switching (PWM and otherwise) up to a few amps of current at 12V. 

I set up my mini digital oscilloscope to query the voltage at a few points along a simple flicker LED circuit and found that I could reliably detect the signal between the LED and the resistor when they were arranged like this.

This meant that I could replace the oscilloscope with my mosfet and use that to turn on and off my secondary LED. In order to protect the LED from the few picoseconds of in rush current to the gate when the fet was switching, I split the resistor before and after the LED like this-

This gave me the following signal

Voltage reliably switches back and forth between 0 and 5v. Perfect for running my mosfet. (Interestingly, it looks like the flicker LED uses an approximately 400Hz PWM signal and varies the duty cycle to change brightness. Most of the time the LED is full on, but will give “flickers” of various lower duty cycles.) This gave me the final circuit diagram.

The circuit is easy to put together on a breadboard, but I wanted a cleaner solution that could run flicker lights for several pumpkins, so I put together a PCB. 

Here’s a picture of the board assembled and mounted. It has holes placed such that a zip tie can fasten the board to a 1/2” PVC T fitting. I can then slide a plastic cup over the top. This lets me mount it in the yard, covered from rain, and able to drain well.

And finally, here’s a video of the circuit in action and my assembly of an electronic PVC candle.

So, I’m still rather partial to the firelight effect on my Lightboard, but if you’re looking for something that doesn’t need any coding, this circuit is a great option. You can easily put this together on a breadboard, but if you’d like a more streamlined solution, I’m happy to put a PCB board in the mail. Check out the Jekyll-Labs Store and contact me through the link in the side bar. 

Friday, December 30, 2022

JQ8900-16p MP3 player

So, I'm really pleased with this new (to me) MP3 player that seems like a nice alternative to the DFPlayer. Its manual is sometimes hard to find so I've hosted a copy of the PFD below. First and foremost, it has onboard storage for audio files. Your computer recognizes it as a USB drive, so it's a simple plug-n-play then drag-n-drop. 

To trigger the audio the JQ8900 has a few options:

 (1) There is a two-way serial connection using the Rx and Tx pins. This is the most robust way with many options analogous to the DFPlayer serial connection. Unfortunately, the serial commands are different from the DFPlayer, and I'm not aware of an existing Arduino library. Fortunately, the JQ8900 seems to be based on the JQ8400. The JQ8400 does have an Arduino library, but I have not personally used it. Both the JQ8900 and the JQ8400 have manuals that have been translated into English and have good information. 

With the JQ8900, I'm partial to using the serial commands directly. "AA 06 00 B0" will play the next file. I've included below some example code that will every 5 seconds play the next file in sequence.

(2) There is a single wire input mode available using the VPP pin. I haven't personally used this, but there are many examples online (unfortunately for me, mostly in Chinese)

(3) The JQ8900 has 7 trigger pins. These are great. When the IO1 pin is connected to ground the JQ8900 will play the file named 00001.mp3 (and so on). This works well for manual buttons as well as microcontrollers. With this board, I used an ATTINY85 sending a signal to an NPN transistor to connect IO1 to ground. 

Audio output is either speaker output (appears to be a 3W amplifier) or line level output via DAC and ground. For both outputs, the JQ8900 collapses the right and left channels into a single mono channel. This is a disadvantage as compared to the DFPlayer, which has mono output for the speaker, but stereo ouput for line level. If you need stereo output, the JQ8900 may not be the board for you. 


JQ8900 Manual - English version

JQ8400 Manual - English version

JQ8400 Arduino Library

excellent collection of links [Chinese] The JQ8900-16P voice module hardware usage _ Lin Zhong Qiyuan's blog - CSDN blog _jq8900

//include libraries
#include "Arduino.h"
#include "SoftwareSerial.h"

SoftwareSerial mySoftwareSerial(15, 14); // RX, TX

void setup(){
  pinMode(4, INPUT);

void loop()
  byte playnext[] = {0xAA, 0x06, 0x00, 0xB0 };
  int trig = digitalRead(4);
  if (trig == HIGH) {  
  mySoftwareSerial.write(playnext, sizeof(playnext));

Monday, December 5, 2022


 Previously I worked on a motor controller board that would deliver random pulses to a prop. It worked well, but I was not quite happy with the randomization algorithm, and I wanted more titratable control over the pulses. Additionally I wanted something that could be triggered by either a PIR sensor or a button.  

I’ve now produced a beta version of this new controller and I’m looking for feedback. Here’s a demo video—

This is the schematic—

And here is the code—

//  Jekyll-Labs Twitchy Attiny85
//  Built for Twitchboard v1.5
int fetpin = 0;
int trigpin = 1;
int potMpin = A1;
int potRpin = A2;
int potLpin = A3;
int lambda = 5; // number of event
int timeunit = 60; // in this time interval (sec)
unsigned long last = 0;
unsigned long timeinterval = 0;
float exprob=0;

void setup() {
  pinMode(fetpin, OUTPUT);
  digitalWrite(fetpin, LOW);
  pinMode(trigpin, INPUT);
  pinMode(potLpin, INPUT);
  pinMode(potMpin, INPUT);
  pinMode(potRpin, INPUT);

void loop() {
  // duration of signal will last from 0.5 - 10 sec
  int durationpot = analogRead(potRpin);
  long duration = map(durationpot,100,1023,500,10000); 
  if (duration <500) duration = 150;

  // read middle pot for PWM of fet signal
  int PWMpot = analogRead(potMpin);
  int PWM = map(PWMpot,0,1000,0,255);
  if (PWM>255) PWM = 255;

  // mean frequency of random signals is 5 events per time unit
  int freqpot = analogRead(potLpin);
  int timeunit = map(freqpot,512,1023,60,300); // 2nd half dial range 1-5 min
  if (freqpot>1000) timeunit = 3600; // far right dial 1hr
  if (freqpot<512) timeunit = map(freqpot,0,512,0,60); // 1st half dial range 10-60 sec
  if (freqpot<100) timeunit = 0; // bottom of dial continous on  

  if (timeunit<=0){ // continuous on if left dial all counter clockwise
  else {
    // Check for trigger (X3 for debounce) and adjust
    // timeunit if trigger is positive.
    if (timeunit>0) {
      int trigger = digitalRead(trigpin);  
      if (trigger == HIGH) {
        int trigger = digitalRead(trigpin);
        if (trigger == HIGH) {
          delay (100);
          int trigger = digitalRead(trigpin);
          if (trigger == HIGH) {
            timeunit = (duration * 10)/1000;
    // Calcuate time interval between events. timeunit depends on:
    // Potentiometer value if trig = 0 
    // Duration multiplier (shorter) if trig = 1
    unsigned long timeinterval = exprob * timeunit * 1000;    
    // Check if time interval has passed
    if ((millis() - last) > timeinterval) {
      last = millis(); // updates timer to last event
      // the following equation runs once per event and 
      // generates a random float (exprob) that falls in an 
      // exponential distribution. It will be used to
      // determine the interval time for the next event.
      // Events that occur at exponentially distributed  
      // intervals form poisson processes.
      exprob =  (-1)*(log((100-random(100))/100.00)/lambda);
    else digitalWrite(fetpin,LOW);

Thursday, August 18, 2022


**Updates Log**

9/27/22 code updated for millis() rollover

2/3/23 parts list included

 So I’m, really happy about this new board I had made.

It uses a Arduino Nano to control PWM signals for six different channels of lights. There are two potentiometers, one to select the effect, and a second to change the speed of that effect. The board uses IRLB8721 mosfets to control current to the lights. According to Adafruit these mosfets are capable of switching 15A of current so each channel could run several lights in parallel.

These are the lights I use. They were suggested by another haunter, because they are waterproof, they fit inside a PVC fitting, and draw only 60mA at 12V DC. To find them you can search Eagle Eye LED 18mm on Amazon/EBay/AliExpress.

Here’s a 4 minute demo of the board in the lab:

There are 4 different effects:

1. Solid - all lights are on and dimmable by the speed potentiometer

2. Firelight - a low flicker meant to evoke the light of a fire. Works well with several amber on the same channel and 1 dim red on another channel

3. Wavey - All channels slowly pulse on and off at slightly different wavelengths so they don’t synchronize. Speed potentiometer controls how fast they pulse

4. Lightning  - Each channel strobes on with a random delay and a random number of flashes. Speed potentiometer controls how frequent the flashes are. 

**I'm not in the business of selling Halloween circuit boards, but I usually have to order more than I need for any given project. If you're into DIY electronics (and let's face it, you wouldn't be reading this otherwise), and want one of my boards, send me a PM.** 

Here's the Fritzing:

The schematic:

Here's the code for the nano: (updated 9-27-22 to fix millis() rollover.)

// Jekyll-Labs Lightboard v1.0
//  D2 sensor
//  D3 Power MOSFET (PWM avail)
//  D4 sensor
//  D5 Power MOSFET (PWM avail)
//  D6 Power MOSFET (PWM avail)
//  D7 Unused
//  D8 Unused
//  D9 Power MOSFET (PWM avail)
//  D10 Power MOSFET (PWM avail)
//  D11 Power MOSFET (PWM avail)
//  D12 unused
//  D13 unused
//  A0/D14 Unused
//  A1/D15 10k potentiometer
//  A2/D16 10k potentiometer
//  A3/D17 Unused
//  A4/D18 Unused
//  A5/D19 Unused
//  A6/D20 Unused
//  A7/D21 Unused

int ledpin[] = {3, 5, 6, 9, 10, 11};
int effectpin = A1;
int freqpin = A2;
int effect = 0;
int freq = 0;
int brightness[6];
int oldbrightness[6];
int fldelay = 75; // fire light flicker delay
int flalpha = 20; // fire light alpha 0-100 (low values less dynamic changes)
unsigned long  lastupdate[6];
int between=500;
int randwavel[6];
int wavelength[6];

void setup() {
  for (int i =0; i<=5; i++) {
  for (int i =0; i<=5; i++) {            //setting variables for flicker
    brightness[i]= random(256);
    oldbrightness[i] = brightness[i];
    randwavel[i] = random(500);

void firelight(){
  for (int i =0; i<=5; i++) {
    if ((millis()-lastupdate[i])>fldelay) {
      lastupdate[i] = millis();
      brightness[i] = random(255);
      brightness[i] = (flalpha * brightness[i] + (100 - flalpha)*oldbrightness[i])/100; 
      oldbrightness[i] = brightness[i];

void wavey(){
  for (int i =0; i<=5; i++) {
    wavelength[i] = (freq/100)*1500 +1000 + randwavel[i];
    int remainder = millis() % wavelength[i];
    if (remainder <wavelength[i]/2){
      brightness[i] = map(remainder, 0, wavelength[i]/2,-128,384);
      if (brightness[i]<0) brightness[i]=0;
      if (brightness[i]>255) brightness[i]=255;
    if (remainder >=wavelength[i]/2) {
      brightness[i] = map(remainder,wavelength[i]/2,wavelength[i],384,-128);
      if (brightness[i]<0) brightness[i]=0;
      if (brightness[i]>255) brightness[i]=255;

void solid(){
  freq = map(freq,100,923,0,255);
  if (freq<0) freq=0;
  if (freq>255) freq=255;
  for (int i =0; i<=5; i++) {

void lightning(){
  for (int i =0; i<=5; i++) {
    if ((millis() - lastupdate[i])> between) {
      for (int c=0; c< random(7); c++){ 
        digitalWrite(ledpin[i], HIGH); 
        digitalWrite(ledpin[i], LOW); 
      int lidelay = map(freq,0,1023,3000,20000);
      between = 500+ random(lidelay);
      lastupdate[i] = millis();

void loop() {
  freq = analogRead(freqpin);
  effect = analogRead(effectpin);
  if (effect<100) solid();
  if ((effect>=100)&(effect<512)) firelight();
  if ((effect>=512)&(effect<923)) wavey();
  if (effect>=923) lightning();

Parts List and links

Where convenient, I’m including links to parts on Digi-Key. I do not receive any commission from Digi-Key (or the parts fabricators), and I can’t vouch for the specific parts I link to. But I generally find Digi-Key to be very reliable with a good library of parts. You may find cheaper prices elsewhere.

1- Arduino nano
    Or suitable clone

2- 15 pin female headers
    Also can use a long strip of female headers and cut to fit

6 - N Channel Mosfets
    I like the IRLB8721PBF mosfet, but any logic level mosfet with enough volts should work. FQP30N06L is also a solid choice. 

2 - 10k Potentiometers
    Rather expensive here. There are cheaper ones elsewhere, but quality may be an issue.

7 - 2 channel 5.08mm pitch phoenix screw headers
    Any 5.08mm (0.2”) pitch screw terminal will work, but I really like the mechanism on the Phoenix product. 

Wednesday, August 17, 2022

Fake Electric Zap (capacitive touch)

Another Haunter on Facebook asked about making a barb wire fence that would make an "electric shock" noise when you touched it. That inspired me to put together a quick prop based on capacitive touch.

It’s pretty simple to put together. No Arduino involved. The sound comes from an Adafruit Sound FX board. They aren’t the cheapest option, but really easy to work with. I've saved a sound clip of electric shock to the board's memory as T01HOLDL.wav. This way it will play the sound whenever pin #1 is connected to ground. WAV files require less decoding so play faster. Pin #1 is hooked to the output from a capacitive touch sensor. The sensor is set to give a ground signal when you touch it, 5v when you don’t touch it. For this particular sensor, you need to add a glob of solder to connect the "A" pads.  I then scratched off some of the plastic covering the sensor and soldered a long wire to the sensor. That’s then connected to the outlet (which is of course NOT connected to household power or anything else.) 5V DC power from a wall wart transformer (or even 3 AA batteries) run to the power pins for both the sound board and touch sensor.

I highly recommend the Adafruit tutorial on their SoundFX boards. There are cheaper options for audio (DFPlayer mini is one of my favorites) but Adafruit is a great place to start. Adafruit also sells a great Capacitive Touch sensor board, but this one is cheaper and has the option to output ground signal with touch. 

Friday, July 1, 2022

Spider Victim with Random Twitching Movement

I wanted to show off a twitching victim I made for a friend's spider themed haunt. Here's a video of the prop in action.

The mechanism is based on an automatic car door lock motor like this:

It's available on Amazon for about $6 and runs on 12v DC. Here are a couple close up pictures of the mechanics. 

The PVC and motor were then covered with plastic bags for bulk and then a couple layers of plastic treated with a heat gun to give the right corpsed/spun web appearance. 

This electronics for this project are an extension of a lighting simulator I made previously. For this project, the frequency of the random twitches are controlled by the potentiometer. The arduino sends 5 volt signals to the mosfet which in turn controls the 12 volt motor. 

To keep things small and cheap, I built the circuit based around an ATTINY85. These processors are great because they are very cheap (usually <$2) and programmable using the Arduino IDE. Here's a picture of the board. 

Alternatively this could be built with an arduino uno and mosfet as a simple first arduino project.

Here's the schematic for the circuit:

And here's the code: [code updated 8/29/22 to account for millis() rollover] 

//  Jekyll-Labs Twitchy Att
//  Built for Randflash board v1.1
int fet = 0;
int pulses = 1;
int pot = A1;
unsigned long start = 0;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(fet, OUTPUT);

// the loop function runs over and over again forever
void loop() {
  int potsens = analogRead(pot);
  if (potsens < 120) potsens = 0;
  unsigned long delaybonus = map(potsens,0,1023,0,600000);

  if ((millis() - start)>(3000 + delaybonus)){
    start = millis();
    pulses = random(3)+1;
    for (int i = 0; i < pulses; i++) {
      digitalWrite(fet, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(150);                       // wait for a second
      digitalWrite(fet, LOW);    // turn the LED off by making the voltage LOW
      delay(600);                       // wait for a second
  else {

Wednesday, June 22, 2022

Lightning Simulator

I decided to start playing with the Attiny85 processors because they are small, cute, and cheap. I love the arduino nano, but even the knockoff clones shipped from China are costing more than $5. I decided a great first project would be the lightning simulator. Here's a video of the final project:

Here is the Fritzing layout: (with 12v's worth of AA batteries and a single LED for the 12v light)

and the schematic:

After making it on a breadboard, I had a PCB printed to make the process more compact:

The code is Rob Tillaart's lightning code. Simple and effective.
//    FILE: lightning.pde 
//  AUTHOR: Rob Tillaart 
//    DATE: 2012-05-08 
// PUPROSE: simulate lighning POC 
#define BETWEEN 2579 
#define DURATION 43  
#define TIMES 7 
#define LEDPIN 0 
unsigned long lastTime = 0; 
int waitTime = 0; 
void setup() 
  pinMode(LEDPIN, OUTPUT);  
void loop() 
  if (millis() - waitTime > lastTime)  // time for a new flash 
    // adjust timing params 
    lastTime += waitTime; 
    waitTime = random(BETWEEN); 
    for (int i=0; i< random(TIMES); i++) 
      digitalWrite(LEDPIN, HIGH); 
      delay(20 + random(DURATION)); 
      digitalWrite(LEDPIN, LOW); 
  // do other stuff here 



Monday, September 27, 2021

Electrical Connections — WAGO 221

I wanted to share a new method I’m using for making electrical connections in my yard holiday setup. I’ve been looking for something safe, waterproof and ideally modifiable/reusable for when I change my mind/layout.

I’m sure that others have discovered these previously, but I am loving the WAGO 221 lever nuts. Works for AWG 12-24, rated for mains mower amps/volts. Apparently more common in Europe for household wiring, but also certified by UL for household wiring in the US. I’m only using them for 12V 5A DC circuits, but it’s nice to know they’ve been well tested.

I’m using 18g landscaping “lamp” wire and 35mm film canisters for my junction boxes. Here are a few pictures of my set up. 

*I have no financial connection with any of this. Just sharing something that works well for me. 
** I’ve also tried a similar product that I found on Ali-express. It is much cheaper. But also much lower quality. Perfectly fine for throwing something together, but the wires fit in less well. I’d also never use it with mains power.

Monday, May 31, 2021

PVC Shop Vac Adapter

So, it would be lovely if shop vac hoses came in a size that mated well with PVC pipe. Alas, this just isn't so. 

 There are basically three options:

1) Proprietary adapter

        Expensive, not available, still may not work well.

2) Use a flexible coupler outside both pipe and hose

        Works, but looks a little unfinished

3) Make an adapter yourself

        Use a hot air gun and concrete mold

Here's a not so quick video of the process.

1) anchor bolt to scrap wood

2) Make a cone shaped mold out of a PET soda bottle and some tape. 

3) put mold on top of bolt and fill mold with concrete.

4) wait for concrete to harden completely (several days)

5) remove plastic mold. 

6) Use heat gun to soften PVC

7) stretch PVC over concrete mold and allow to cool. 

Color PVC

PVC is a great material. It's lightweight, relatively cheap, and easily obtainable at your nearest box store. One of the main problems with PVC, though is the color. Most of the big box stores will only cary plumbing PVC in white and electrical conduit PVC in grey. Other colors of "structural" PVC can be ordered, but it's expensive and hard to find. You can also try and paint PVC, but it is messy, and often flakes off. 

The best solution that I have seen is the technique of "staining" PVC that I first saw here in MAKE magazine.

The technique is pretty simple and basically similar to the purple primer we use prior to joining fittings for plumbing PVC. It turns out, Oatey PVC Clear Cleaner can be stained a variety of nice colors with petroleum dyes.

These petroleum dyes are commonly used to add color to kerosine for lamps, and for coloring gasoline in industrial applications. The quickest way to get your hands on some is searching ebay for petroleum dye or Rekhaoil dye. I purchase mine from this retailer. One ounce goes a long way (20-30 ounces of Clear Cleaner.)

Add a small amount of dye to the can and test on a scrap piece of PVC. Once you are happy with the color, use the can's applicator or a sponge paint brush to apply to PVC. Remember these products should only be used in a well ventilated place (outdoors). I also use double nitrile gloves or thick dishwashing gloves as this will be absorbed through your skin and stain your hands a lovely color.