df99

Bluebox on an 8-pin DIP

31 posts in this topic

On the ProjectMF board, Phiber suggested the 12F683 using the PicBasic Pro compiler as a great platform for a tiny bluebox circuit.

I just coded and built a basic BB circuit with the 12F683. The chip uses Pulse Width Modulation (PWM) output, so the tone output is a little buzzy, but it works great with ProjectMF! The chips are < $1.00 each. With a crystal, a handful of resistors, and some buttons or keypad, you have a nifty little bluebox. One neat feature is using a single pin on the chip for the keyboard interface. This uses a resistor voltage divider to supply a different voltage to the pic's A to D converter for each button pressed.

I was limited by the 31-line code limit of the PICBASIC Pro demo. I'm sure others will enhance this proof-of-concept with programmable dial strings, additional tone sets, etc.

Pictures, schematic, source code, and .hex programmer file at:

http://www.projectmf.com/cgi-bin/ikonboard...T;f=3;t=2;st=30

post-10311-1201706672_thumb.jpg

Edited by df99
0

Share this post


Link to post
Share on other sites

cool and what do you think about PICAXE ?

The unique feature of the PICAXE system is that programs are downloaded via a direct cable link straight into the microcontroller, so no expensive programmers or erasers are required.
0

Share this post


Link to post
Share on other sites

Had never heard of PICAXE...

I scanned the Wikipedia entry on it briefly. It looks like a set of customized PICS that run a BASIC-like language, downloading code over a serial link. It lookes like the code is interpreted on the chip, rather than compiled, so could be quite slow. The chips run at 8 MHz max, so it would not work well with PWM output, which needs a 20 MHz clock for reasonable tone synthesis.

PICBasic allows inserting assembly code into the compiles BASIC code, which is a major advantage.

Just a quick first impression......

0

Share this post


Link to post
Share on other sites

The PICAXE is just a PIC with an embedded BASIC interpreter. Nothing really unique.

You can use an R-R2 Ladder to get actual sine wave output. It requires a number of pins though, depending on how accurate you want it. I've built 8-bit R-R2 ladders to go to full byte ports on AVR machines. Using discrete components (normal resistors) it's not very accurate, but you can make some acceptable waveforms. This opens up all manner of waveforms as well, not just square or sine. You can mix sine, triangle, white noise, anything you can think of. As long as the chip has the horsepower, that is.

The tiny chips are great, but it's just better to go with something a little bigger. The extra cost is not a factor if you're only making one or two devices, and will probably be only $1 or $2 more. I have some ATTiny 2313's I use, plus an ATMega 168. Both of these have more pins than I need, but that' never a bad thing.

BTW, AVR > PIC. And BASIC sucks, use C or assembly.

0

Share this post


Link to post
Share on other sites

I have to say, that's a VERY nifty lookiing microcontroller. What I especially like is that the tones are resettable to different values if you ever get bored with bluebox tones. I'm a complete nub when it comes to hardware hacking, but if I'm not mistaken, you could also add in a switch that toggles a considerable amount of resistance onto the connection to create a whole other tone set, say, for an *ahem* electronic music synthesizer? Since I happen to own an EPROM programmer that supports that model PIC, I went ahead and ordered a few samples.

For anybody whose looking for something to bluebox, try calling 503-697-0053. When the connection goes off-hook, dial KP + 3 + 7d + ST . If you do it right, a Cognitronics ANAC will start up and read back the number you sent! Remember, there ARE still things out there that recieve MF. The hardest part isn't finding them, but dropping onto a trunk without any digits dialed.

0

Share this post


Link to post
Share on other sites

The code is matched to using 14 equal-value resistors in the divider circuit. You can add additional buttons by adding more resistors, to a point. You would then have to use ohm's law to figure the value at each tap and the corresponding value the A to D puts out. You need to detect a range of values to allow for resistor tolerances.

The problem is the A to D gives 10-bit values (0 -1023). If you add too many resistors, the differences between each tap get less and detection is more sensitive to resistor value variation. Still, you could easily double the number of taps.

An easier solution is to just use the 12-button decoding and use length of keypress, code combinations, or a shift key to select other tone sets or functions. Darn, wish I had the full version of PicBASIC Pro!

The cool thing is that the reference voltage is set to the supply voltage, so that as the battery voltage droops, the A to D automatically compensates. I tested the thing at 3.0 to 5.5 volts. Button detection is rock-solid. The detection gets more sensitive as the voltage drops (the 1024 steps are spread across a narrower voltage range), but there is enough distance between taps that it still works fine.

BTW, PicBASIC Pro is compiled, so you are running machine-level code on the micro. It is not like the interpreted BASIC on the PICAXE. It can be mixed with assembly code, so is very powerful. The FREQOUT command handles all the hard tone generation work, which otherwise is very complicated. I coded it in assembler on a 68HC705C8, and it was a bear to debug.

Source Code

ADC_blue_box_04.pbp.txt

Programmer .hex file

ADC_blue_box_04.hex.txt

post-10311-1201783444_thumb.jpg

Edited by df99
0

Share this post


Link to post
Share on other sites

You could construct a simple bandpass filter to clean up the PWM audio, if you wanted. It would obviously add a few extra (passive) components, but can make it sound as good as a pure sine wave oscillator.

0

Share this post


Link to post
Share on other sites

I was playing some with various PWM output filters, with an eye towards simplicity and low parts count.

I found that the 2 mf cap I was using in parallel with the speaker/earpiece was overly attenuating the signal. In addition, it provided no current limiting for the PIC ouput pin, which has a maximum drive current of 25 ma.

I tried using the circuit shown in the Picbasic Pro manual. This is 2-1 Kohm resistors in series with a .1 mf capacitor to ground after the first and second resistor. This probably would work fine with an audio amplifier, but attenuated the signal too much to direct drive a speaker.

I tried using the same resistor-capacitor configuration, but changed the values of the resistors to 270 ohms and the capacitors to .33 mf. This improved the audio levels significantly. It keeps the current from the output circuit well below the 25 ma. source current limit of the PIC. The time constant and knee frequency with the new values is about the same as the values shown in the Picbasic manual. Filtering is quite good, but some hiss is still there, especially compared to my old bluebox circuit with the R-R2 output.

I tried using only a single pole filter (one 270 ohm resistor with a .33 mf cap to ground after it. The volume increased some, but the filtering (more buzzing) was significantly worse.

Putting a 10 mf. series capacitor between the output of the filter and the speaker seems to be optional. It made no audible difference in the output. I think the FREQOUT command properly sets the output port off after a tone is played, so eliminating the capacitor should be OK. No DC current should flow when there is no output.

Without using an op-amp or amplifier chip, I doubt there is any way to clean up the hiss completely. However, the simple filters make a nice low parts count solution that doesn't seem to affect the function of the blue box. All of the filter configurations MFed into ProjectMF fine.

0

Share this post


Link to post
Share on other sites

I improved the code for my 12F683 blue box by adding a DTMF mode. With this code, the box powers up in DTMF mode. A 2 second press of the 2600 button toggles to MF mode, confirmed by a low-high beep. Pressing the 2600 button for two seconds more after the 2600 plays toggles back to DTMF mode.

The schematic is the same as posted earlier in this thread.

ADC_blue_box_05.txt

ADC_blue_box_05.hex.txt

0

Share this post


Link to post
Share on other sites

Well. using about every program byte on the chip, I programmed up another version, again using the same schematic as before. I had to drop DTMF support for lack of room, but added 6 non-volatile programmable dialing memories. Each memory can hold 32 tones. Timings are fixed at 75 ms. for MF tones,except KP at 120 ms. 2600 is fixed at 1 second. Interdigit time is 75 ms.

The new routines, especially the EEPROM R/W code, is pretty well tested.

' On power up, a mode change, or a memory store operation, the device

' Saves the next 32 keypresses in a buffer. This buffer may be written

' to one of the six non-volatile memory locations (1-6) by pressing and

' holding the corresponding digit for two seconds. The tone played when the

' key is first pressed to store will not be recorded. Reset the digit buffer

' by cycling power, saving a previous buffer to EEPROM, or changing modes.

' The box operates in two modes. In the default mode, it plays MF and

' the 2600 tone manually. Pressing and holding the 2600 button more than

' two seconds toggles to the playback mode. In this mode, sequences stored

' in the 6 memories may be played by pressing the corresponding key. Another two

' second press of the 2600 key, or power cycling, returns to normal mode.

' Memory locations may be cleared by pressing and holding the corresponding

' key in normal mode immediately after the buffer has been cleared at power-up,

' after a mode change back to normal mode, or after storing a digit sequence.

ADC_blue_box_06.txt

ADC_blue_box_06.hex.txt

0

Share this post


Link to post
Share on other sites

One more version.

This one has 12 32-tone memories, one for each keypad digit. The 2600 key toggles between regular and playback modes. Mode changes are confirmed by low-high or high-low beeps.

In regular mode, the 2600 key and digit keys send tones manually. In playback mode, the 2600 key is not active, except to change modes. Each digit key plays back the tones saved to that memory slot.

Tones may be only be stored to memory in regular mode. After power-on, after saving to a memory location, or after changing modes back to regular from playback, an internal buffer records the FIRST 32 keypresses, including 2600. At any point, the digits may be saved to memory by pressing and holding one of the twelve keypad keys for 2 seconds. A short beep plays at the beginning of the write of the buffer to EEPROM and a long beep after the write completes.

If a 2600 tone is saved to memory, a 1.5 second pause is inserted after the 2600 in playback mode to allow for a wink acknowledgement. After that, any additional tones will play.

Tone duration in all modes is 75 ms. for all MF tones, except for KP, which is 150 ms. long. 2600 is 1 second long. There is a fixed inter-digit time of 75 ms.

I used the previously unused upper nibble of each EEPROM location to add the additional memories. Each memory consists of 33 EEPROM bytes, 32 for the data, one byte for an end-of-file indicator. Memories 1-6 are in the lower nibbles of storage, 7-12 in the upper nibbles. The code is pretty well structured and commented. I've tested this pretty thoroughly, dumping the EEPROM contents to check the data structures.

The code takes up 1,612 bytes of the available 2048 bytes of program space in the 12F683.

Use the same schematic as described earlier.

ADC_blue_box_09.txt

ADC_blue_box_09.hex.txt

0

Share this post


Link to post
Share on other sites

I added DTMF mode back, storage of tone mode along with digits in dialing memories, and configurable eeprom storage of default tone mode (MF/DTMF) and tone duration/spacing (75 ms./120ms.). 2038 out of 2048 available program bytes were used. I had to shut off the automatic compiler watchdog timer refresh and the on-chip watchdog timer to get additional code space for the enhancements.

Features:

- Supports a 12 digit keypad, plus an additonal 2600 button. All keys are SPST switch closures with a common connection. (See schematic in this thread.)

- Both MF and DTMF are supported. When initially programmed, the chip defaults to MF mode on powerup. The powerup mode is stored in eeprom. This may be temporarily toggled to the opposite mode by holding down the 2600 key while powering up. The next powerup reverts to the default tone mode. The default tone mode may be persistently toggled by holding down the "*" while powering up. This will toggle the tone mode, but also write the new setting to eeprom so subsequent powerups will default to the opposite tone mode. A tone confirms the write to eeprom.

- Two tone durations/spacings are supported, 75 ms. (default) and 120 ms. The tone duration/spacing is stored in eeprom. The duration/spacing may be permanently toggled by holding down the "#" key at power up. This will toggle the duration/spacing and write the new value to eeprom for subsequent powerups. A tone confirms the write to eeprom. The duration/spacing value is used in manual mode and also in memory playback mode. The KP tone is always 120 ms. duration, regardless of this setting. The 2600 tone duration is always 1.5 seconds.

- There are two operating modes, normal and playback. The chip always powers up in normal mode. Operating modes are toggled by holding down the 2600 key for 1 second. Tones confirm the mode change. In normal mode, dialing is manual using the current tone mode and duration settings. In playback mode, each keypad key will play back any stored dialing sequences.

- There are 12-32 digit dialing memories, one for each keypad key. On power-up, a playback to normal mode change, or a dialing memory write the chip stores the next 32 key presses in a RAM buffer. At any point, this buffer may be saved to one of the 12 dialing memories by pressing and holding the corresponding key for 2 seconds. (The digit played when initiating a write to the memory will not be saved.) A tone confirms the eeprom write. Memories are cleared by storing to memory immediately after a power-up, mode change from playback to normal, or after a previous dialing memory save. The MF/DTMF tone mode is saved in memory, so the dialing memories may contain a mix of MF and DTMF sequences. If a 2600 tone is saved, a 1.5 second fixed delay will be added after the tone to allow for a wink ack from the trunk. Then, any additional tones will play.

Source code

ADC_blue_box_12.pbp.txt

Hex file for programmer

ADC_blue_box_12.hex.txt

0

Share this post


Link to post
Share on other sites

I've got my PWM filter worked out pretty well, using a 2N2222 transistor emitter follower to boost the volume and improve the tone quality. It works very well.

I'm building two "production" versions of my 12F683 box, based on schematic and code posted here. One is a modern looking box in a Serpec case with a nice keypad. The other is a unit built in a black and silver project case, with discrete pushbuttons for the keys.

I'm going for the 1971 Esquire article look!

Source code

Hex file for programmer

post-10311-1208455590_thumb.jpg

Here is an updated schematic showing the new

filter/emitter follower configuration.

This works well because the inductance of the

earpiece/speaker helps smooth the audio some. The

impedance and coil resistance of the speaker should be

high enough to avoid excessive current through the

speaker. I found that the FREQOUT PicBASIC command

sometimes leaves the PWM pin in a high state, which

can cause excessive current through the speaker. In my

most recent code (see below) I

added a routine to force the PWM otput pin low after 3

seconds of inactivity. This can create a small "pop"

in the speaker, so I don't do it after every key

press.

post-10311-1208455691_thumb.jpg

ADC_blue_box_13.pbp.txt

Edited by df99
0

Share this post


Link to post
Share on other sites

Here are three pics of my assembled prototype, before installation in an enclosure. The circuit board will fold and be hot-melt glued behind the keypad before being put into the case" I'm using an old "500" telephone set earpiece for the speaker. I'm using a small Radio Shack 6 volt cell in an "N" cell battery holder for power. Power consumption is 4 ma when idle and max. 20 ma. when playing a tone. Battery has a 105 maH capacity, so should last a long time. The extra button is for 2600. The circuit board is a standard Radio Shack model, trimmed with an xacto knife to fit the case. The keypad is not the usual matrixed type, but provides a common connection for all the buttons and another connection for each button, just like the schematic.

post-10311-1208978522_thumb.jpg

This one shows the keyboard to voltage divider connections. The wires are stabilized with hot-melt glue. Sloppy, but effective!

post-10311-1208978529_thumb.jpg

This shows the component layout. I am not using the 78L05 voltage regulator in the schematic. Instead, I use a diode to drop the 6 volt battery .7 volts to a range the PIC is happy with. It also provides reverse polarity protection. Works swell!

The blue blob on the right is the 20 MHz resonator. The orange blob is a 100 mf tantalum cap I added to prevent the circuit from resetting if the battery power glitched from being knocked about while in use. The output filter and emitter follower transistor are in the lower left. At the top are the resistors for the voltage divider.

post-10311-1208978537_thumb.jpg

Note that there are some jumpers on the back of the board that are not visible here. Be sure to check the schematic!

The enclosure is a Serpac KL0049 type, mentioned in another box construction thread on the board. This model may not available, as it is no longer shown on the Serpac site.

I'm working on a demo video that shows the box in operation and illustrates its features.

0

Share this post


Link to post
Share on other sites

Don't think no one is following this thread by the lack of replies. I've been reading since the beginning.

It's interesting that you could cram this onto an 8-pin DIP, but the number of resistors on the board ends up making it more complicated than it needs to be. A single 8-bit port can drive a 4x4 switch matrix (you only need 4x3 + 1, so you could even add 3 more buttons). You only need a single pin for the speaker output for a total of 9 pins. A PIC16 in a 14-pin package would end up being smaller and simpler with almost no external components.

A keypad like this with rows/columns connected directly to 8 pins (4 output row drivers, 4 column inputs) is what I'm talking about. If you had enough output pins, you could use a small resistor network in a SIP package to make a DAC for better waveform output as well. I found a 4-bit DAC with a simple lowpass filter (nothing but a resistor and capacitor) produced very acceptable waveforms. Plus your board would be absolutely tiny.

0

Share this post


Link to post
Share on other sites

Thanks for the comments....

I just use this thread as sort of a project log, for those interested. I've not been worried about lack of response, as long as the reader count keeps moving up.

I've coded and built a few boxes with 8-bit R-2R resistor network DACs, using sine lookup tables. You're right, they sound much better than PWM. My design used 8 bits, but I suppose 4 bits would be OK if the sampling rate was high enough. My box ran at 4 MHz. At 2600 Hz, the number of sine table samples/cycle was fairly small,but it still sounded OK. The unfiltered stairstep waveform looked pretty crude the higher the output frequency.

Point taken on the keypad encoder. I just was infatuated with the idea of interfacing a keypad to a single pin and wanted to try it. Also, the resistor network makes it easy to add a few extra switches, where the matrixed approach is slightly more challenging. Using a SIP for the resistor network for this design would certainly reduce the size and wiring complexity.

0

Share this post


Link to post
Share on other sites
Thanks for the comments....

Point taken on the keypad encoder. I just was infatuated with the idea of interfacing a keypad to a single pin and wanted to try it. Also, the resistor network makes it easy to add a few extra switches, where the matrixed approach is slightly more challenging. Using a SIP for the resistor network for this design would certainly reduce the size and wiring complexity.

But that was a thinkers way of doing it... kudos.

0

Share this post


Link to post
Share on other sites
For anybody whose looking for something to bluebox, try calling 503-697-0053. When the connection goes off-hook, dial KP + 3 + 7d + ST . If you do it right, a Cognitronics ANAC will start up and read back the number you sent! Remember, there ARE still things out there that recieve MF. The hardest part isn't finding them, but dropping onto a trunk without any digits dialed.

Hey, I just tried this using the memory playback function of my box. It works every time, at least with 555-5555 as the test digits. I get a brief MF digit before readback, if I get the timing right. There is no real off-hook click or other indication, other than a subtle change in background hiss. When I heard the noise change, I outpulsed the digits.

Do you have more info on what this is?

Edited by df99
0

Share this post


Link to post
Share on other sites

Here's the latest code. I optimized the digit selection routine to elimate redundant subroutine calls. It left enough room to put back the two beeps on memory storage location writes. There is a short beep when the write begins and a longer beep after it completes. The spacing between the two varies, depending on the number of digits being stored.

Otherwise, it works the same as the previous version, documented here.

ADC_blue_box_14.hex.txt

ADC_blue_box_14.pbp.txt

Edited by df99
0

Share this post


Link to post
Share on other sites

This is a fantastic project! I'd like to see you start a fresh on a MK2 version that uses a bigger pic and a larger matrix keypad as has already been suggested with the ABCD keys.

Coin drop tones and other features would also be neat.

I can see this device being dual purpose as many Hackers are Ham's and could also use it for Echolink, AllStar, rptr control and so on.

Perhaps you could make it modular also so people could add bits as they could afford to.

For example it could have an optional LCD display. Now that would be cool!.

Keep up the great work!.

.-.-.

0

Share this post


Link to post
Share on other sites

Thanks.

All that is easily done with a bigger PIC and slightly modified circuit.

I was trying to duplicate a simple "stealth" box that could be operated by a blind person by touch, or by a sighted person in the gloom of a phone booth at twilight. Darn, I miss those days!

The goal also was to make something simple, inexpensive, at easy to put together for the soldering-challenged.

I have quite a few of the boards /PICs on hand, so probably won't get around to doing anything new for a while.

However, if anyone has bulit one or bought a board and would like me to replace the DTMF code with some custom tones/sequences, I'd be willing to do an SP version. Changing the tones is easy.

0

Share this post


Link to post
Share on other sites

OK, Great! It's fantastic to see people still doing a bit of DIY and reviving all the old retro stuff.

I found in one of your forums a gent who shed some light on an older project which seems to be exactly what everyone is asking for.

It's an all in one design called the `JollyBox'. It emulates the Red & Blue Boxing + more. The old design is based around a 8049 CPU and a couple of Eproms. But the guy seems interested in reviving it using a newer pic micro design.

It even uses the expanded keypad with the extra ABCD keys.

Do you know of an even better design? Or was it the be all end all of phreaking box's?

Perhaps you guys could work together on the project??

.-.-.

Edited by SiliconJaguar
0

Share this post


Link to post
Share on other sites

I think the JollyBox was pretty state-of-the art for the time. It was quite complex to duplicate, though.

The end-all of boxes from a while back had to have been the Hack-Tic Demon Dialer. It used the same 68HC705C8 design as my older box, but had programable tone sets, timings, password security, memories, etc./etc.

Emulating that box would be a worthy project. I've been trying to track down the source code for years, but it seems to have vanished. The chips themselves all had the code protect bit set, so can not be read back and dis-assembled.

Duplicating on a PIC using PWM tone output would be straightforward, but still very time consuming to code and test properly. I may try it in the future. The manual has all the information that is really needed.

I have the Demon Dialer schematic, manual, but no code. A few surviving ones have been used to dial into my PMF server though.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now