Category Archives: Code

Colossal Cave Adventure

I’d been working on updating an old php3 version of the Colossal Cave. Time and availability for other tasks (see: scanning 1958 radio & TV home study course…) got in the way. So I took the lazy-man’s way out.

The excellent Arthur O’Dwyer has generously allowed for posting (for historical recording, study, amusement and proliferation about the internet) on this website,  his great translation of the original Crowther & Woods 350 point version of “Adventure”. The work is all his, and we all owe a debt to the Elders: Will Crowther and Don Woods.

I’m so lazy, I borrowed his whole page, so as to not damage the content. Visit Colossal Cave.

My first contact with “Adventure” was at Harris Corporation (Interactive Terminals Group), on Dallas Parkway. I walked into the computer lab (and showroom!) one day to see Kim Shrier busily porting the Fortran version to a Perkin-Elmer Interdata 7/16. (Kim may correct me, some day, if I have the machine wrong).

“Most Accurate” SB-630 Update

Updated (and hopefully, finished) the SB-630 update.

All Tubes and the Plate-Filament transformer were removed (and saved, for future tube projects). The clock was given to a local collector who prefers to keep his Heathkits original. The functionality replaced – and enhanced – by adding a Real-Time Clock (RTC) chip, a WWVB receiver and Arduino code to interpret the 1950’s era clock signal.

The WWVB receiver reads each ‘pulse’ of the signal and interrupts the Arduino (INT1) to add the ‘tick’ to the buffer. Once the whole signal is recieved, it can be interpreted as a date and time. The RTC pulses (INT0) each second in order to drive the display clock.

In addition, an LM35 sensor provides the current room temperature.

http://mikeyancey.com/SB-630_console.php

Original WWVB decode source from http://duinolab.blogspot.com/2009/06/arduino-cmmr-6p-60-almost-accurate.html (Capt Tagon) and all others who’ve improved this code. Website seems abandoned, but the source code is good. My alteration is to remove the timer interrupt (1000 times a second) which operates the 1-second tick and replace it with the square wave output (SQWE) signal from the RTC chip, a Maxim DS1307.

Vacuum Tube Inventory Online

Added this to the website, under ‘Other Projects‘.

Mostly for personal use, this is in response to a posting on the ARF (AntiqueRadios.com Forums) regarding ‘how do you track what tubes you have’.

The inventory system keeps each user’s inventory separate, and draws from a common database of tube data (still building that common list, currently at around 450 tubes).

Some features include an ability to import from Excel (actually CSV exports from Excel), export back to Excel, print an inventory, keep (and print) a separate ‘shopping list’, and some searching facilities.

Garage Parking Light

I really liked the Nuts & Volts Magazine project “Garage Parking Assistant” in January 2010, but I don’t ‘do’ Basic Stamp – no reason really, just not my favored platform and N& N & V seems to base a lot of projects on that platform.

So, I translated it to Arduino and replaced the Basic Stamp with a minimalist Arduino (Atmega 168, a clock resonator, a couple of resistors and capacitors, and an LM7805 voltage regulator). From there, code translation (BASIC to  “C++”) was easy. I make no originality claims and I’ve only provided a code translation.

Garage Parking Light – Translation to Arduino

This is a project I’d been thinking about for some time, but was too lazy to do. Finally a version came out in Nuts & Volts, January 2010. Their version was based upon a Parallax Basic Stamp module. Not a huge problem: I translated it for Arduino and built the whole thing on a small circuit board. This project is also well documented over on
Savage Circuits. I have nothing against the Basic Stamp modules, it’s just that I had parts on hand to build an Arduino version.

Parts

The Parts List is similar to the magazine defined project.

Qty Description Source Notes
1 Project Enclosure, approximately 3″ x 2″ x 1″ Anywhere For the Sensor
1 Project Enclosure, approximately 5″ x 3″ x 1.5″ Anywhere For the Controller & LEDs
1 PerfBoard to fit the Larger Box Anywhere
1 10mm Red LED Red is brighter; use a larger resistor
1 10mm Yellow LED
1 10mm Green LED
1 PING))) Ultrasonic Sensor Radio Shack
1 470 ohm, 1/4W Resistor Anywhere Red LED is Brighter
2 220 ohm, 1/4W Resistor Anywhere
1 Minimal Arduino or RBBB Kit www.moderndevice.com RBBB Kit or build a Minimal Version from parts

Arduino Code

The original Basic code for the Stamp was translated to Arduino’s familiar  C++. I’ve retained the original author’s comments and I’ve used the constants provided therein for evaluating distances to the arriving car. I didn’t provide the “Setup” mechanism, including the momentary press button, but I’ve included

PING Ultrasonic Sensor
PING))) Ultrasonic Sensor, mounted on the wall at bumper height.

it in the translated code. I used the original vehicle distances, as they suited my needs.

The Arduino platform used can be whatever is on hand. I usually use an RBBB from Modern Device, but in this case, I used a minimal Arduino built from a couple of resistors, a resonator for clock (or a crystal if you have one). The minimal Arduino, and a programming
header was constructed on the same board as the LEDs are placed, but off to the side.

One feature I did add was a ‘darkness’ sensor — I didn’t feel that the PING))) Ultrasonic Sensor should be working when it’s not needed, so I sense darkness with a simple analog read of the voltage drop across a Cadmium Sulfide (CdS) resistor.
Since the garage is dark except for:

  • Daylight – bright light enters from the open garage door
  • Night – headlamps will turn the Parking Light on
if ( analogRead(LightSensor) > 600 ) {		
	// Lights are on, or door is open and it's daylight.. Start to Work...
		
	// establish variables for duration of the PING))), 
	// and the distance result in inches and centimeters:
	long duration, inches, cm;
	:
	: (rest of PING))) Loop here...)
}
else { 
	// DARK! Sleep Now...
	digitalWrite(RedLED, LOW);
	digitalWrite(YellowLED, LOW);
	digitalWrite(GreenLED, LOW);
	delay(1000);
}

The CdS sensor peeks through the enclosure via a small hole above and to the left of the LEDs.

Hardware Differences

Since the controller changes from a Basic Stamp to an Arduino, there are a few hardware changes. The Arduino Digital and Analog Pins selected are:

  • Ping Pin – In/Out, Digital Pin 8; uses the PulseIn Function to detect the reflected Ping
  • Red, Yellow and Green LED Driving Transistor Bases: Digital Pins 11, 10 and 9
  • Program Button (implemented in code, but not used): Digital Pin 12
  • CdS Voltage Sensor: Analog Pin 5 –> inputs from a voltage dividor including the CdS sensor

The original article uses the Basic Stamp to drive the LEDs directly. I used a transistor to drive them, as the Arduino pins cannot source about 40ma of current. The Digital Pins might be able to supply enough current, but I’ve used the pin to drive the transistor base and let the transistor switch the current as a conservative design choice.

Source Sketch Files

  • Version 1 – works with Arduino-0018, uses a CdS light to turn off when garage is dark.