Another pic10f200 project, the Annoyo!

I had this cool idea for a prank at the office, a device that generate sound every 6 minutes. This device generates 4 different sounds at 6 minute intervals. The idea is that the sounds are short, familiar, difficult to find and infrequent enough to prevent a hunt for the offending noise. This device has been done before and obviously much more professionally by others but it’s fun to make since all you need is 2 caps, a 10f200, a speaker and a battery.

The device itself is dead simple, simply find an old speaker you never use, preferably a small one so that you can drive it from the output pin. Using a small battery like I have there, you could probably let the device run for about 30 days. Here’s the design:

dead simple, once again. Only one output is used on this device, I even disabled MCLR so that there is no extra resistor. Just one cap for decoupling and one cap for producing a larger waveform for the speaker. You can change the cap size if you want, you may want a larger cap for a bit of a smoother wave. So, here’s the pinout and the source code and .hex file

  • GP0,1,3 -> Not connected
  • GP2 (pin 3) -> to speaker

Source and hex: 10f200 annoyo

Anyways, a couple of notes. This program was written with Oshonsoft basic. Also, it could have been written a bit smaller if I tried but as it stands it takes up 253 of 255 bytes available in flash. 🙂

Hope somebody has fun with this!

Personal Projects

Comments (0)


10f200 debouncing and a new compiler

I’ve noticed some people doing search terms for debouncing and I figured I would post my method of debouncing inputs from switches. Some people have a big thing with using caps and resistors and gates with hysteresis but I prefer to simply use a cheap microcontroller because the result is programmable, MCU’s are cheap and there are fewer parts than the usual arrangements. Here is a crude circuit diagram of the debouncer. for this circuit the arrangement is (Input GP3 -> Output GP1)(Input GP2 -> Output GP0)

The problem with some other MCU methods is that people often try checking every 5ms to see if two successive input were high. This is a faulty approach since it can be computationally wasteful and can still produce noise. My approach is as follows:

  1. read the input on a loop
  2. if the input is high, increment a counter up to a certain maximum (say 90)
  3. if the counter goes above a certain amount (say 60) then turn on the output
  4. if the input is low, decrement the counter until it reaches 0
  5. if the counter goes below a certain amount (say 30) then turn off the output
  6. Don’t change the value of the output between 30 and 60

What this does is ensures that there is an area of hysteresis where the noise or bounce of the switch will not generate noise on the output. You can play with the rules to suit your specific need and improve responsiveness or make the output resilient to accidental triggering. This is the reason why for some more important things I have used this method. I have used a pic16f505 for this purpose as well with larger arrays of buttons. Having a programmed method that you can change easily can give you an easy ‘jellybean’ solution for these kinds of problems. Mind you of course when dealing with switches in high noise environments you may need to optoisolate or run TVSs on the switch.

If you’ve read any of my other posts you’ll know that I like the PIC10F200 MCUs simply because of their simplicity and the fact that a lot of people write them off as useless. This design is pretty crude as you can see and that leads me into the topic of the compiler. First,  here is a sample hex file for debouncing - debounce. This hex is programmed to premit a pressed switch to activate after 11ms.

I recently bought a suite of compilers from OshonSoft since I drifted over there out of pure chance. This company is a one man show who sells a variety of BASIC compilers for PIC, Z80 and 8085 processors. I tried the 10f compiler and was immediately impressed with how, for so inexpensively, there was a useful tool for simulation and programming.

I’ve only used the 10f compiler so far but it beats the tar out of PicBASIC Pro, as far as I can tell thus far. Not a lot of frills or gimmicks but it outputs very tight code. Here’s the source for the debouncer pic10f200. You can download a demo version of the 10f simulator at his website.

Well, anyways, that’s my little treatise on the subject. Also, for those of you on a tight budget and just getting into microcontrollers, Oshonsoft might be a good place to buy a compiler that’s reasonably simple.


Comments (0)


Timer lamp, Part Deux

Anyways, as I promised, here is the almost finished. A couple days later than I said but, still, I did finish it for the most part.

The lamp standing and working

The lamp standing and working

So Basically what we have here is a $20 lamp that’s been outfitted with buttons to control its power status. I have to warn people first, the methodology of affixing the stuff in here is very sloppy. If you follow these methods of hot gluing stuff, use caution to support the boards in other ways.

Inside of the lamp, gutted out

Inside of the lamp, gutted out and re-purposed

As you can see, I busted the box off of a wall wart to use as the power supply and used a terminal block to handle all of the mains stuff. It got pretty crowded in the enclosure so I’ll have to make a new cover for the bottom. Also, without the weight that was inside of it, it’ll topple. Anyways, it seems to work well.

Buttons and light

Buttons and light

So, after this is all done and a cover is made, I’ll also have to secure all of the boards a bit better and cut the prongs off of the wall wart, That’s a tad bit dangerous to have those prongs exposed.

So, whenever I get around to part three, I’ll take some pics and show them. Thus ends one application for the PIC10F200.

As an aside, I’ve been doing some of the work at a local hackerspace here in Edmonton. I was extremely surprised to find one here in Edmonton, land of the rednecks! Well, here are some pics of the place. It’s only been around for two years and  could always use some new members.

Here it is on the outside, nothing to make note of here.

Edmonton New Technology Society

The outside of the Edmonton New Technology Society

And here is the inside of the common area of the ENTS.

Edmonton New Technology Society Pano

Edmonton New Technology Society Pano Inside

Pretty messy, but that goes with the territory of a shared common use area I suppose. If anyone is interested, visit here in Edmonton.

Personal Projects

Comments (0)


The timer lamp Redux, Part one.

Well, in the vein of the spirit of the low-end microcontroller, I decided to make a timer lamp based around the PIC10F200. I did one years ago and it was based on a pic16f505 which is a low end MCU as well but it has quite a bit more ram and rom.  Also, oddly enough I shall actually share both the circuit diagram (which is dead simple) and the .hex file so people can use the program to make their own timer lamp if desired.

So here’s the quick rundown

The LED blinks very slowly so that you can see the lamp in the dark, but not so rapidly to become annoying. The power button turns the lamp on and off. the timer button turns on the timer. the increments are 1, 5 and 30 minutes.

Here is the circuit diagram.

Circuit diagram of Timer Lamp

Circuit diagram of Timer Lamp

Also, here is the HEX file: Timelamp hex file

Also, here are pictures of the boards in development.

Timer lamp on the breadboard

Timer lamp on the breadboard

This is messy but, it worked for dev purposes.

Timer lamp Circuit on the PCB

Timer lamp Circuit on the PCB. Kinda tight but it works.

And here is the finished board. Not bad for a couple hours of work. Yes, it’s messy, like everything I do.

So, tomorrow I’ll be going to my Hackerspace and drilling the holes and installing switches into a lamp I bought. Part 2 tomorrow, or the next day. 🙂

Personal Projects

Comments (2)


The underrated PIC10F200 (and 202/204/206 as well)

Sitting around looking through my collection of parts during a brief stint of illness I came across my stash of 30 or so PIC10F200’s. These were my entry into the world of microcontrollers. Granted I wasn’t very good at electronics (and probably still not very good) and I found the lowest end microcontroller i could in order to understand them on a more fundamental basis. I found all of the peripherals on other microcontrollers to be a distraction and complicating factor from what I wanted to learn.

batch of 10f200's

My little batch if PIC10F200's, I got more in tubes

Nowadays, delving into 32bit architectures and whatnot, I’ve forgotten about the little MCU’s. Thinking about it they’re still incredibly useful in a myriad of circumstances. Only costing 59 cents or 30 cents at volume, and running at 4Mhz internally these have an amazing range of uses.

Consider the lowest end of the low end, the 10F200. Now it only has 256 words (12-bit wide instructions) and 16 bytes of RAM. It has 3 I/O and one input only pin. Now in a world of Arduinos and large pin count microcontrollers running at 40+Mhz , it may seem like this thing has no use but I beg to differ.

Today I was tinkering around with the little unit today and I was recalling some of the things I imagined I could do with the limited hardware. So today I wanted to see how well it could produce sound. Now this little thing is trivial for most MCU’s, simply output an appropriate square wave. My goal though was to produce a warble and program it in a C compiler. This was very easy and achievable.

The little sound circuit

The little sound circuit I was working on... using a LM2904 for amplification.

Now, granted, it’s not a very complicated circuit, but I found it to work admirably. The compiled code took up only 36% of the ROM and 38% of the RAM. That’s with 2 16 bit counters and an 8 bit function variable. it also used delay functions. Of interest to note though, I tried using floats, no go, the libraries filled up the ROM like boom!

Anyways, here are some used I dreamed up for the PIC10F200 over the years. They are mostly in support roles but I think they’re equally as useful as any other role within a project, especially given the MCU’s small footprint and low price. The applications I’ve thought up are as follows, keep in mind we only have 3 IO and one input.

  • A dice game: I actually created a prototype of this some time ago based on the idea that this would be my business card. It was simply a set of multiplexed LED’s (six in total) on a PCB that would show like the face of a dotted die. one input was used and the other three were for the IO. Bringing the IO to an input mode would turn off the leds.
  • Two button debouncing: Using a microcontroller for debouncing has been my favorite way to debounce inputs on a button. By using an internal count on the MCU you can simulate a charging/discharging capacitor and provide threshold values to simulate a ‘dead zone’
  • A little robot: Using the two output for motor control and the two inputs for sensing, you could potentially make a simply robot. the only problem with it may be the limited ROM for logic routines, but I suppose that’s the challenge.
  • Timer Lamp: The 10f200 has just enough IO for two buttons and two outputs (I = On/off, I=Timer function, O= LED out, O=Relay for lamp). my old project with a timer lamp was done with a PIC16F505 (a limited MCU in its own right) but the 10F200 would’ve done the job quite admirably.
  • Dimmers on AC lamps: This example is used by microchip extensively to promote the device, it is one of the many uses of this device.
  • Sound generation: Like I did today, it seems like a pretty worthwile use of the chip. Cheap and easy. small size also helps with the surface mount varieties.
  • One-wire wake up: You could use it as a separate node to watch a data line for signalling on the one-wire protocol. I have used this to fire up LED’s in a specified pattern and duration. With the SOP package tou can solder it directly to the LED and data line in a bizzaro single package.

Anyways, the uses are endless for such a limited but inexpensive device. I have no idea why such a limited device captivates my imagination but perhaps it’s the small size that makes it interesting and uncomplicated design and use.

So, for your troubles of reading a wall of text. Here’s a neat photo of an old diode for your perusal.

Neat picture of a diode

A bonus picture of an old school diode. Gotta love the little spring inside holding the junction together.


Comments (3)