Monday, August 11, 2014

Pictures from the Beetle's Carburetor Rebuild

A lot has been going on lately. I sold a house, moved to the city, started a second job, and just started studying for the Professional Engineering exam. So putting pictures of the Beetle's carburetor (34 PICT-3) has kind of taken a back seat, so to speak. Anyway, here are some of the highlights!


The freshly-removed carburetor, before I removed any of the bits. It's a little dirty.


I found out later that this solenoid is the "idle air cutoff". I don't really know what this means and I can't get anyone to tell me, but I found out later that the Beetle was stalling a lot when it would slow down, which was presumably caused by this little valve being loose. So after I screwed this in tightly it stopped stalling.


Automatic choke collar.


Removing the automatic choke. This had a little problem where it wasn't set properly. I had to turn the whole assembly clockwise after I reinstalled it to make sure it would actually choke the engine when it was cold.



Automatic choke parts


Removing the top half


I don't remember what this part is for.


Automatic choke housing.


Fuel inlet needle. (Controlled by the float)


Old float removed. I lost the pin when I put the new float in and ended up making a new one from a long screw. Then later on I found the pin right in the middle of my work bench. Murphy's Law of carburetor rebuilds.



Another valve I don't remember what it does off hand.


Replacement gaskets.


After I put it all back together it's pretty easy to see the color difference. The car ran amazingly after this, and even better once I figured out that that solenoid was making the car stall.


Don't worry, I put the air filter on after I flooded the engine and killed the battery. Learn by doing!

Thursday, May 22, 2014

The Beetle!

So I haven't been doing a whole lot of electronics projects lately because a few months ago I decided my mechanical skills could use some work, and my latest project has tested my limits in that field! It's...

A 1972 VOLKSWAGEN SUPER BEETLE! So exciting!


What makes it "super" is that the front suspension is a MacPherson strut assembly rather than the old style torsion bar/kingpin setup which basically just saves some space in the "frunk" and makes replacing suspension parts a little harder, but improves ride quality and turning radius. Great!


There are some minor problems, what with the car being 42 years old at the time of this writing, namely the four-ish oil leaks in the engine. The pushrod tubes, valve guide seals, valve cover gaskets, and some other things leak a minuscule amount of oil each that adds up to me having to put a half quart of oil in about every 200 miles.




This is ok though because from what I can tell the piston rings are still in good shape so it's a ways off from REALLY needing an engine rebuild.

Also cool is that it was made in "West" Germany:


It has the Wolfsburg crest on the steering wheel too, for further proof of its authentic German-ness:


Apparently the Nazis built Wolfsburg to start building Volkswagens. Another brief history of that car was that Ferdinand Porsche needed to build the Beetle really quickly for Hitler, and so based a lot of it on the Tatra, a car Hitler liked from Czechoslovakia. Well, Tatra sued Volkswagen over that and Porshe asks Hitler what to do, to which he replied basically "Don't worry, I'll take care of it." Then he invaded that country and shut down the Tatra plant. Tatra eventually won a lawsuit in 1968 but not before the Beetle became world famous!

Also, my Beetle was made after Volkswagen acquired Audi, so it shares some of the same parts as Audis from that time:


All in all, this car is brilliant. It runs well but it needed to have the carburetor rebuilt (which I've done, that'll be the next post here). I've always wanted a Beetle but I was finally convinced to buy one because the ECU (computer) on my truck went bad and cost me a huge chunk of money to fix (plus the dealer had to program it), so I decided I needed a car that I could fix anything on. They're easily the simplest cars ever built. The air-cooled engine means no radiator, it's simple to remove from the engine from the car if I ever need to, plus there's no A/C or power steering or anything else to complicate things, and parts are everywhere. Plus it's just fun to drive and downright cool.


I was accidentally in a car show and might have been a little out of place though!


Friday, November 1, 2013

Before and After!

After over three and a half years, I finally needed a new set of tires for my unstoppable beast of a pickup truck. My last set were 31" 10.50 BFG All-Terrains (thanks for the graduation present, Mom and Dad!) which did very well in the relatively dry mountainous South Carolina trails where I used to venture off-road. In South Florida, it's almost 100% mud, so I decided to go with a slightly different tire: 


These are 32" 11.50 BFG Mud-Terrains. They are a much more aggressive tire which will hopefully help with Florida's flat swampiness. Since I have put a 3" lift on my truck since I got out of college, there was no problem fitting the new tires (except a piece of the front mud flaps had to be cut off, no big deal). 

BEFORE:


AFTER:


The only problem is that the rainy season (summer) is over and the dry season (winter everywhere else, but pretty much spring here) is starting, so all the mud holes are drying up. I'll have to give them a real test in May when it starts raining again!


PS: If anyone knows a decent body shop in South Florida somewhere that will paint my truck for a reasonable price, I think it might be about time for that.

Sunday, October 27, 2013

Turntable

I decided that it was about time to restore my old turntable. It's a Technics SL-D35 direct-drive turntable which I believe is a model from the late-70's or early-80's. I had to fiddle around with the motor control electronics because it was playing at a very inconsistent speed. Then I cleaned everything with electronics cleaner, lubed the motor shaft, and went to town with some Led Zeppelin. It's good to remember one's roots.



Thursday, September 12, 2013

Entertainment Center Thermostat

I use a china hutch from my grandmother's old house as my entertainment center. I never really liked displaying all of one's electronics and wires and stuff where everyone can see them, so this suits my needs quite nicely. HOWEVER! This particular piece of furniture doesn't have very good ventilation for all of my heat-producing electronics, and it has a tendency to get a bit toasty inside the cupboard unless I left a door open. I decided to fix that by putting some exhaust fans on the outside and hooking them up to an ATtiny45 microcontroller and a temperature sensor. Now, when the temperature inside the hutch rises beyond a certain level (around 95 degrees F) the fans are turned on so the Playstation 3 and Crown amplifier don't overheat in the modified entertainment center.


The first step was the prototyping! I had a HUGE problem here with what should have been a simple circuit. The output of the voltage sensor was supposed to be around 0.75V at room temperature, and it would increase linearly as the temperature increased. (I used a hair dryer to model temperature fluctuations.) I was not getting any sort of reliable data from the sensor whenever the microcontroller was attached to the power rails of the circuit, but I found out that this was due to a lack of "decoupling capacitors" that I had failed to place near the sensor and on the power rail. I'm not 100% sure how this solved my problem, but as an engineer I'm not bound by the need to find answers, but rather simply by a need to get whatever it is working.


Soldering everything together. The red/black wires sticking out of the top of the circuit go to the power supply, which I stole from an old cell phone charger. +5V from a SMPS saves me the time of building a power supply (trivial, but sometimes frustrating). The wires to the right are my dead-bug soldering of the temperature sensor and decoupling capacitor. These will be outside of the enclosure that the rest of the electronics will reside in:




I mounted the fans to the cardboard backing of the "entertainment center". The one on the bottom right blows in, and the one on the upper left blows out, for a nice circulating effect.


Everything put together! I was told that my color scheme is a little off, but at least it looks better now without the doors wide open any time I want to turn the TV on or listen to music.

HERE'S THE CODE! I've had to make some changes to the temperature settings. At first the fans would kick on and off once every five to seven minutes, which I thought was too fast. Then I changed the settings and they wouldn't come on at all. I think I have it JUST RIGHT now.

/*
this program turns a switch on at approximately 90 degrees
it turns the switch off at approximately 85 degrees
it is designed to be used with a TMP36 temperature sensor
output signal on/off is ATtiny pin 5 (digital pin 0)
input signal from TMP36 is ATtiny pin 7 (analog pin 1)
*/

#include <avr/io.h>
#include <util/delay.h>
//setFlag keeps the program from continuously writing pins
//if it doesn't need to. this makes it one-shot and hopefully
//saves a few bits of energy
int setFlag = 0;

void setup() {
  //set pin modes
  pinMode(0, OUTPUT);
  pinMode(2, INPUT);
  //turn on the fans to make sure the program is working
  digitalWrite(0, HIGH);
  _delay_ms(2000);
  //then turn them off to allow the program to run
  digitalWrite(0, LOW);
  _delay_ms(500);
}

void loop() {
  //measure the voltage at pin 7:
  int sensorValue = analogRead(1);
  //calculate the voltage. at room temperature it should be around .760V
  float volts = sensorValue * (5.0 / 1024.0);
  //calculate the temperature in Celsius
  float degC = (100.0 * volts) - 50.0;
  //make a decision about whether or not to turn the fan on or off
  //the microcontroller effectively acts as a schmitt trigger
  if (degC > 32 && setFlag == 0) {
    digitalWrite(0, HIGH);
    setFlag = 1;
  }
  if (degC < 25.5 && setFlag == 1) {
    digitalWrite(0, LOW);
    setFlag = 0;
  }
  
  //only take a reading once every 10 seconds
  _delay_ms(10000);
}

Tuesday, September 3, 2013

Just for Fun

So I decided I had had enough of practical, useful projects, and I built this:


The circuit is called a Slayer Exciter. It is a hand-wound air-core transformer (it took me about two hours to wind the transformer; the red cylinder in the picture is actually about 400 turns of 34-gauge magnet wire) capable of generating a high voltage and a very strong electric field capable of illuminating a fluorescent light bulb. There are lots of online how-tos floating around which go into great detail about this "poor man's Tesla coil" so I won't go into great detail here. Basically, it's a very simple oscillating circuit consisting of a transistor, two diodes, and some resistors that can turn a low voltage DC source into very high voltage AC. Here are some pictures! 

Some prototyping, just to make sure it all works: 


Putting it all together on a piece of wood, as I am wont to do with electrical things:


 And, on an unrelated note, perhaps the most random two things to be purchased at one time from Amazon. A 14-ounce tin of almond flour for gluten-free baking and a Lieutenant Commander Geordi Laforge action figure to make sure I have the nerdiest cubicle in the office:


MY TRICORDER DETECTS NO WHEAT, CAPTAIN. IT'S A MYSTERY!

Sunday, August 18, 2013

Lamp Sunset Timer

It seems like I have a lot of posts devoted to lamps... anyway, my latest one involves programming a Raspberry Pi to switch my living room lamp on approximately a half-hour before sunset. My previous design for switching my lamp involved using an old Pentium 3 that I have since replaced with a newer computer. The new computer doesn't have a parallel port, and isn't near the lamp any more, so I decided that the RPi's compact size suited itself to this project. Also, the old program turned the lamp on and off at the same time every day. This is problematic for two reasons: first, I could buy a simple timer to do this, and second, it required me to change the program's source code any time the lamp started turning on too late or early as the seasons changed.

Another goal for this project was to familiarize myself with Python. I am fairly well-versed in C (don't ask me about pointers though), but Python seems to be a tool that more and more people are using. The script I wrote uses a python module called "pyephem" to calculate the sunset time at my location (south Florida) every 30 seconds. Then it subtracts 30 minutes from this time, and if the current time matches the calculated sunset time, it turns the lamp on.

Another thing that I implemented in my Python script was random turn-off times. Importing a module called "random" allows me to call a function "random.randint". Giving it a range of values allows it to generate random numbers within this range when it is called. So "random.randint(0,59)" generates a random turn-off minute for my program, which turns the lamp off every night between 12:00 and 12:59. Hopefully this confuses anyone spying on my home!

It started out on the floor just to get things rolling. I spliced into an old extension cable.


This wasn't a permanent solution, obviously. I opened the lamp up to get at the internal wiring to tap off of the 120. From there I used an old cell phone charger to get power for the Pi and also spliced the 120 into the relay. The relay is tied to the control electronics which get their signal to turn the relay on or off from the RPi.


Since everything's under the lamp's table, it's not noticeable at all! The one change I need to make is getting a wireless card for the RPi so it doesn't need an ethernet connection. Apparently the OS version that's on the Pi doesn't have very good wireless support, but I hear they fixed it in a more recent release.


FYI, the other two cables have nothing to do with this project. Just ignore them!

Python script for this project:



# program calculates sunset each day and turns the lamp on 30 minutes before

# then the program calculates a random minute to turn the lamp off within an hour after midnight.



# REMEMBER TO USE 24-HOUR TIME FORMAT

# AND THAT PYEPHEM USES UTC/GMT AND NOT EST

import time
import datetime
import ephem
import random
import RPi.GPIO as GPIO 

GPIO.setmode(GPIO.BOARD) 
GPIO.setup(10, GPIO.OUT) 

# make sure "off_minutes" has a value
off_minutes = 1

while 1:
# figure out what time it is now
now = datetime.datetime.now()
now_hours = time.localtime(time.time())[3]
now_minutes = time.localtime(time.time())[4]
# provide the program with information about the current location:
# HS = Hobe Sound
HS=ephem.Observer()
HS.lat='27.0592'
HS.lon='-80.1367'
HS.date = now
sun = ephem.Sun() 
# figure out if it is daylight savings time or not:
# isdst will be 1 if DST is currently enforced, 0 otherwise
isdst = time.localtime().tm_isdst
# figure out when sunset is:
sunset_hours = HS.next_setting(sun).tuple()[3]
#sunset_hours will be in 24-hour GMT.
if isdst == 1: #add 20 to the time for DST
sunset_hours = sunset_hours + 20
else: #add 19 to the time for EST
sunset_hours = sunset_hours + 19
sunset_minutes = HS.next_setting(sun).tuple()[4]
# subtract 30 minutes from the time since it gets dark before actual sunset
sunset_minutes = sunset_minutes - 30
if sunset_minutes < 0:
sunset_hours = sunset_hours - 1
#sunset_mintues will be a negative number, so adding it to 60 will subtract it
sunset_minutes = 60 + sunset_minutes
# turn the light on if the hours and minutes match:
if now_hours == sunset_hours and now_minutes == sunset_minutes:
GPIO.output(10,True)
#also calculate a random time for the light to turn off
#this is in this "if" statement so it only calculates a random time once
#every 24 hours. 
off_minutes = random.randint(0,59)
# turn the light off at the randomly selected minute in the 00 (midnight-1:00 AM) hour
if now_hours == 0 and now_minutes == off_minutes:
GPIO.output(10,False)

# run once every 30 seconds:

time.sleep(30)

It also needs a script in /etc/init.d to tell the Pi to start this program at boot.


UPDATES!

I added a Staples Easy Button to the lamp since there was no way to turn it off or on except by SSHing to the Pi, and then running the "off" and "on" python programs manually. I took the Easy Button apart and soldered some wires to the button. The button is powered by two AA batteries, which is about 3 volts. I thought this would be enough for the Raspberry Pi's 3.3V logic, so I hooked the button's output up to a PNP transistor's base to watch for button presses. When a button is pressed the wire connected to the transistor's base goes low (3.0 V to 0 V) and the transistor turns on. The collector pin on the transistor is connected to one of the Pi's input pins, and when it sees the button was pressed it toggles the lamp.



I thought I was going to have to re-write my python sunset program to include watching for button presses. Fortunately I found that just running a second program using some of the same input/output pins as the sunset program doesn't interfere with its operation. 



import RPi.GPIO as GPIO
import time

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN)
GPIO.setup(10, GPIO.OUT)
GPIO.setup(8, GPIO.IN)

#program reads pin 11 to see if the lamp is on
#pin 11 is physically soldered to pin 10, the output pin
#which checks if the lamp is physically on or off

while 1:
        if ( GPIO.input(8) == True and GPIO.input(11) == False ):
                GPIO.output(10,True)
                time.sleep(2)
        if ( GPIO.input(8) == True and GPIO.input(11) == True ):
                GPIO.output(10,False)
                time.sleep(2)

Notice that I needed to physically bond pin 11 to pin 10. There's no way that I know of to monitor the state of an output pin like you can do by polling a microcontroller's registers. But there are plenty of input/output pins for me to waste one like this. The reason I needed to do this is because more than one program can change the state of the output pin, so the Easy Button program has to check to see if the lamp is on or off before deciding whether to turn it off or on.