Peanut Butter Monster Detector project questions

Get help with your Nuts & Volts projects or Kits purchased from Nuts & Volts here.
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Peanut Butter Monster Detector project questions

Post by VernGraner »

I've received a number of emails asking questions about the Peanut Butter Monster Detector Project featured on the cover of the November issue of Nuts and Volts magazine. As many of these questions were similar, I decided to try and answer them all in one shot here and then refer folks to the forum for answers, collaboration and followup. :smile:
The BS1-OEM kit is no longer available from Parallax. Can I use the standard BS1-IC chip they do stock?
YES- you can use the standard BS1 SIP style chip from Parallax as a drop-in replacement.
Do I need to make any changes to use the BS1-IC instead of the BS1-OEM?
YES- you will need to add your own BS1 Programming header. This is fairly simple to do. You need only add a 3-pin .100 spacing header to the board as shown here:

Image
Where can I get the .100" spacing headers?
Electronic Goldmine has a nice selection
Parallax does sell an OEM Basic Stamp 2, would this work with your code and schematic?
The BS1 code I've written for the Peanut Butter Monster Detector will not run directly on a BSII without modification. As there is a drop-in replacement for the BS1-OEM board, converting the code should not be necessary.
Can you share in more detail what you did to replace the lamp in the push button with the red LED? (i.e. how you connected it after removing the lamp and if a resistor is needed)
Sure- I prepared a typical high-brightness LED by clipping one led very short and replacing that leg by soldering in a 330ohm resistor. I then "tinned" the two lamp connectors inside the push button. I then clipped the LED lead and the resistor lead to fit under the cap of the button. I then soldered it into place using forceps to hold the part while I soldered. Of course, you don't have to go to this much work. :cool: If you want you can simply order the LED lamp for the switch from Happ controls directly.
I've been to several local supermarkets and haven't found a peanut butter jar that matches what you used, all seem to have too small an opening to fit the PCB. Do you recall what brand peanut butter your jar was?
Sure! It was Peter Pan Peanut Butter! Lots of room in a jar that big. :wink:
I can't seem to find the "Complete Source Code" listed as being available on the Nuts and VOlts Website. Can you give me a link?
Yes- The source code is available in the FTP section of the Nuts and Volts website right here
What size is the diode you added on the bottom of the board?
Any "back EMF" silicon diode should work. I used one from a bunch I got from AllElectronics
And what is the voltage? 9V?
I used a surplus 6v wall wart I had laying around. I would recommend that you use a wall-wart with as close to 6 volts as you can find. NOTE: do NOT exceed 7.5v input voltage as the Servo Motor is limited to no more than 7.5volts! If you are unsure of the power supply you have, be safe and go with the 7.5v power supply sold by Parallax.
The Sound Module I purchased from radio shack does not have the resistors shown. How do I connect it?
Wow. That's a new one on me! :???: As I haven't seen one I really can't advise. I know that if push comes to shove, you could use a relay and simply close the contacts on the push button switch. Still, I would probably begin by taking each lead of the "activate" push button to ground and see if the module activates. If it does, then use that lead. :)

Please let me know if you have any questions not addressed here. Also, please feel free to talk amongst yourselves and share ideas, concerns and questions. I'll keep an eye on this thread and help where I can! :)

Vern
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Post by mosimpson »

The sound module I bought from Radio Shack does have the resistors however they are now surface mount. I jumpered Gnd to R3 and the module did activate. Surface mount resistors are tiny little squares and don't look anything like the resistors shown in the pictures of the one Mr. Graner used.
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Post by mosimpson »

Vern-

I have a question about your schematic. Is Vdd and RES hooked to anything? Are the numbers on the lines leading from Vdd and RES wire numbers? They seem to share the same numbers as the wires leading to speaker 1.

I tried searching the Parallax site for an explanation of what Vdd and RES are used for but didn't have any luck. Can you explain what they are used for? Is this information available on the site?

Mike
psycho
Posts: 388
Joined: Thu Jan 10, 2008 8:13 pm
Location: Northwest Indiana
Contact:

Post by psycho »

I looked at the schematic and no, Vdd and Res are not hooked to anything. They are pins 5 & 6, respectively, of the Basic Stamp 1 module. If you look at the schematic of the BS1 here:
http://www.parallax.com/Portals/0/Downl ... icRevB.pdf

If you look through this:
http://www.parallax.com/Portals/0/Downl ... ampfaq.pdf

You will note that Res is the reset pin and Vdd is regulated 5v out of the BS1.

and, no, I have never used any stamp before :eek:

-- edit
There are two devices on the schematic. One is a Basic Stamp module and the other is a sound module of some sort. The numbers on the outside of these modules have no intended correlation to each other. So, the speaker has nothing to do with pin 5 or 6 of the BS1 module. Those numbers are there so that when you wire it, you will know physically which pins are what. If you look at the schematic, the numbers are not in numerical order. The numbers are there for convenience.
---

Hope it helps,
Kevin
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Post by VernGraner »

psycho wrote:I looked at the schematic...
And came up with exactly the right answers! :smile: Thanks for the help Kevin!

Vern
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Post by mosimpson »

Vern-

For the second speaker I bought an 8-Ohm mini speaker from Radio Shack, p/n 273-092. Can you adress my following questions?

1. Is the 2.2 uF capacitor ok to use with this?

2. Can you explain the purpose of this capacitor and how one goes about sizing it?

Thanks.
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Post by VernGraner »

mosimpson wrote:For the second speaker I bought an 8-Ohm mini speaker from Radio Shack, p/n 273-092. Can you adress my following questions?

1. Is the 2.2 uF capacitor ok to use with this?

2. Can you explain the purpose of this capacitor and how one goes about sizing it?
mosimpson:

I assume the capacitor in question is shown as C1 in this schematic:

Image
Schematic Parts List
  • U1: BASIC Stamp 1 - Parallax "BS1-IC"
    SR1: Sound recording module (Cat# 276-1323)
    SW1: N.O. momentary lighted button
    SW2: N.O. momentary button (included w/SR1)
    SP1: 8 ohm Speaker (included w/SR1)
    C1: 2.2uf decoupling capacitor
    D1: RED LED (internal to SW1)
    D2-5: WHITE LEDs (LED-75 All Electronics)
    D6-7: GREEN LEDs (Radio Shack Catalog #: 276-1622
    D8-9: RED LEDs (radio shack Catalog #: 276-1622
    R1: 100k ohm resistor
    R2-10: 330 ohm resistors
    J1: .100" 3 pin header (AllElectronics CAT# SHS-32)
    J2: .100" 3 pin header (AllElectronics CAT# SHS-32)
A 2.2uF should be fine. The value of the cap is non-critical (within reason) as its purpose is to decouple the DC voltage from the output pin of the stamp to the input of the speaker.

A smaller capacitor (i.e. 1uF) will act as a "high-pass filter" thereby making a thinner, "tinnier" sound than a larger value cap. A 10uF cap will give the output a "rounder" sound by allowing more low frequencies to pass to the speaker.

Its really a matter of taste as to which value to use. If you have a few caps you might experiment with different values and see how it sounds to you. In my experince, any value from 1uf to 20uf or so should work fine.

For reference, the Parallax Basic Stamp manual shows the following circuit for connecting a speaker to the Basic Stamp:

Image

They suggest putting a 33ohm resistor in series with the speaker if you are using an 8 ohm speaker, but I haven't found this to be necessary in practical application. :cool:

Please let me know if you have any other questions. :smile:
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Post by mosimpson »

Vern-

I'm finally working on the final assembly of my Monster Detector and a question popped up. For the power supplied to the Button, Button LED, white LED's and Red/Green LED's did you run individual wire to the proto board or did you create a bus? I've scoured over the pictures attached to you article and it seems you have less wire running out of the board than I do. :shock: I've initially started terminating individual wires to the proto board, using the middle rows as my power distribution bus, and realized I'll need 10 wires running out of the proto board to accomplish power distribution to all of these components.

Thanks
Mike
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Post by VernGraner »

mosimpson wrote:For the power supplied to the Button, Button LED, white LED's and Red/Green LED's did you run individual wire to the proto board or did you create a bus?
I created a wire "loom" to go to the rotating scan head that contained a single wire for the Red led pair, a single wire for the Green led pair and a single return wire for all those LEDs (total of 3 wires).

For the push button, I created another wire loom that consisted of a wire for the button, a wire for the LED and a single return wire for that section (total of 3 wires).

For the white LEDs, I had a wire running to one side of the "string" of white LEDs and a single return there as well (total of 2 wires).

A quick look at the schematic shows that I usually "bus" the high-side (i.e. the positive rail) and then do low-side switching.

I've uploaded some high resolution images that were not published in the article (I usually take lots of extra pics and then pick the most relevant for the article) to my online gallery that might help you visualize the physical wiring of the system:

Exrta Pictures of the Peanut Butter Monster Detector

Let me know if you need anything else. :)

Vern
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Re: Peanut Butter Monster Detector project questions

Post by mosimpson »

Help Vern!

I powered my PBMD today and programmed it. I was thrilled when it made some sound and blinked some LED's. But my happiness quickly disappeared when I realized something was wrong. When I plug in my PBMD it quickly blinks the Button LED and immediately makes the Zrrrrp sound. I think my system is acting as if the button has been pressed even though it hasn't. I've gone over the wiring multiple times and can't seem to find any errors. Can you make some suggestions?

Here's a list, in order, of what happens after powering the unit.
1. Button LED Blinks.
2. Zrrrp! sound.
3. (I don't have anything currently recorded in sound module)
4. Servo rotates
5. Red and green LED's blink.
6. Servo rotates.
7. Red and green LED's blink.
8. Green LED's blink on and off.
9. Button LED and white LED's turn on and remain on for approx. 30 sec. (red and green LED's are on during this step.
10. White LED's turn off.
11. Button LED remains on then turns off.
12. Return to step 4 and repeat.
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Re: Peanut Butter Monster Detector project questions

Post by VernGraner »

mosimpson wrote:When I plug in my PBMD it quickly blinks the Button LED and immediately makes the Zrrrrp sound. I think my system is acting as if the button has been pressed even though it hasn't.
Hi "mosimpson". :smile: I think I can help here. The problem is likely due to differences between the published schematic and the prototype unit I built here. To correct this problem, you should only need to make a small change to the source code. Open the code in the editor and locate the section entitled "Wait for Button". Locate the BUTTON command and change the DownState and TargetState to the values shown here:

Code: Select all

' ************************
' * Wait for button      *
' ************************
  CheckButton:
  'BUTTON Pin    , DownState, Delay, Rate, Workspace, TargetState, Address
   BUTTON Trigger,         0,   254,  150,    btnWrk,           1, NoPress
The above changes the "DownState" (the logical value when the button is PRESSED DOWN) to ZERO and the TargetState (the value that will cause BUTTON to branch to the "NoPress" address) to a logic ONE.

This way, when the button is NOT pressed down, the pull-up resistor will cause the pin to show a logic 1. This will make the BUTTON command branch to the target address (NoPress) causing the "lottery" to tumble and servicing the PWM that dims the LED.

When you press the button, it takes P0 to GND causing a logic ZERO. At this point, the BUTTON command does not have a valid branch to NoPress, so we fall through to the "ButtonDetected" address and continue on to the "MonsterCheck" routine.

I hope this fixes it up for you and I apologize for the mixup between the source code and the published schematic (seems my prototype used a pull-down resistor). oops! :shock:

Please let me know if this fix works for you and if you have any other questions. :)

Vern
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Re: Peanut Butter Monster Detector project questions

Post by mosimpson »

Vern,

Thanks for the quick response. :grin: After writing you yesterday I downloaded 'BASIC Stamp Syntax and Reference Manual' and did some research myself. I had convinced myself last night that the BUTTON command was the culprit to my problem. I also checked the voltage values at P0 with the button pushed and unpushed. After reading about BUTTON I was sure the values were incorrect in the code I downloaded and even boasted to my wife that I'd found the problem. But after downloading my updated code to the PBMD it immediately started running and is acting the same as before the updated code download. :shock: I then logged in this morning to see if you'd responded back and was happy to see you had. Your explanation seems spot on with what I had discovered, however it didn't work. Is there a way to erase the code in the BS1 before downloading? My thought is that maybe the new code didn't take. My PBMD starts looping as soon as I power it up will this affect downloading? Do I need to stop program execution before downloading? I feel like I'm so close and still feel the Button command is where the problem is.
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Re: Peanut Butter Monster Detector project questions

Post by VernGraner »

mosimpson wrote:Your explanation seems spot on with what I had discovered, however it didn't work. Is there a way to erase the code in the BS1 before downloading? My thought is that maybe the new code didn't take.
Hmm. A bit of a mystery then. :) Ok, first things first-- there is no option to "erase" the code in the Basic Stamp as when you download new code, it completely replaces the existing code. I have never once had a download of new code fail to replace the old code.

Its more likely that we need to investigate the physical hardware. Can you use a meter to make sure P0 is showing 5 volts when the button is in the "un-pressed" position, and it is showing ZERO volts when the buttoin is pressed?

Vern
--
Vern Graner
mosimpson
Posts: 14
Joined: Wed Oct 29, 2008 6:48 pm
Contact:

Re: Peanut Butter Monster Detector project questions

Post by mosimpson »

I actually checked this already when I started my troubleshooting session and found ~6.8V when not pressed and 0V when pressed.
User avatar
VernGraner
Posts: 223
Joined: Sun Mar 02, 2003 1:01 am
Location: Austin Texas
Contact:

Re: Peanut Butter Monster Detector project questions

Post by VernGraner »

mosimpson wrote:I actually checked this already when I started my troubleshooting session and found ~6.8V when not pressed and 0V when pressed.
Wow! That's an abnormally high voltage reading. the Basic Stamp is a 5 volt TTL level part and as such, you should not be seeing anything higher than 5v on that pin. Did you tie your pull-up resistor to the Vin instead of voltage provided by the 5v regulator?

[a few moments later...]

Ok, I went back and examined the schematic and I think I might see what's wrong. In the prototype unit I built, I used the OEM Basic Stamp 1 which has an on-board LM2940 5 volt regulator. As that chip can supply plenty of amperage to drive the LEDs and the servo motor, I used it to supply power to the entire circuit INCLUDING THE PULL UP resistors! :shock: If you are NOT using the OEM version of the stamp, and your Vin is higher than 5v, you will have to one of the following:
  • install a 7805 or 2940 to supply power to the kit
  • Use a regulated 5vdc wall-wart
  • make sure that the P0 pull-up resister is tied to Vdd of the chip.
Dang it! I'm really sorry for the confusion :???: Please let me know if this works.

Vern
--
Vern Graner
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests