Blue Box Powered by Arduino (Phone Phreaking)

History and Narrative

Phone phreaking was an absolutely exciting method to explore an obscure world of phone switching networks in the 1950s, 1960s, 1970s, 1980s, and even into the 1990s.

Frequencies or tones can be used to “phreak” a telephone switch.

Taking control of the hardware was straightforward as a result, and the “phone phreak” gained the power of an inward-operator.

Step 1: Installing the Arduino IDE and Library

The Arduino put power in the hands of the same people who created the first blue boxes.

We can write our own microcontroller code, construct unique equipment with widely accessible Radio Shack parts, and so much more.

We may design our blue boxes in a variety of ways, and this post will just discuss a few of them.

Tone Library is a collection of tones.

The Tone library – square wave – synthesis gadget is the first.

The Arduino Micro ATMega32u4 based microcontroller and the Arduino (external) Tone library may be used to create this gadget.

To function with the ATMega32u4 chip, the library must be changed, and a modified version may be seen on my website here.

Only the Arduino IDE version 1.0.5 has been used to test this library and chip.

We need a basic schematic that we can use with a keypad now that we have the library and chip.

Library of Keypads

Here’s where you can get the Arduino Keypad library.

All libraries must be placed in the Arduino “libraries” directory, which may be found at the root of your IDE installation.

C:Userstrevelyn412DocumentsArduinolibraries, for example

Most of the time, this is as simple as extracting the library from a zip file, but read the documentation for your library to see if there are any additional installation requirements.

TMRpcm Library is a collection of TMRpcm files.

Finally, schematic 2 uses the TMRpcm library to play WAV files from our second blue box.

When I was experiencing trouble with the non-existent SeeedStudio v3 SD card Shield documentation, the creator of this library was gracious enough to assist me through email.

It plays mono files at 8 bit at 32kHz and below (I use 22kHz).

By modifying the pcmConfig.h header file, we may perform a variety of sophisticated functions and code optimizations, such as enabling a greater buffer area when we uncomment and update the line.

#define buffSize 128  //must be an even number

We also need to reduce the actual cycles of a single frequency WAV file stored on the SD card by 25.

This implies that for supervisory signalling, produce a tone for 2575hz rather than 2600hz in Audacity.

The noises I made are all stored in the “sounds” directory at the micro SD card’s root.

The Arduino community has provided numerous notes for storing files and retrieving them using Arduino libraries.

These are really crucial to adhere to.

Requires Hardware

  • Simple 10k Ohm resistors
  • Momentary push-buttons
  • LED lit toggle power switches
  • Arduino UNO && Arduino Micro
  • SeeedStudio v3 SD Card Shield
  • BLUE Advantus Super Stacker Crayon Boxes
  • Blue LEDs
  • 100k Potentiometers for volume
  • 2.2uF non-polarized capacitor (optional)
  • 9V batteries (one schematic uses 2 in parallel
  • Rotary dial mechanism from old phone
  • Velleman 4×4 keypad
  • 150 Ohm telephone receiver speaker part #SD150(ph) (for optimal output)

Anything else is just optional.

The LEDs are optional, as is the hardware with LEDs, such as the power switches.
Changing the schematic to incorporate them should be quite straightforward.

Step 2: Create the First Schematic

I’ll teach you how to make two boxes using the Tone synthesis library and the Arduino UNO / SeeedStudio SD Shield – TMRpcm WAV file player versions that I developed myself. I’ll be utilising the Velleman 4×4 keypad for two of these lectures. This is a highly detailed keypad that comes with a pin-out diagram on the back of the packaging to make connecting it to the Ardiuno as simple as possible.

The simplest schematic in this series may be seen in the image above. A 4×4 keypad, a single supervisory signalling button, a volume knob (potentiometer), and a beautiful LED-lit power button are all it has. The momentary pushbutton requires a 10k Ohm resistance to ground on pin 10. As can be seen from the basic design, the switch’s opposite side connects straight to the 5V pin. The hardware layout is simple to create, but troubleshooting might take hours. For people who aren’t familiar with schematic diagrams or electronics, a basic breadboard is the ideal option.

Step 3: Generate the code for Schematic 1


For the sake of this lesson, we’ll go through the majority of the syntax’s essential principles. First and foremost, the Arduino makes use of C++, an object-oriented programming language. This language is quite strong, and it is used to power a lot of current web site logic, microcontrollers, and other devices.


First, we make a two-dimensional array of integers to store the frequencies as described on the Wikipedia Blue Box page each digit. A duration is also defined as a typedef unsigned integer array. The playback duration periods are represented by these integers.

int bb[16][2] = { // MF 0,1,2,3,4,5,6,7,8,9,kp,st,2400+2600,kp2,st2,ss4 super<br>  {1300,1500},{700,900},{700,1100},      // 0,1,2
  {900,1100},{700,1300},{900,1300},      // 3,4,5
  {1100,1300},{700,1500},{900,1500},     // 6,7,8
  {1100,1500},{1100,1700},{1500,1700},   // 9,kp,st
  {2600,2400},{1300,1700},{900,1700},    // 2400+2600,kp2,st2
  {2400,2040},                           // ss4 Supervisory
<p>uint8_t bbdur[2] = {60,100};</p>

Then, as characters, we generate an array matrix of keys. Each time a keypad button is hit, these characters will be utilised. The rows and pins integer arrays are also set.

char keys[4][4] = {<br>  {'1','2','3','a'},
<p>byte rowPins[4] = {5,4,3,2}; //connect to the row pinouts of the keypad<br>byte colPins[4] = {9,8,7,6}; //connect to the column pinouts of the keypad</p>

Then we make a keypad object and a basic Tone object array. Because we’re playing tones from two pins at once, it makes creating and debugging the code a lot easier.

Tone freq[2]; // array of Tone objects, now we can play as freq[0].play(); etc<br>Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,4,4);

Playing Tones and Reading Buttons

The output pins freq[0] and freq[1] must be configured in the setup() method. This is straightforward. We also set the 2600 button’s “pin mode” and an event-listener, which is a custom procButton() button processing method call. This is what event-driven programming is all about. This essentially indicates that we are “listening” for keys to be pushed, which is a “event.” The main loop() method is in charge of handling events and listeners.

freq[0].begin(11); // Initialize our first tone generator<br>freq[1].begin(12); // Initialize our second tone generator
pinMode(10, INPUT); // 2600 button

Our main loop() method has been kept simple, which is ideal because it is used frequently. The first sentence,

char button = keypad.getKey();

To determine if and which key was pushed, the getKey() function of the keypad object is used. The code, in short,

if(digitalRead(10)==HIGH){ // play 2600Hz if top button pressed<br>  super(); // supervisory signalling

Simply listens for voltage on pin 10 and, if discovered, calls the custom supervisory signalling super() method to play the 2600hz frequency. Just below the loop() function, this is the very first function declared. It’s also the first function that use the sf() function to play a single frequency.


The frequency to be played and the duration are the inputs we supply to this function. The custom sf() function only runs a single play method on a single pin after lexically assigning the frequency and duration to integer variables with the same names.


This is our first look at the Tone library’s tone synthesis play mechanism. So, consider playing two tones, but with two pins, for multi-frequency.


That’s exactly what the mf() method for bespoke multi-frequency playing does.

So, how does the procButton() method handle each key press? Using logic with a case-switch. The keypad library includes the constants “RELEASED,” “PRESSED,” and “HOLD,” (not “HELD” for some unknown reason), which we can use in a case-switch logic block as,

switch (keypad.getState()){<br>case RELEASED: // drop right away
  // do some stuff
case PRESSED: // momentary
  // do some stuff
case HOLD: // HELD (special functions)
  // do some stuff

That is precisely what we do. We get a keypadevent object provided to its handler procButton() since the procButton() method is an event-handler called by the loop() function (). This object may be treated as a simple character by subtracting the integer 48 from it to determine which key was pushed from 0 to 9.

void procButton(KeypadEvent b){<br>  b -= 48;

Now that we know which key was pushed, we can feed it to the mf() method, which plays the mf tones using the multidimensional array bb[], which we prepared before. It’s possible you’ve observed that the KP (*) and ST (#) aren’t 0-9. This is true; the values are -13 and -6, respectively, as they come through and after subtraction. The mf() function then takes care of them as follows:

}else if(digit==-13){<br>  digit = 12;  // *     
}else if(digit==-6){       
  digit = 14;  // #

This then plays the tones in the bb[] multi-dimensional array in the order they were assigned.

With this schematic (1), we’ve covered all of the main programming principles; now let’s look at the second schematic and see how we can play WAV files to give our blue boxes a whole distinct sound.


This code has a slew of extra capabilities, such as storing numbers in an array for later replay and operating in many modes. The Arduino C++ code is simple and straightforward. To switch between modes, press ‘A’ for a long time. The notifyMode() method will pulse out a code of 440hz beeps every time we change modes, letting us know which mode we’re in.

Step 4: 2nd Schematic

The SeeedStudio SD card shield for the Arduino UNO is used in this circuit. I’m using SeeedStudio’s v3 Shield, which is no longer available. The on-board toggle switch may be used to swap between the micro-SD and conventional SD slots.

Because I didn’t have an additional single Blue LED hanging around, I utilised a multi-colored LED in the scheme. Everything else appears to be identical to the prior edition (schematic 1).

In terms of coding, this gadget is a lot simpler than the first, but it’s also a lot more complex. The reason for this is that the Arduino UNO is notorious for running out of memory, and there appear to be several issues. So far, we’ve just covered how to play WAV files and a few limitations about storing playable WAV files on your Micro SD card.

Step 5: Code for Schematic 2


For this version, the code differences are minor. The whole code list may be seen here on my page. However, we should also discuss how to record WAV files, which we will do after the code analysis part. We are really utilising a different microcontroller board, the Arduino UNO, and should update the IDE to reflect this.

There are three new pre-processor directives:

#include  // preprocessor directives (header files)<br>#define SDPIN 10    // SD Card Pin for SeeedStudio SD Card Shield
#include  // to play WAV files

We utilise the code in the setup() method.

if (!SD.begin(SDPIN)) {<br>  Serial.println("initialization failed!");   
  Serial.println("initialization success!");   

tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc   
tmrpcm.setVolume(3); // set volume here (test for distortion)

Adjust the speaker output pin utilised by the TMRpcm object to 9 and set the volume programmatically to configure the SD card by mounting its file system. Setting the volume programmatically may be done with a simple button listener or a keypad callback, but I decided to leave it to the potentiometer because the software defined volume appeared to add some distortion to the tones.

We make a basic TMRpcm object as follows:

TMRpcm tmrpcm; // create sound playing object

Then we can use the play() function and send a character array to it, as follows:"sounds/blusin01.wav");

Especially the naming standards! For each file, I decided to keep it basic with an 8-character restriction. For instance, MF tones 0-9,


Audacity is a programme that allows you to create files.

All of my sound files were created with Audacity. When you initially launch audacity, you may adjust the frequency from 44kHz to 22kHz in the bottom left corner of the screen. After that, go to “Generate->Tone” and set the frequency to 700. I use a 0.5 amplitude, which produces minimal distortion. Select the single option with “milliseconds” using the right down arrow, and then set the value to (66 milliseconds).

Then, outside of the tone clip, click anywhere in the grey area and repeat the process, but this time pick 900hz. As seen in the picture above, this will produce a second mono channel tone directly below the first. Save it as “Other Uncompressed Files” by going to “File->Export.” Select “unsigned 8bit Microsoft PCM” from the “options” window.

Step 6: 3rd Schematic (Rotary Mechanism)

Our last blue box features an ancient rotating mechanism on the face, precisely like Ralph Barclay’s original blue box. In some aspects, the schematic is simpler, but in others, it is more complex. It’s simpler since the rotational mechanism just has two pins. My buddy Mathew Hesse gave me the concept for this box, and my mother gave me the phone mechanism.

Step 7: Create the Schematic 3 code (Rotary)

Pin 7 is the only input pit utilised, and it is defined in the setup() method. as,

pinMode(in, INPUT); // input for rotary device

We also set pins as input for 2600hz, KP, and ST, as well as our Tone objects in the pin[] array.

pin[0].begin(pin0); // Initialize our first tone generator<br>pin[1].begin(pin1); // Initialize our second tone generator
pinMode(b2600, INPUT); // 2600 button
pinMode(bst, INPUT); // 2600 button
pinMode(bkp, INPUT); // 2600 button

Following that, we simply call two methods in the loop() function: one to check if the buttons were pressed, and another to check if the rotary dial was accessible. The digitalRead() function is used by the buttons() function to check for voltage across the given pins. Whether the 2600hz button is hit, we simply check to see if digits have been recorded before and, if so, play them back by looping over the stored integer array and using mf() every digit until we reach a -1 value. Except for the unusual memory problem with our Arduino UNO box, this is pretty much how we playback digits for each box, if you haven’t noticed (schematic 2).

Dealing with Rotary Input
Using digitalRead(), the rotary() method reads the voltage on our rotary dial pin.

int reading = digitalRead(in);

This returns to reading the constant’s value, either HIGH or LOW. If it varies from the last read – stored in lastState – we use the millis() method to calculate the time.

lastStateChangeTime = millis();

When we check the difference between the current time at the start of the function and the lastStateChangeTime, we use this variable. We continue to play an MF tone if the delay is larger than 100 milliseconds. The previously pushed stored digit is examined, and we enter a new mode if we press a control digit twice. This is how we begin to enter digits into this area. We may start recording digits by pressing KP twice in this box. KP can then be used again by MFing the number, for example, KP,1,2,1,ST, and then hitting KP twice more to exit record mode. To switch to pulse dial mode, which I devised after seeing Joe Engressia’s video on pulse dialling, press and hold the shift key.

The Chassis is the eighth step.

The Box Model

All of the projects in this tutorial’s chassis fit nicely inside the Advantus SuperStacker Crayon Boxes available at

Holes in a circle

To cut out holes for the components, I simply twisted a steak knife with a sharp edge around the chassis or face-plate while applying pressure. It doesn’t have to be perfect because the washers and nuts will hide any flaws.

A scalpel or razor blade was used to remove any additional burnt or torn plastic from around the holes I made.

Dremel Machine

Not only was the Dremel Tool effective for drilling small holes, but it was also handy for a variety of other tasks. The drill bit was utilised to carve out the weird, big shape of the rotating dial mechanism, and the cutting disc was employed to shorten a potentiometer arm.

I placed the rotary dial mechanism on the face plate and took advantage of the fact that it was clear by using a black Sharpie marker to sketch around the piece that protrudes through into the case. After that, I simply bored a hole into the plastic right on the black line with a simple drill bit in my Dremel Tool, then followed the line around while carving the form out of the plastic.

When using any of these procedures, exercise extreme caution and wear protective eyewear.

Your Degree Is Just A Piece Of Paper, Your Real Education Is Seen In Your Behaviour.


“If you really want to live a good life, Never take anyone for Granted!” – KP

Helping Hands.

About the author


You can download our apps and books for free..
Search - Incognito Inventions

View all posts


  • Pretty nice post. I just stumbled upon your blog
    and wish to say that I have truly enjoyed browsing your blog
    posts. In any case, I will be subscribing to your rss feed and
    I hope you write again soon!

Leave a Reply

Your email address will not be published. Required fields are marked *