Sunday, December 16, 2012

Junk Bin Antenna Tuner

Threw together a junk bin L network antenna tuner. The inductor is wound with solid core 14 gauge wire. The variable capacitor was scrapped out of an old (non working and not worth anything) tube AM radio. The coax connectors were scrapped off a couple of junk CB radios.

The capacitance range isn't quite enough with the variable capacitor so I had to add capacitance by sticking a capacitor in parallel on the breadboard. I'm usually able to get the SWR down to 1.5 or less on the G5RV antenna and I use the FT-900's internal tuner to do the rest.

I plan to buy a couple of larger variable capacitors and make a finished T network version that will hopefully preform better but I was able to get on the air without having to spend a bunch of money!

Friday, December 16, 2011

Mineserv: Automatic Start/Stop Perl Init Script

I was getting tired of having to manually start and stop my Minecraft server whenever the server rebooted and I couldn't make backups without manually disabling level saving first. I wasn't too happy with the shell script alternatives so I wrote my own version with Perl.

Because the Minecraft server does not support daemon processes you need a program called "GNU Screen" which creates a virtual terminal that can run in the background and be re-attached when needed.

To install screen, in Debian based operating systems, run:
`sudo apt-get install screen`
For other distributions check your package manager.
Source can be found here.

This script should be very easy to modify and add functionality to and would work nicely for other services that require screen to run with a little bit of modification.
Let me know if you add any functionality or re-hash the script for something else and I can post it here. Please share alike.

Download: mineserv

Installing the Script
- Install "screen" if you don't already have it
- Edit the SETTINGS variables to fit your server environment.
- Make a copy of the file in /etc/init.d/
- Make it executable: sudo chmod a+x /etc/init.d/mineserv
- Add it to the init list: sudo update-rc.d mineserv defaults

Uninstalling the Script
- Simply delete the file: sudo rm /etc/init.d/mineserv
- Remove from the init list: update-rc.d -f mineserv defaults

Using the Script
- Usage: /etc/init.d/mineserv {start|stop|restart|status|backup|cleanup [days]}
(Backup makes a .tar.gz archive of the world folder in the backup directory
(Cleanup deletes backups older than [days] given in the backup directory)

- To send a command to the server console: /etc/init.d/mineserv command "your command"
- To bring up the server console run: screen -r mineserv (Make sure run as the correct user)
-To give items to players: mineserv give [player] [item id] [amount]
This command will allow you to give more than 64 items at a time so specify any amount!

Monday, February 14, 2011

A Parser for GNUSim8085 Assembler Listings

Update: I am happy to announce that this functionality based off of my code will be added to GNUSim8085 in version 1.3.8.

I've been building an 8 bit microcomputer (still a work in progress) around the classic Intel 8085 processor. I found this excellent open source program, GNUSim8085, a "graphical simulator, assembler and debugger for the Intel 8085 microprocessor in Linux and Windows."

This program was extremely useful for writing and debugging my operating system. Unfortunately it had no ability to assemble the program to a binary in order to burn it to ROM, forcing me to hand assemble my programs in a hex editor.

To fix this, I wrote a parsing tool in C, it takes a GNUSim8085 assembler listing and strips out the hex data and OP codes to a binary file.

Download: gnuasm85.c

Update: I was able to get it to compile in GCC for windows, you can grab the compiled .exe here.
Instructions: Open up your assembly program in GNUSim85, make sure it runs. Set the "Load me at" value to the proper address offset. Then hit Ctrl + L to generate an assembler listing of your program and save it. Then run that assembler listing through gnuasm85 like so, "gnuasm85 foo.asm -o foo.bin".

Sunday, May 9, 2010

Simple AM Transmitter and Receiver

Update: I actually made a math error as I did not know
what I was doing at the time.

I actually inadvertently made a 7 MHz circuit instead of a
50 MHz circuit so I have changed the title but kept the component
values and fixed the equations so that they are now correct.

Sorry if I threw anyone off. I am still learning myself.

My fist adventure in radio! I started off by building a Hartley oscillator with one transistor and then amplitude modulated a signal with a second transistor. I then built an AM receiver schematic I found and calculated the tank circuit for 7 MHz.

Understand that this transmitter is extremely simple and haphazardly thrown together, it does not transmit any further than across the room but it is useful for understanding the basic concept of a transmitter.

AM Transmitter Schematic
(Q1 makes the Hartley oscillator, Q2 amplitude modula
tes the signal by attenuating the signal rather than multiplying it with the carrier (this makes it a very weak transmitter!). It will only broadcast across a room. To increase power you would need to add some amplification and use a better modulation method. You may find this helpful for calculating the resistance values needed)

AM Receiver Schematic

(I recommend replacing the 120k
regenerative feedback resistor with a variable resistor. I used 2N3904 transistors in my build)

The Tank Circuit

The operating frequency of the Hartley oscillator and the frequency tuned in by the receiver is determined by the inductor (L) and the capacitance (C) values in the tank circuit.

Explanation of a "tank circuit".

In my circuit the variable
capacitor's max capacitance is at 290 pF and the coils are roughly 1.746 uH (Micro Henrys). Turning the variable capacitor lowers it's capacitance and thus increases the resonant frequency.

I made the air-core inductor out of a .25 inch diameter soda straw.

Diameter: .25 inches
Length: .75 inches

Turns: 31

This equation can be used for calculating the dimensions of an air-core inductor,

  • L is inductance in uH
  • d is coil diameter in inches
  • l is coil length in inches
  • n is number of turns.

I found this air-core inductor calculator to be a very handy tool for designing coils.

Calculating Inductance Needed

To calculate the inductance L (in mico Henrys) needed you will need to know 2 things.
What frequency you want to operate in and your maximum variable capacitance
(290 pF according to my multimeter).

The formula for resonant frequency is,

Which can be rearranged to find the proper inductance value needed,

The easy way to calculate this is using realistic component values is,

So using my values as an example we take the minimum
frequency we want to tune and the maximum capacitance
my variable capacitor can reach,

Which comes out to,

Because of the previous errors I made (explained above) the actual
inductance I used was 1.746 uH which is still in the ball park for 7 MHz.

Thursday, April 1, 2010

Digital Clock - 7490 Decade Counters and a Hacked Quartz Clock

No microcontrollers needed here! I started playing with some 7490 decade counters and decided to build a digital clock. The first trick was getting an accurate 1 second time base. There are a few options here, you can divide the 60 Hz AC line frequency (in the US) down to 1 Hz or you can build a crystal oscillator and divide that frequency down with decade counters.

I decided to take a more hacky approach and took a 1 Hz oscillator circuit out of an analog Micky Mouse clock. There are a few different ways you can wire these up explained very nicely here. With my clock I didn't have to run the outputs through diodes or transistors (each output is 1/2 Hz), connecting them directly together worked just fine. I also powered it off the 5 volt supply by using a current limiting LED across its power input, the alternative is to have a separate battery for the clock. Every quartz clock circuit is different so its something you have to experiment with on the breadboard before building!


The time is kept by six 7490 decade counters. The 1 Hz clock is pulsed into a 7490 wired up as a mod 10 counter (for seconds 0-9). The output of the mod 10 counter is pulsed into a 7490 wired as a mod 6 counter (for seconds 0-5). That circuit is then duplicated for the minutes (0-59). The hours are then counted by two 7490s wired up as a mod 24 counter. (0-23).

The tens of seconds are displayed by 3 LEDs in binary. The 7 segment displays are driven by four 4511 BCD-to-7 segment decoders. I needed thirty-three 100 Ohm resistors in total for all the displays and LEDs. Good luck!

Saturday, January 30, 2010

Time Delayed Door Alarm

My cat likes to open the front door if we don't latch it properly, which is often. Waking up to a cold house sucks! I designed a time delayed alarm with a couple of 555 timers, if the door is open for roughly 30 seconds it sounds off a piezoelectric speaker until the door is closed again.

Here is the circuit.
(Printer Friendly PDF)

Parts Needed:

- 555 Timer (x2)
- 100k Resistor (x2)
- 10k Resistor (x3)
- 1 Meg-ohm Resistor
- 33uF Electrolytic Capacitor
- 2.2 nF Ceramic Capacitor
- NPN Transistor
- Diode
- Piezoelectric Speaker
- 16 Pin Socket
- 9 Volt Battery Clip
- 9 Volt Battery Holder
- 9 Volt Battery
- Magnetic Contact Switch (found much cheaper at Radio Shack)
- Radio Shack General-Purpose Circuit Board (46.8 x 72.2 mm)

If you don't have any of the resistors it would be cheaper to get a grab bag rather than buy individual resistances in bulk.

Also this circuit is not picky about voltages, you could probably use anywhere from 3 to 16 volts, anything that the 555 will handle.

How it works:

When the door is closed the diode keeps the capacitor (C1) discharged to ground.

When the door opens and the magnetic switch is disconnected the pull up resistor (R2) sets the trigger, on the first 555, high and allows the 33uF capacitor (C1) to charge through the 1 meg-ohm resistor (R1). When the charge reaches 2/3 of the supply voltage the output pin on the 555 is set low. The time it takes for the capacitor (C1) to reach 2/3 of the supply voltage is found by this equation,

Time(sec) = (1.1) x (Resistance) x (Capacitance)

For example if we take the values used in my circuit,

Time = (1.1) x (1,000,000) x (.000033)

The time delay comes out to about 36 seconds. Depending on the quality of the capacitor its not going to be totally precise for such a long delay but its close enough for our purposes. For more precise timing you would want to use a decade counter clocked with a 555.

Anyway, the output on the first 555 is inverted by the transistor, so when the output goes low after 36 seconds R4 pulls the output high, its basically a logic NOT gate. The second 555 is a simple multivibrator circuit which generates a square wave used to drive the Piezoelectric Speaker. The alarm will keep sounding until the door is closed thus resetting the circuit.

If you wanted to cheat you could do away with the second 555 timer and get a Piezoelectric Buzzer which will generate a tone on its own when a DC voltage is applied to it.

Let me know if you bother building one.

Tuesday, November 24, 2009

Tunnel Firefox through SSH with a SOCKS Proxy

You should always be careful when connecting to a public WiFi connection, you don't want to end up like these poor saps at the Defcon convention.

I'm sure you have found yourself in a situation where you had an overzealous network filter block websites on a public connection (like at a library, work, or school). Or perhaps you don't quite trust the connection you are on?

If you have a Linux box at home that you can SSH into, you can set up a socks proxy to tunnel firefox over an SSH connection. To anyone else it will appear as if you were surfing from your servers connection.

The command is:

ssh -D 8080 user@host -N

(This will work with putty on windows too)

Leave that terminal running in the background then in firefox go to...

Tools > Options (Edit > Prefrences in Linux) > Advanced > Network > Connection Settings

And set up a manual proxy configuration under the SOCKS Host to connect to localhost (IP: and port 8080.

You can also set up Pidgin to use a SOCKS proxy in the same way for more secure IM conversations.