Tuesday, October 23, 2012

Quadlyzer Quantum Analyzer

Big Brain Project @ Humanoido Labs
BASIC Stamp Cluster Reflective Quantum Analyzer

Inside the QuadLyzer: a Reflective Quantum Analyzer (Humanoido)

4 Deterministic Parallel Clustered Cores with LCD Display,  Enumerators, Speakers, LEDs, 8-Bit Parallel and 4-Bit Micro I/O Interfaces
Full schematic to build a QuadLyzer Quantum Analyzer Fun Machine (Humanoido)
THE QUADLYZER is a machine that can reflect representative states of the Quantum World. It accomplishes this inside four processors representing at least four space dimensions. These are held as algorithmic states and parameters located inside multiple networked clustered parallel processors. Like the example of two real world mirrors of reflective dimension facing each other which represent infinity reflections, the QuadLyzer too can reflect more dimensions from baseline to infinity and states in between.

Check back frequently and watch this project grow as we continue to add fantastic new information. If you've never used Stamp processors, now is the time to learn the basics. If you have Stamps on hand, put the processors to full use in new and interesting ways, and learn new stuff!

The Parallel Clustered QuadLyzer
www.parallax.com  Big Brain Project
Project by Humanoido
Indexed Wed. Oct. 24th, 2012 v1.0

QuadLyzer version with EXOskeleton footprint ready for wiring (Humanoido)

Name - QuadLyzer
Purpose - Explore/Simulate Reflective Quantum States
Number of Processors: Four BS2 Networked Processors

Connection: Networked Parallel Cluster
Total LEDs - 8 (4 Board Activity LEDs + 4 I/O LEDs)
Piezo Speakers - 4
Number of Boards - 4
SW Loading - x4 USB Hub Loading
Type of Boards - BASIC Stamp Homework Board
Total IO Pins (4 x 16 + 2 Dedicated Serial = 56 + 8 Dedicated Serial)
Enumeration - 4 RC Indices
Deterministic Cores - 4
Communications Interface - 1 Wire serial (Party Line)
CPU Operations - Full Deterministic Parallel
Parallel Bus Upgrade - 8-bit and 3-bit (4-Bit in newer versions)
Processing Speed - (4 x 20 MHz = 80 MHz)
Program Execution Speed (4 x 4,000 IPS = 16,000 IPS)
RAM Size (4 x 32 Bytes = 128 Bytes)
EEPROM (4 x 2K = 8K)
PBASIC Instructions (4 x ~500 = ~ 20,000 instructions)
PBASIC Commands - 42
Communications - up to 9,600 BAUD x 4 = 38,400 with 4 lines
Output Devices - LEDs, Speakers, Pins, Computer Terminal Debugger
Source/Sink Current per each IO - 20 to 25 ma
Source/Sink Current per each Stamp - 40 to 50 ma per 8 pins
Power - Four 9-volt batteries or by bench power supply
Programming - Each board programs with a USB Mini-B connector with built-in RS-232 serial converter
Reset - Four individual resets
SW Type - Evolving Core AI

Operating System - QuadLyzer OS or Q-OS
Examples of Base Cost - boards, 4 x $39.99 = $139.96 or OEM kits, 4 x $29.99 = $119.96 or BS2 SSOP 4 x 10.99 = $43.96

LCD data for printout
Rapid development has created 4 versions of the QuadLyzer. V1 was built as a stacked tower cluster and shelved due to excessive size. V2 was built with a multi-sided Exoskeleton made from HomeWork boards and was quickly adopted as the standard. V3 has an added 3-bit port. V4 has a 4-bit port in place of the 3-bit port. V4 puts the LCD Green Screen on P0 while the previous versions have it connected to dedicated p12. BOARD VERSIONS Note there are many different versions of the Parallax BASIC Stamp HomeWork board. This project is using the version without a power switch (Revision E) which is (c)2002-2007.

Parallax Serial LCD Docs v3.0 (.pdf)
Propeller Example Code (.zip)
Javelin Stamp Example Code (.zip)
BASIC Stamp 1 and 2 Example Codes, Rev F (.zip)
Javelin Stamp Example Code (.zip)
SX/B Serial LCD Demo (.SXB)
Smart Sensors and Applications Parts & Text


This display provides basic text wrapping. You have control to move the cursor anywhere on the display with a single instruction and turn the display on and off in any configuration. It directly supports ASCII Dec 32-127, the same visible characters as the BASIC Stamp Editor's Debug Terminal. In addition, you may define up to eight of your own custom characters to display anywhere on the LCD. This device can be connected to a PC serial port using a MAX232 line driver.

Clear 4x20 character display
Turn backlighting on or off with a single command
Directly supports ASCII DEC characters 32-127
Eight user-defineable custom characters
Move the cursor anywhere on the display with a single command
Baud mode selector and adjustable contrast on the back of the display

Application Ideas: Professional-looking text user interface on any microcontroller application
Easy serial debugging without a PC Real-time sensor data output on autonomous robots
Key Specifications: Power requirements: +5 VDC, 20 mA (light off), 80 mA (light on) Selectable asynchronous serial baud rates: 2400, 9600, 19200
Dimensions: Approx. 2.4 x 3.9 in (60 x 100 mm)
Operating temp range: -4 to +158 °F (-20 to +70°C)

Board Power Switching
To compensate for the lack of a power switch on the boards, a parallel power harness is created from connected 9-Volt battery connectors which are led to a Lab Bench Power Supply which has control over the on/off power setting. For battery operations, batteries are clipped onto the board with one side (or terminal) for off, and two sides for on.
Introduction & Background
"I’ve had this idea for a machine that can reflect the state results of “computer programs” back and forth inside cores like reflection mirrors to gain effects for algorithmic simulated quantum states." As we know, in the physical world if mirrors are positioned properly, a running object infinity situation can result. We’ve all seen this with two mirrors placed facing each other. Now consider the reflective dynamics of four dimensional mirrors. By offsetting space, the numeric reflective states will vary. A “reflection tuner” can optimize or de-optimize results. The virtualized experimental tuner idea is for a larger super machine concept that could more comprehensively simulate the effects of quantum mechanics. The presentation here will cover the hardware, electrical and offer an intro to starter SW. More advanced information about Reflective Quantum States may appear at this blog as developed and as time permits.

Schematic for 1 HomeWork Board. QuadLyzer uses four boards. (Parallax)
Name Convention
The final name QuadLyzer comes from Quad, meaning four processors, and Lyzer which is derived from the word Analyzer. The first development name was Quadrinator.

One board pictorial (Parallax)
Parallax, Inc. BASIC Stamp HomeWork Board ver 1.1
 A. BASIC Stamp 2 Module. The BASIC Stamp is comprised of several components: PIC16C57- 20/SS - a Microchip 2K 8-bit microcontroller programmed with the the BASIC Stamp “Interpreter” that runs the Parallax BASIC Stamp code like a mini operating system; the 24LC16B EEPROM - a Microchip 2K EEPROM (electrically erasable programmable read-only memory) with a user-modifiable read- only memory (ROM) that can be reprogrammed with your BASIC Stamp code; a 20 mHz resonator to provide an accurate clock source for the BASIC Stamp; 220 Ohm resistors across the I/O pins to provide current protection for mistake wiring; an LM2936 voltage regulator which provides 50 mA for the BASIC Stamp and your circuits powered from the breadboard’s Vdd connection. B. DB-9 Female. The DB-9 port connects via serial cable to your PC’s serial port. This port is used to download programs to your BASIC Stamp and for the BASIC Stamp to send data back to the PC. C. Power and Ground Connections. Vdd is regulated 5V, Vin is 9V from the transistor battery, Vss is ground. D. Breadboard. Two areas of 5 column x 17 row breadboard project area. Connections are horizontal separated by the trough. E. Power Button. Illuminated when the BASIC Stamp is running a program only. F. Reset Circuit. Reset the BASIC Stamp by pressing this button. G. Battery Tie-Downs. If using the HomeWork Board Through-Hole Version for projects involving high- vibration (on R/C airplanes, robots, etc.) a “zip-tie” can hold the battery firmly to the board if looped through these holes. H. Power Supply. Accepts a 9V battery.

Revision E has no power switch. A large power regulator is located above the BS2 circuit.                                          

A four-board parallel BS2 stamp machine is designed and built to introduce and explore new concepts of reflective programming RP. The goal is to introduce the QuadLyzer machine for use by experimenters, hobbyists and academia. Stamps have the processing power and full speed potential required for creating PBASIC program simulations of various exampling “reflections” for this project. Additionally, the ease of programming in PBASIC is a plus, making the Stamp a “best choice” in the creation and exploration of rapid protos.

Unfinished QuadLyzer Tower
Processor Choice
I use both Propeller chips and BASIC Stamps. As a matter of fact, some projects for the Propeller chip are being moved back to the BASIC Stamp. It has happened with the QuadLyzer - some things developed in 5 minutes on the BASIC Stamp takes 5 days on the Propeller. This is in part, due to the great availability of documentation and resources for the Stamp and PBASIC programming language. When the Stamp has high performance within the range of timing and function suited for the app, and rapid development time is a factor, it becomes the usable choice. When the app fits, the cost of a Stamp over a Propeller is equated to shorter development time.

QuadLyzer Tower
The QuadLyzer Tower was very tall. With the LCD mounted at the top, it reached over 15-inches high, not counting the LCD size. This version was built and then discontinued for the smaller footprint design Exoskeleton, which forms a smaller "near cubed size" machine. Lab machines are often portable and the form factor is important.

Print ad for shipping a QuadLyzer
News Alert
Just in, the Exo form factor QuadLyzer is described as looking like a bomb! For transportation, please include the original Parallax Advertising (see photo for printing) or a printout of the BASIC Stamp Homework Board, the LCD and any attached peripherals. Secondly, the best option is the quick disconnect feature. Unbolt two angle brackets from one side of each board. This involves the removal of eight bolts.

Parts of the QuadLyzer
The machine consists of seven main parts. a) First, four microprocessors are networked together on a serial party line. b) Next, the parallel 8-bit bus is available in two 4-bit line sections to communicate each in parallel. c) The enumerator establishes a unique ID for each processor. The output consists of d) audio  e) LED and f) 4x20 Serial LCD. g) The 3-bit micro bus for I/O has a truth table for coding. 

The EXOskeleton Form Factor
Four Parallax BASIC Stamp HomeWork Boards are connect together in EXOskeleton fashion. This is a smaller footprint compared to a stacked tower, permitting easy access to wiring with no obstructions. It permits mounting the display in a paramount location. It also opens up more space in the center of the machine for experiments, wiring and expansion. Place the boards, with solderless breadboards facing up and to the outside so the long length is orientated up and down and connect together with angle brackets and hardware.

Details for the newer HomeWork Board from Parallax
Stacking Tower Cluster
Four Parallax BASIC Stamp HomeWork Boards are connect together by stacking to create a parallel tower, clustered together in a network. These are held together with brass spacers and hardware. The spacing between boards is great enough to facilitate easy wiring. The tower option has a very large footprint as seen in the photos and is unsuitable for efficiency in portability and transport. However, the protection of one board over the other offers wiring protection. In this machine, portability is paramount, indicating a choice of the EXO design, although both versions are built for study and experiments.

LED & Switch wiring (Parallax)
Preparing Enumeration Pins 
Each computer has one RC circuit on pin 13, prepared in advance. * is a 220 ohm resistor built into each Stamp Project Board.Software scaling is set to 54. The program must go pin low and pause 2000 for repeat reliable readings.

'               *
'              220
' pin 13 <-----^^^^^----- no circuit, open       COMPUTER 1 ID = 00
'             resistor
'               *        R2       C2
'              220       1K       .1uf
' pin 13 <-----^^^^^-----^^^^^-----||----- Vss   COMPUTER 2 ID = 17
'            resistor  resistor  capacitor       brown-black-red
'               *        R3       C3
'              220       2K       .1uf
' pin 13 <-----^^^^^-----^^^^^-----||----- Vss   COMPUTER 3 ID = 28
'            resistor  resistor  capacitor       red-black-red

'               *        R3       C3
'              220       3K       .1uf
' pin 13 <-----^^^^^-----^^^^^-----||----- Vss   SUGGESTED COMPUTER 4 ID = XX
'            resistor  resistor  capacitor       orange-black-red

Schematic diagrams for RC circuits on four boards

Note, four BS2 boards used already have the 220 ohm resistor built in, same as the BS1 boards. BS2 has a similar RC command like the BS1. Scaling may vary. The parallel QuadLyzer will require an additional circuit (added above) for computer 4 ID. Try a 3K resistor.

Here are the pseudo-code steps the program goes through to take the RC-time measurement:
Declare the variable time to store a time measurement. 

Code block within DO...LOOP:

o    Set I/O pin P7 to HIGH

o    Wait 100 ms,20 ms charges capacitor, 80ms keeps Debug
      Terminal display steady
o    Execute the RCTIME command
o    Store the time measurement in the time variable
o    Display the value time in the Debug Terminal

Before the RCTIME command is executed, the capacitor is fully charged. As soon as the RCTIME command executes, the BASIC Stamp changes the I/O pin from an output to an input. The RCTIME command is a high speed version of polling that measures the amount of time it takes for the capacitor to lose its charge and fall below the I/O pin’s 1.4 V input threshold. Instead of counting in 100 ms increments, the RCTIME command counts in 2 μs increments.

Parts List
BS1-4 BS2 Board
Ra-d  0,1,2,3K Ohm
S1    Speaker (x4)
DIS   Serial LCD Display
D1    LEDs (x4)
R1-3  1K Ohm Resister (x4)
C1-3  .1uf Capacitor

Pins Per Board
Each processor has 16 pins. Pinout for each board is as follows:

P00 - Party Line
P01 thru P08 - Parallel
8 bit Bus*
P09 thru P11 - 3 Bit Micro Bus I/O
P12 - Serial LCD 4x20 Display
P13 - Unique Repeatable Enumerator
P14 - LED
P15 - Speaker

Version 2
P00 - Party Line, Serial LCD 4x20 Display
P01 thru P08 - Split Parallel 8 bit Bus
P09 thru P12 - 4 Bit Micro Bus I/O
P13 - Unique Repeatable Enumerator
P14 - LED
P15 - Speaker


Method of Primary Reflection
The QuadLyzer has four processors running at the same time. Any one processor can become the primary image. Where processors are ID’d as 1, 2, 3, and 4, the following truth table illustrates introductory primary reflections.

1 - 2,3,4
2 - 1,3,4
3 - 1,2,4
4 - 1,2,3

The following is a truth table for using the first established 3-Bit Micro Bus. A hardware Micro Bus is located on each board for controlling I/O.

3-Bit Micro Bus I/O
         P09 P10 P11
(01) A   x   x   x
(02) B   x   o   o
(03) C   x   o   x
(04) D   x   o   o

(05) E   o   o   o
(06) F   o   x   x
(07) G   o   o   x
(08) H   o   x   o

(09I   x   x   o

The upgraded Micro Bus is a new version with 4-Bit capacity. It's made possible by relocating the LCD Green Screen to pin 0, making another pin available for the Micro Bus. This increases the machine from 9 Micro Bus states to 16.

4-Bit Micro Bus I/O
         P09 P10 P11 P12
(01) A   x   o   o   o
(02) B   x   x   o   o
(03) C   x   x   x   o
(04) D   x   x   x   x
(05) E   o   x   x   x
(06) F   o   o   x   x
(07) G   o   o   o   x
(08) H   o   o   o   o

(09) I   x   o   x   o
(10) J   o   x   o   x
(11) K   x   o   o   x
(12) L   o   x   x   o
(13) M   o   x   o   o
(14) N   x   o   x   x
(15) O   x   x   o   x
(16) P   o   o   x   o

Programming variables - Parallax

Chart of variable types for programming in PBASIC

The QuadLyzer machine has access to various peripheral devices that offer input and output with control over representations of quantum states. This includes LEDs, servos, LCD display, ultrasonic sensor, pushbuttons, accelerometer, time base reference chip, speakers, RC, and PWM Pulse Width Modulation. This section will include various starter code samples to facilitate programming and offer references for more future expansion and development projects.

QuadLyzer Peripherals & Devices for Programming
  • LEDs 
  • Servos
  • LCD display
  • Ultrasonic sensor
  • Pushbuttons
  • Accelerometer
  • Time Base Chip
  • Speakers
  • RC Circuit
  • PWM Pulse Width Modulation
DEBUG "Hello World! "

FOR counter = 20 to 120 STEP 10
DEBUG ? counter, CR
HIGH 14 

PAUSE 500 
LOW 14 

DEBUG "All done!"

Data by Parallax
If the BASIC Stamp is being used in a project where at least some small amount of time is spent doing nothing you can put it in a low-power mode to extend battery life using the SLEEP command (Table 2). The duration which you put the BASIC Stamp to SLEEP is accurate to ± 1% at 75° F and can ranges from 2.3 seconds to 18 hours (you can “wake up” and go back to sleep after 18 hours). By comparison, the PAUSE command is simply a delay in a PBASIC program yet the BASIC Stamp continues to draw full operating current. See the BASIC Stamp Windows Editor on-line help for all the details on the SLEEP and PAUSE commands. (reference HomeWork Board Manual)

With this example the Power LED remains on when the PAUSE command is executed. Current consumption remains at 10 mA.

' Power LED without SLEEP command
' {$STA
loopCounter    VAR    Byte  
' Variable definition
' Main Program
 FOR loopCounter = 0 to 99
DEBUG Home, "loopCounter =", dec loopCounter
PAUSE 1000
GOTO Start

With the SLEEP example the Power LED turns off when the SLEEP command is being executed because the EEPROM is inactive. Current consumption is 10 mA while the loop is being executed but drops to 40 μA during the SLEEP command.

' Power LED with SLEEP command
' {$STAMP BS2}
' Variable definition
loopCounter    VAR    Byte
' Main Program
FOR loopCounter = 0 to 99
DEBUG Home, "loopCounter =", dec loopCounter
GOTO Start

Maybe putting a BASIC Stamp to SLEEP permanently only demonstrates that a 9V battery can last almost two years if you wake the BASIC Stamp once in a while. In reality, projects need to wake up and provide current to “loads” like LEDs and other chips used in your project. If you know the current draw of the individual components and how long they are activated you can make an educated guess at total current consumption and battery life. If you’re only visiting your North Pole weather station annually even a small battery can provide a long lifespan for the BASIC Stamp, not to mention larger batteries with more milliamp hours.

To clarify the BASIC Stamp’s different power consumption operating scenarios and their effects on battery life review the following two programs in conjunction with Table 2. Downloading and understanding these programs will require a look ahead to future chapters, so be prepared to re-visit this section.
Both programs have the same result. The BASIC Stamp will send numbers to the BASIC Stamp Windows Editor debug window and then go into a period of inactivity for a second. With the PAUSE example the power LED remains on because the EEPROM is still communicating with the BASIC Stamp interpreter chip, but with the SLEEP example the EEPROM is shut down and the power LED is off.

' {$STAMP BS2}
' Program: LED Blink.BS2 

' Purpose: Blinks an LED connected to BASIC Stamp pin P15
' ---------------------------------------------------------------
Start: HIGH 14 ' turn LED on 

PAUSE 500      ' wait one-half second 
LOW 14         ' turn LED off 
PAUSE 500      ' wait one-half second 
GOTO Start     ' do it again 

' Program: LED Blink.BS2 (Version B)
' Purpose: Blinks an LED connected to the BASIC Stamp
' ---------------------------------------------------------------
LedPin    CON    15  ' LED control pin
' ---------------------------------------------------------------
HIGH LedPin          ' turn LED on
PAUSE 500            ' wait one-half second
LOW LedPin           ' turn LED off
PAUSE 500            ' wait one-half second
GOTO Start           ' do it again

' {$STAMP BS2}
' Program: LED Blink.BS2 (Version C)
' Purpose: Blinks an LED connected to the BASIC Stamp
' ---------------------------------------------------------------
LedPin    VAR    Out15  ' LED on/off control
LedCtrl    VAR    Dir15 ' LED i/o pin control
Off    CON 0
' ---------------------------------------------------------------
LedCtrl = %1            ' make LED pin an output
LedPin = On
LedPin = Off
GOTO Start

' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
LOW 14
LOW 15

Parallax BS2 Push Button wiring
The DO...LOOP in the program repeats every 1⁄4 second because of the command PAUSE 250.    Each time through the DO...LOOP, the command DEBUG ? IN3 sends the value of IN3 to the Debug Terminal. The value of IN3 is the state that I/O pin P3 senses at the instant the DEBUG command is executed.

' Check and send pushbutton state to Debug Terminal every 1/4 second.
' {$STAMP BS2}
' {$PBASIC 2.5}

' What's a Microcontroller - PushbuttonControlledLed.bs2 
' Check pushbutton state 10 times per second and blink LED when pressed.
' {$STAMP BS2} 

' {$PBASIC 2.5}

IF (IN3 = 1) THEN
LOW 14

Do the commands between here and the Loop statement over and over again
Display the value of IN3 in the Debug Terminal

If the value of IN3 is 1, Then
  Turn the LED on

  Wait for 1/20 of a second
  Turn the LED off
  Wait for 1/20 of a second
Else, (if the value of IN3 is 0)

  do nothing, but wait for the same amount of time it would have
  taken to briefly flash the LED (1/10 of a second).


' What's a Microcontroller - ServoTest.bs2
' Test the servo at three different position signals.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter    VAR    Word
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 1000
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 750
DEBUG "All done."

' Read resitor in RC-time circuit using RCTIME command
' {$STAMP BS2} 

' {$PBASIC 2.5}
time VAR Word 


PAUSE 100 
RCTIME 13, 1, time 
DEBUG HOME, "time = ", DEC5 time

'{$PBASIC 2.5}
duration    VAR    Word
frequency    VAR    Word
DEBUG "Alarm...", CR
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
DEBUG "Robot reply...", CR
FREQOUT 9, 100, 2800
FREQOUT 9, 200, 2400
FREQOUT 9, 140, 4200
FREQOUT 9, 30, 2000
DEBUG "Hyperspace...", CR
FOR duration = 15 TO 1 STEP 1
FOR frequency = 2000 TO 2500 STEP 20
FREQOUT 9, duration, frequency
DEBUG "Done", CR

How ActionTones.bs2 Works
The “Alarm” routine sounds like an alarm clock. This routine plays tones at a fixed frequency of 1.5 kHz for a duration of 0.5 s with a fixed delay between tones of 0.5 s. The “Robot reply” routine uses various frequencies for brief durations. The “Hyperspace” routine uses no delay, but it varies both the duration and frequency. By using FOR...NEXT loops to rapidly change the frequency and duration, you can get some interesting sound effects. When one FOR...NEXT loop executes inside another one, it is called a nested loop. Here is how the nested FOR...NEXT loop shown below works. The duration variable starts at 15, then the frequency loop takes over and sends frequencies of 2000, then 2020, then 2040, and so on, up through 2500 to the piezo speaker. When the frequency loop is finished, the duration loop has only repeated one of its 15 passes. So it subtracts one from the value of duration and repeats the frequency loop all over again.

FOR duration = 15 TO 1 

FOR frequency = 2000 TO 2500 STEP 15
FREQOUT 9, duration, frequency 


' What's a Microcontroller - ActionTones.bs2
' Demonstrate how different combinations of pause, duration, and frequency
' can be used to make sound effects.
'{$PBASIC 2.5}
duration    VAR    Word
frequency    VAR    Word
DEBUG "Alarm...", CR
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
FREQOUT 9, 500, 1500
DEBUG "Robot reply...", CR
FREQOUT 9, 100, 2800

FREQOUT 9, 200, 2400
FREQOUT 9, 140, 4200
FREQOUT 9, 30, 2000
DEBUG "Hyperspace...", CR
FOR duration = 15 TO 1 STEP 1
FOR frequency = 2000 TO 2500 STEP 20
FREQOUT 9, duration, frequency
DEBUG "Done", CR

HYPERSPACE SOUND Here is just one modification to the “Hyperspace” routine:
DEBUG "Hyperspace jump...", CR 

FOR duration = 15 TO 1 STEP 3
  FOR frequency = 2000 TO 2500 STEP 15 

  FREQOUT 9, duration, frequency

FOR duration = 1 TO 36 STEP 3 

  FOR frequency = 2500 TO 2000 STEP 15
  FREQOUT 9, duration, frequency 


' What's a Microcontroller - MixingTones.bs2
' Demonstrate some of the things that happen when you mix two tones.
'{$PBASIC 2.5}
DEBUG "Frequency = 2000", CR
FREQOUT 9, 4000, 2000
DEBUG "Frequency = 3000", CR
FREQOUT 9, 4000, 3000
DEBUG "Frequency = 2000 + 3000", CR
FREQOUT 9, 4000, 2000, 3000
DEBUG "Frequency = 2000 + 2001", CR

FREQOUT 9, 4000, 2000, 2001
DEBUG "Frequency = 2000 + 2002", CR
FREQOUT 9, 4000, 2000, 2002
DEBUG "Frequency = 2000 + 2003", CR
FREQOUT 9, 4000, 2000, 2003
DEBUG "Frequency = 2000 + 2005", CR
FREQOUT 9, 4000, 2000, 2005
DEBUG "Frequency = 2000 + 2010", CR
FREQOUT 9, 4000, 2000, 2010
DEBUG "Done", CR

How Long will the battery last?
According to Parallax, MilliAmp hours is a statistic measuring the amount of energy stored in a battery. For example, if you have a 1 mA-hr battery and a project drawing 0.5 milliamps, the battery will last for two hours. A typical 9V Duracell alkaline transistor battery provides about 565 milliAmp hours of energy.

LCD Code form from Savage Circuits

Now you can easily code rows and lines of characters on the Parallax 4x20 display using this form provided by electromange at Savage Circuits Forum. See Parallax 4x20 LCD layout sheet.
Assembly with Parallax 4x20 serial LCD
Photo: Machine QuadLyzer assembly with a 4x20 Parallax LCD, 90-degree angle brackets and simple hardware.

The cable is for connecting the serial LCD. The form factor is an exoskeleton made from four Parallax BASIC Stamp HomeWork Boards for a minimal footprint. These boards contain a BASIC Stamp 2 processor, believed to be one of the most documented hobby and educational processors in history.

Bar Graphs for LCD Displays from:

Programs by Chris Savage. Simple and Advanced Bar Graphs on our LCD Display. These examples were designed to run with a Parallax Serial LCD Display.

BAR GRAPH [ADVANCED RANDOM] (.BS2) Going High-Resolution

The previous examples were for smaller values and could not handle word-sized data/variables. These versions support 16-bit values for higher resolution and use a different percentage calculation.


Each stamp has its own unique enumeration which is generated by reading the RC constant created by the indexing of a unique resistor-capacitor combination wired into each Stamp circuit. There are four of these circuits with unique combinations. The R values for the Stamps are chosen to distribute readings across a wide range, so as not to overlap during comparisons of the initial readings from Stamp to Stamp.

With RC circuits, a scaled range is set up for repeatability. Whenever the machine boots, it establishes unique and “same” IDs for each stamp. Thus it can be programmed for accurate repeatability.

For convenience, the machine is comprised of four BS2-based BASIC Stamp Homework Boards all wired in parallel with a common interface. Each board has the convenience of solderless breadboard real estate for circuit testing and expansion. Stamps are wired in parallel which enables the reflection of one by three others and in various combinations. The parallel stack cluster machine can run portable with 9-volt batteries or on the lab bench with a power supply. An LED is located one per board to indicate combinations of four reflective states.

Interface Bus & Communications
All four networked stamps are collectively strung on a one wire party line connected through four 220-ohm resistors. Each pin is connected to a 220 ohm series protection resistor. Communication is through software “rules of engagement” to prevent two or more stamps talking at the same time. All stamps can listen at the same time. Code uses the “TA Torch Algorithm” designed to pass the line of flow from one Stamp to another without conflict. Any one stamp can make Torch decisions based on the unique ID of the other Stamps.

The QuadLyzer 1-wire Party Line
The 8-Bit Parallel Bus

3-Bit Micro Bus (or new 4-Bit)
(LED & Speaker Output) 

Handling output
Output is by light (p14), sound (p15), terminal, or LCD (p12 on version 1 and p0 on version 2). Eight LEDS, four indicate board power status and four are connected to each pin 14 for programming. One piezoelectric speaker on pin 15. A 4x20 Green Screen serial one wire LCD on pin 12 or 0. Pins: a parallel eight-bit port consisting of two 4-bit ports (p1-P4 and P5-P8). A three or 4-bit port coded with a truth table (P9, P10, P11, and P12). In the new version, LCD routes to pin 0.

QuadLizer PBASIC Starter Software
1) RC Enumeration
2) Communications
3) LED Reflective Output
4) Debugger
5) Parallel Identifier
6) Piezo Speaker Annunciator

Acronyms Identified
RP - Reflective Programming
RC - Resistor-Capacitor Circuit
AM - Algorithm Machine
TA - Torch Algorithm
BSQ - Basic Stamp Quadrinator Machine

QuadLyzer SE
 A new version QuadLyzer is now introduced with an extended 4-Bit Bus. The 3-Bit Bus still exists on the previous machine. The new machine is designated as the QuadLyzer SE with a 4-Bit I/O Bus. Note, currently all versions have the split 8-Bit Parallel Bus. The port gain comes from interfacing the LCD directly to Party Line pin 0 so that it may listen in on conversations from all processors.

We're considering placing the very fast and powerful BS2px processor on each board. The Parallax BASIC Stamp Homework Board has extra space to perfectly fit another board, directly on it. Can you guess which board? It's the smallest full featured Parallax processor board that comes from the Parallax Penguin robot (see http://www.p-robot.com/). The Penguin boards would increase the number of BS2 stamp flavored processors to eight! It creates a new BASIC Stamp Supercomputer with eight BASIC Stamps in the Collective. (OctLyzer) It also adds numerous features and peripherals and makes the most powerful Reflective Quantum Analyzer. See the list below showing what four BS2px Penguin boards will add to the QuadLyzer.

4 - BS2px Processors
8 - Light Sensitive Photoresistors
8 - Infrared IR Detector Receiver
4 - Hitachi HM55B Digital Compass sensor
4 - Seven-Segment LED Display
8 - Micro Servos
4 - Piezo Speaker
4 - Battery holders CR123A
4 - 3 Pin Expansion Port
4 - Power Switch
4 - FTDI 232RL Mini USB Programming Port
4 - LED


128 MHz Speed (32 MHz Turbo x 4)
76,000 IPS (19,000 IPS Each Board x 4)
512 Byte RAM (38 x 4 Byte)
512 Byte Scratch Pad Ram (128 Bytes x 4)
8-Bit x 16K EEPROM (8 x 2K Bytes x 4) 
16,000 Instructions (4,000 Instructions x 4)
PBASIC Extended Set Programming Instructions

This expanded processor machine would also have the features, peripherals and capabilities of the first four BS2 processors. Connection: the four new BS2px boards would connect to the Stamp Collective using their port routed to Party Line Pin 0. There are other options, i.e. the four BS2px boards could use just one port, freeing up three others, and acting like a powerful co-processor.
This is a rather large upgrade of the AM Algorithm Machine which was introduced in August of 2010 (see link). The AM was constructed with two Basic Stamp 1 Project Boards. It contained one 8-bit parallel Tiny BUS. It had no display. At that time, no Quantum World projects existed. The new
QuadLyzer will have a modified spin off version of TINY AI from the Tri-Core project and the Seed project. Development will include the Quad Operating System or Q-OS.

The QuadLyzer has four sets of initial universal space dimensions set by four processors. The fifth dimension of time is being introduced by use of a hardware clock chip and associated clocking software. Clock chip time is accessed and preset to initializations of T1, T2, T3, and T4. But what is the sum total of the representative dimensional quantities? The processors contain [A] XYZT, [B] X’Y’Z’T2, [C] X’’Y’’Z’’T3, and [D] X’’’Y’’’Z’’’T4. [Time] exists within each. [Reflective Quantum Representative States] bump this up to a maximum of infinity +.

Great Source of BS2 Code (PX Version)
Seed Project Part 1 & 2

AM Algorithm Machine
The Two-Stamp BSS (BS2sx + BS2px)

Tiny AI Artificial Intelligence Software for the Seed

Tiny AI Artificial Intelligence Software for the Tri-Core
Preparing Enumeration Pins

QuadLyzer Quantum Analyzer at Big Brain Blog
Parallax 4x20 Serial LCD
Parallax Piezo Speaker
Parallax Basic Stamp Homework Board
"What's a Microcontroller?" (v3.0) (354pp.) Download text (4.97 MB)

Parallax Downloads Page
April 2009 Parallax CD ISO image

BASIC Stamp (2e, 2sx, 2p, 2pe) Firmware Revision

PBASIC 2.5 Syntax Enhancement Notes Provides overview of what's new with the PBASIC language in the BASIC Stamp Windows Editor v2.0 and higher

BS1 and BS2 Conversion Tips (159 KB)

BASIC Stamp Syntax and Reference Manual 2.2 (5.3 MB)


BASIC Stamp Technical Comparison


BASIC Stamp Frequently Asked Questions (108 KB)

StampWorks Manual v2.1 (2 MB)


BASIC Stamp 1 Application Notes (516 KB)

BASIC Stamp 2 Application Notes (86 KB)

How to program BASIC Stamps on a MAC (2.4 MB)

The Elements of PBASIC Style (210 KB)
Microcontroller Projects with the BASIC Stamp 2nd Ed (583 KB)



ABOVE Two views of the AM Algorithm machine built two years ago to experiment with new parallel computing algorithms. It contained two BASIC Stamp One processor boards. This machine is the precursor project to the current QuadLyzer. Note the AM had no display and relied on the supporting DEBUG screen for output. Also the AM had no peripheral sensors for input and output and was based solely on internal computations.

LEFT photos Compare the QuadLyzer form factor, which contains four processor boards in the first version. The QuadLyzer contains a four line green screen display to reflect quantum states represented by the four processor boards.