Posts

Lightsaber prop - first prototype

Image
In a recent post on Hackaday , I described my initial plans for a lightsaber prop. The final device should be able to generate the characteristic buzzing noise, play sound effects stored on a flash chip, and respond to motion. In this article, I will explain the technical details of the first prototype. Overview As I described in the Hackaday aticle, my plan was to use an ATtiny85 to generate the audio and write to the DAC and use an Arduino Nano to read from the accelerometer and control the lights. The buzzing sould consists of a loop of 833 one-byte samples that are stored in the program memory of the ATtiny. The sound effects are stored as WAV files on the flash chip. The Nano can then write to the ATtiny to control the amplitude of the buzzing or start playback. Thus, the ATtiny must therefore be able to read the buzz sample from program memory, multiply it by its amplitude, multiply the previous playback sample by its amplitude, mix the buzzing and the playback, write to the

Improving and calibrating the capacitive water sensor

Image
In a previous article, I explained a type of water level sensor that works capactitively and therefore passes no direct current through the water. When I wrote that article, I had already made two of these sensors and installed one in each of the two sump pump wells in my basement. These sensors have been working quite well for a long time, but they have a few issues. In this article, I will describe the improvements I have made to the sensor design and how I calibrated the sensors to allow me to determine the water flow rate and the volume of water the sump pump pumps each time it comes on. Introduction The two water level sensors I installed in the sump pump wells were equipped with nRF24L01 wireless modules. They transmitted measurements every 30 seconds to a Raspberry Pi, which recorded them to a database. This allowed me to visualize the water level in the sump-pumps in real time and see roughly how often the sump pumps came on. However, the water level followed this interest

Controlling a washing machine motor with an Arduino

Image
In a modern washing machine, the moter that spins the drum is controlled by a motor driver, which is separate from the main control board that manages the washing cycle. The main control board sends commands that set the speed of the motor, and the motor driver generates the three-phase power needed for the motor and regulates the speed of the motor. In this article I will explain how I reverse engineered the motor driver (Magnetek 4246-99-1) from a washing machine and then controlled it with an Arduino. Reverse engineering the original setup In the washing machine, the motor driver received mains power through a relay on the main control board. The motor driver was controlled by the main control board via a 5-pin cable. The pinout is shown in the image below: The main control board communicates with the motor driver using an SPI bus. Data is transmitted in bytes with the most-significant-bit first. On the rising edge of the clock signal, the main board updates the signal on the MO

Self-starting inverter

Image
In this article, I will explain a circuit that can be used to automatically start an inverter when a load is connected to it and turn it off once the load is disconnected. This circuit works by biasing the output of the inverter with a low-current signal from the battery and waiting for a change in that signal. The circuit then uses a current transformer to monitor the current through the load. If there is no current in the load for a few seconds, the inverter is switched off. The inverter The inverter I am using is a modified square wave inverter. The voltage between the live and neutral terminals at the output looks like this: However, this diagram misses out on an important fact: the neutral of the output is not connected to the negative battery terminal. In fact, the modified square wave is generated by alternately switching the live and neutral terminals of the output to an internal high-voltage rail. As a result, both live and neutral are always positive relative to the nega

Powering mains-voltage LED Christmas lights from a 12 volt battery

Image
In this article I will present an inverter circuit I built to power mains-voltage LED light strings from a 12 volt battery. Unlike a traditional inverter, this device operates at a higher frequency, eliminating flicker in cheap LED light strings. The device can also switch the output of the inverter through a TRIAC, allowing the device to be programmed to vary the brightness of the light string. Depending on the configuration of the LED lights in the string, it can also vary the brightnesses of different parts of the LED string independently of one another. The schematic can be downloaded here and the program for the ATTiny can be downloaded here Principle of operation Generating the high voltage This inverter uses a transformer to generate a high voltage from a 12 volt power supply. This is done by switching the low-voltage coil of the transformer through an H-bridge, which consists of 2 N-channel MOSFETS and 2 P-channel MOSFETS: On the left, we have a 500Hz source that drives

Algorithm for generating passive filter circuits

Image
In this article, I will describe an algorithm that can be used to compute component values in a passive filter circuit from the filter circuit's transfer function or poles and zeros. For this article, I will consider a passive filter circuit to be a filter circuit with one input and one output consisting of only ideal inductors, capacitors, and resistors with positive values. Inductance, capacitance, and resistance matrices Consider the following circuit: This circuit has 5 nodes (\(V_i\), \(V_g\), \(V_1\), \(V_2\), and \(V_3\)) and 5 components. Recall that the impedance of an inductor is \(j\omega L\) and the impedance of a capacitor is \(\frac{1}{j\omega C}\). Thus, for example, the current through \(L_1\) is \(\frac{V_i - V_3}{j\omega L}\). For nodes \(V_1\), \(V_2\), and \(V_3\), we want to calculate the total current flowing into the node. By Kirchoff's current law (KCL), the total currents flowing into each node must be zero (i.e. what comes in must come out). Thu