Shop OBEX P1 Docs P2 Docs Learn Events
Why is my BS2PX Hot? — Parallax Forums

Why is my BS2PX Hot?

AvManAvMan Posts: 7
edited 2007-10-01 15:50 in BASIC Stamp
I am trying to run a simple keypad scanning program and I believe that the way I am doing it is causing the surface-mount microchip on my BS2PX to get hot. The purpose of the program is to scan an external keypad with 5 columns and 5 rows (10 pins) and DEBUG the output. After a few seconds the microchip gets hot to the touch even when no keys are being pressed. This is why I believe that it is a programming problem and not the fact that a connection is being made between two pins on the chip via the keypad.

One possible problem could be the ‘GOTO main’ command at the end of the program. This causes a loop to scan the keypad over and over again, but looping in a program is a very common practice and does not normally cause a chip to overheat. Below is my program. I wouldn’t recommend loading it on your BS2. I don’t want to be the cause of any catastrophic chip failures. I know they are expensive.

I have had trouble in the past trying to find a very basic keypad scanning program, pseudocode or even a flow chart. The Paralax “Nuts and Volts” keypad scanning lesson led me in the right direction but provided a program example that did not scan a keypad.


Below is the program I am currently running:


' {$STAMP BS2px}
' {$PBASIC 2.5}
'
' =========================================================================


'
[noparse][[/noparse] Program Description ]

'TO test keypad

'
[noparse][[/noparse] I/O Definitions ]

' Rows
OUTPUT 5 ' pad pin 1
OUTPUT 6 ' pad pin 2
OUTPUT 7 ' pad pin 3
OUTPUT 8 ' pad pin 4
OUTPUT 9 ' pad pin 5

' Couloumns
INPUT 11 ' pad pin 6
INPUT 12 ' pad pin 7
INPUT 13 ' pad pin 8
INPUT 14 ' pad pin 9
INPUT 15 ' pad pin 10

' Pull up inputs
CONFIGPIN PULLUP, %1111100000000000


CONFIGPIN SCHMITT, %0111111111100000


'
[noparse][[/noparse] Constants ]

MoveTo CON 2 ' DEBUG positioning command
ClrRt CON 11 ' clear line right of cursor
FieldLen CON 22 ' length of debug text

'
[noparse][[/noparse] Variables ]



'
[noparse][[/noparse] Initialization ]

Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
PAUSE 250
DEBUG " Keypad", CR,
"
"



'
[noparse][[/noparse] Program Code ]




DEBUG MoveTo, 0, 3, "Enter Value: "
PAUSE 500

Main:

' Scan Row 1

OUT5 = 0
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 1

IF OUT5 = 0 AND IN11 = 0 THEN
DEBUG "F3 "
ELSEIF OUT5 = 0 AND IN12 = 0 THEN
DEBUG "F2 "
ELSEIF OUT5 = 0 AND IN13 = 0 THEN
DEBUG "F1 "
ELSEIF OUT5 = 0 AND IN14 = 0 THEN
DEBUG "F0 "
ELSEIF OUT5 = 0 AND IN15 = 0 THEN
DEBUG "Space "
ENDIF

' Scan Row 2

OUT5 = 1
OUT6 = 0
OUT7 = 1
OUT8 = 1
OUT9 = 1

IF OUT6 = 0 AND IN11 = 0 THEN
DEBUG "F "
ELSEIF OUT6 = 0 AND IN12 = 0 THEN
DEBUG "E "
ELSEIF OUT6 = 0 AND IN13 = 0 THEN
DEBUG "D "
ELSEIF OUT6 = 0 AND IN14 = 0 THEN
DEBUG "C "
ELSEIF OUT6 = 0 AND IN15 = 0 THEN
DEBUG "Enter "
ENDIF

' Scan Row 3

OUT5 = 1
OUT6 = 1
OUT7 = 0
OUT8 = 1
OUT9 = 1

IF OUT7 = 0 AND IN11 = 0 THEN
DEBUG "B "
ELSEIF OUT7 = 0 AND IN12 = 0 THEN
DEBUG "A "
ELSEIF OUT7 = 0 AND IN13 = 0 THEN
DEBUG "9 "
ELSEIF OUT7 = 0 AND IN14 = 0 THEN
DEBUG "8 "
ELSEIF OUT7 = 0 AND IN15 = 0 THEN
DEBUG "____> "
ENDIF

' Scan Row 4

OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 0
OUT9 = 1

IF OUT8 = 0 AND IN11 = 0 THEN
DEBUG "7 "
ELSEIF OUT8 = 0 AND IN12 = 0 THEN
DEBUG "6 "
ELSEIF OUT8 = 0 AND IN13 = 0 THEN
DEBUG "5 "
ELSEIF OUT8 = 0 AND IN14 = 0 THEN
DEBUG "4 "
ELSEIF OUT8 = 0 AND IN15 = 0 THEN
DEBUG "DEL "
ENDIF

' Scan Row 5

OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 0

IF OUT9 = 0 AND IN11 = 0 THEN
DEBUG "3 "
ELSEIF OUT9 = 0 AND IN12 = 0 THEN
DEBUG "2 "
ELSEIF OUT9 = 0 AND IN13 = 0 THEN
DEBUG "1 "
ELSEIF OUT9 = 0 AND IN14 = 0 THEN
DEBUG "0 "
ELSEIF OUT9 = 0 AND IN15 = 0 THEN
DEBUG "<____ "
ENDIF

PAUSE 500

GOTO main

Comments

  • dandreaedandreae Posts: 1,375
    edited 2007-09-26 22:45
    What are you using for a power supply?· The BS2px does run warm, if you can't leave your finger on it longer than 5 seconds, then you most likely have a problem.



    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • AvManAvMan Posts: 7
    edited 2007-09-26 23:17
    I am using a 9V power supply from the wall outlet. I would say that I can leave my finger on the chip, however it’s not necessarily comfortable. It’s the difference between hot and warm. I have compared the touch temperature to other programs and the keypad scanning program always runs noticeably hotter than the other programs. Enough to cause concern at least......
  • Mike GreenMike Green Posts: 23,101
    edited 2007-09-27 00:35
    9V is higher than necessary and all the extra has to get dissipated as heat. The BS2px, like all the other Stamps, runs at 5V and the Stamp uses a low dropout regulator which will run nicely at less than 6V. If you want a little more "head-room", use a 7.5V "wall-wart" like the ones Parallax sells. Your stuff will run a lot cooler.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2007-09-27 04:45
    AvMan,

    I believe Mike is correct... I don't see anything wrong with your code, other than from a safety precaution aspect. What happens if someone presses multiple keys that aren't on the same row?

    A couple of suggestions...

    1) you could remove this section of code below, because the default settings (LOW and INPUT) will work to your advantage.
     ' Rows
    OUTPUT 5 ' pad pin 1
    OUTPUT 6 ' pad pin 2
    OUTPUT 7 ' pad pin 3
    OUTPUT 8 ' pad pin 4
    OUTPUT 9 ' pad pin 5
    
    



    2) Modify your row checks so that they read like this... (Note: only one section shown)
     ' Scan Row 1
    
    OUTPUT 5     'Make Pin 5 an OUTPUT (default will be LOW)
    
    IF IN11 = 0 THEN
        DEBUG "F3 "
    ELSEIF IN12 = 0 THEN
        DEBUG "F2 "
    ELSEIF IN13 = 0 THEN
        DEBUG "F1 "
    ELSEIF IN14 = 0 THEN
        DEBUG "F0 "
    ELSEIF IN15 = 0 THEN
        DEBUG "Space "
    ENDIF
    
    INPUT 5     'Return Pin 5 to an INPUT when we are done scanning
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • GadgetmanGadgetman Posts: 2,436
    edited 2007-09-27 10:35
    Do I read it right when I understand that the switches are connected directly between I/O-pins?
    (you set one pin to '0', and read out which corresponding pin also drops to '0')

    If so, I'd suggest sticking a resistor on the lines from the 'row' Pins, to limit the current that can flow.
    You know, just to be safe...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-09-27 14:10
    There are typically two sets of resistors employed on a matrix keypad…the pull-down resistors on the rows and the in-line resistors on the columns. Do you have these resistors in place?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • AvManAvMan Posts: 7
    edited 2007-09-28 01:35
    As of right now, I am using a membrane keypad. I measured the DC resistance between two connected pins to be about 47 ohms. I may change to a different keypad in the future if this one turns out not to be robust enough. Below are a couple of links about the keypad:

    Scroll down to “Experimenter's Keypad: Part No.: ACS1048”
    http://www.oopic.com/objapp1.htm

    http://www.douglasstreetfineart.com/pdf/acs1048.pdf

    I appreciate everyones help. The chip still runs hot but I guess I will monitor the condition and let you know if there are any major problems.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-09-28 14:46
    It sounds as though you don’t have any resistors…I would seriously consider adding those. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Sutton MurraySutton Murray Posts: 88
    edited 2007-09-29 09:17
    What about showing your schematics. I am sure the problem will quickly be resolved.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-29 10:11
    If your BasicStamp is getting hot, software code is likely to be the last place you should be looking. The top 4 pins left and right are most suspect. You may be providing power to the wrong side of the BasicStamp.

    Above all first consider this.
    Upon detecting heat, immediately shut down all power until you determine the source. Many times I've haven't been looking for a heat problem, but I've just been holding the BasicStamp as I turn it on.

    So now, I have one finger on the Stamp when I power up a new circuit. That prevents serious damage.

    You should check the polarity of your supply. The little voltage regulator can get so hot that it desolders and slides right off the Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • AvManAvMan Posts: 7
    edited 2007-10-01 03:46
    As far as resistors, I am using the “CONFIGPIN PULLUP” command. Additionally, the keypad I’m using has an internal DC resistance of 47ohms. I have hooked up the keypad directly to the USB version of the BOE. The program works fine now, it was just the heat that was concerning me.

    Really, if the BS2PX was getting hot while I was pressing down the keys, I would know what the problem was. But, the chip gets hot even when the keypad is not even hooked up. That’s why I thought it might be the program.
  • AvManAvMan Posts: 7
    edited 2007-10-01 04:16
  • AvManAvMan Posts: 7
    edited 2007-10-01 04:39
    ok, Lets try this one.. just copy it into your browser

    http://i156.photobucket.com/albums/t2/jagman_photo/2007_0930Misc0001.jpg
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-01 15:37
    No resistors...Definately should use them. I am actually surprised it works, sicne without the pull-downs the input lines could show inaccurate data.

    [noparse][[/noparse]Edit: Disregard...I see (looking again at your code) you're using the internal pull-ups instead, but inline resistors on the outputs are still a good idea.]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-10-01 15:50
    From the photo, I see you are not going directly to the usual·BasicStamp interface, but using the 20pin utility interface.

    Since that has +5volts regulated, V unregulated, ·and ground supply in somewhat odd places as well as I/O, you may have gotten mixed up on your wiring. It looks like the Vin might be involved.
    It is much safer to used the clearly labled pins along side the BasicStamp's tiny breadboard and you can use shorter wires.· They are separated from the power pins along the top edge.

    Listen to Chris...
    ·47 ohms is TOO low for the BasicStamp, you need a recommended·total of 220 ohms minimum to reduce the load on an pin to a safe margin.·

    At roughly a 20 -25 ma·current limit per pin to avoid damage, you may already be in the weeds.·

    5volt/.025amps [noparse][[/noparse]25 millamps]·= 200 ohms·
    VERSUS 5volt/47 ohms·= 106 sizzling ma per pin.

    It would be even better to use 1k· or 2k ohms as the Stamp really doesn't need to drive all that much current to get information.· Why run down your battery for nothing extra?

    Pullups and pulldowns are not really important to these estimates.· You are looping +5 out of one pin and into another.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 10/1/2007 4:13:07 PM GMT
Sign In or Register to comment.