Go Down

Topic: Voltage Spikes on Digital Pin (Read 735 times) previous topic - next topic

Timbergetter

Dec 13, 2018, 12:03 am Last Edit: Dec 13, 2018, 12:23 am by Timbergetter Reason: add image
This is the first time that I have pointed an oscilloscope probe at a microprocessor (or anything else for that matter) so I am sure that I am missing some fundamental skills in this area.  I am playing around with an ATmega328P and have connected Digital Pin 5 to a bipolar transistor switch which in turn is driving a MOSFET switch.  The MOSFET switch is controlling power to an ultrasonic sensor and radio device.  I am probing levels on DP5 and the output of the MOSFET (Vout).  I am observing the DP5 output going high for about 1 second and then going low, all as intended by the sketch.  It is what's happening for about 1.5 seconds prior to DP5 going fully high that has me stumped.  You can see on the DSO trace that there is a succession of spikes uniformly spaced at 68 millisecond intervals ahead of DP5 going high.  While these spikes are occurring the MOSFET output (Vout) is ramping upward in a spikey manner and seemingly in sympathy with the DP5 activity to about 2.5 volts before switching on fully.  There is a 4.7k ohm pull-down resistor on DP5.

The sample on the DSO traces has a supply of 4.0 volts.  I get similar results for supply up to 5.0 volts.  Below 4.0 volts the device becomes unstable with the DP5 pin hanging in a high state after a few cycles of loop().  I have set the ATmega328P up with a 16 MHz oscillator and the normal compliment of capacitors.

Does anyone recognise a pattern in the DSO traces that could explain what is going on here?


Delta_G

Quote
Does anyone recognise a pattern in the DSO traces that could explain what is going on here?
I recognize that something is wrong with your project yes.  If you would like to know what that something might be, then ask someone who can see your wiring and your code.  This would have been a GREAT place to post it since there are lots of people here who could look at it for you.  Why you chose to hide the one piece of information that is most important to helping you is beyond me. 

Do you not want someone to help you figure this out?
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Timbergetter

Many thanks for your feedback.  In a way I am relieved by your comment that something is wrong with my project.  Being a novice in this area I was not certain that something was indeed wrong based on those traces.  I interpret from the remainder of your post that there could be many explanations for what is observed on the traces, which in itself is useful information for me if I am interpreting you correctly.

I certainly wasn't trying to hide information from anyone.  I thought that it might be expedient to filter out if there was a problem at all, or if the issue stuck out like the proverbials, before I swamp the thread with what could have been unnecessary detail.  Now that you have clarified that there is definitely a problem to be addressed here I will compile the additional information you have suggested, and post this.

Delta_G

Quote
I certainly wasn't trying to hide information from anyone.  I thought that it might be expedient to filter out if there was a problem at all, or if the issue stuck out like the proverbials, before I swamp the thread with what could have been unnecessary detail.
Why do people think this?  You're not the only one.  Why do people keep thinking this?  I can't imagine what thought process leads to you thinking that there was ANYTHING that ANYONE could do without knowing anything at all about what you are working with.

Do you think that extra details would stop people being able to answer you?  What harm are people thinking that actually telling the people you're asking for help what you have and how it works is going to cause?  Do you really think we go around saying, "I would answer that but this guy added an extra detail that I don't need."?


|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Timbergetter

Wow.  I've really stepped on a hornets nest here.  I am so sorry you have had such bad experiences with people not following strict protocol.  I don't think I'll now progress to stage 2 of my errant troubleshooting in view of the flare-up arising from stage 1.  At least you inadvertently answered my stage 1 question which sought to establish if I had a problem or not, and for that I thank you.


Delta_G

#5
Dec 13, 2018, 06:08 am Last Edit: Dec 13, 2018, 06:08 am by Delta_G
Wow.  I've really stepped on a hornets nest here.  I am so sorry you have had such bad experiences with people not following strict protocol.  I don't think I'll now progress to stage 2 of my errant troubleshooting in view of the flare-up arising from stage 1.  At least you inadvertently answered my stage 1 question which sought to establish if I had a problem or not, and for that I thank you.


No, I just wondered what you were thinking.  I can't seem to make sense of it and was hoping someone could enlighten me so I can understand people better. 

Are they just dumb?  Or is there a reason that they think we'll hang up on them if they give us details?  Or are they embarrassed by the work they've done and hoping they won't have to show it?  What is the reason why people do something so stupid? 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Smajdalf

@Delta_G: I try to avoid posting information from various reasons. I am ashamed for low quality code when it is in the "testing" phase. Also I doubt anyone will read 1000+ lines of code including 10 libraries "found somewhere on internet" with cryptic comments everywhere. So I try to remove as much unnecessary code as possible and add comments to make it clear. Similar goes for circuit - if I have a schematics it is hard to understand unless you remember what I meant when I draw it. I need to redraw it cleanly before presentation. And the physical circuit is similar mess, often on more than one breadboard, sometimes with other unrelated projects on other part of the breadboard ;-). There is no chance to track jumper wires from a photo.
Cleaning a project to be "worth presenting" takes a lot of work. While doing so, I often find the bug myself. But it is tempting to ask without showing anything, skipping all the boring work - maybe someone guesses the answer anyway.

@Timbergetter: Please, show what was causing this, I am curious. My guess is a SW bug.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

Delta_G

Quote
I am ashamed for low quality code when it is in the "testing" phase.
But you're here to ask about it.  Do you think it needs to be professional work with no bugs before you can ask for help?  That's ridiculous.

Quote
Also I doubt anyone will read 1000+ lines of code
You think a thousand lines is a lot of code.  That's cute. 


Still you could write a MCVE if you don't want to post the whole thing.  But at least give them something to work with. 


Quote
I need to redraw it cleanly before presentation.
If you're smart you draw cleanly before you start wiring.  That can save you TONS of time. 


Quote
And the physical circuit is similar mess
Yeah, don't post that.  Just draw a schematic. 


Quote
skipping all the boring work
And now we get the truth.  Lazy.  Yet you expect others to jump up and help you for free.  That's pretty despicable if you ask me.  To put the work on the volunteers. 


Quote
maybe someone guesses the answer anyway.
Or maybe you just waste someone else's time.  I mean why should you care, it's not like it is YOUR time right?  Who cares what you do to other people.  Screw them, right?  They're only offering free help to you, why should you pay them any respect. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Smajdalf

(...)
And now we get the truth.  Lazy.  Yet you expect others to jump up and help you for free.  That's pretty despicable if you ask me.  To put the work on the volunteers. 


Or maybe you just waste someone else's time.  I mean why should you care, it's not like it is YOUR time right?  Who cares what you do to other people.  Screw them, right?  They're only offering free help to you, why should you pay them any respect. 
You will never understand it when you don't want to understand it. I don't want to waste others time. THIS is the reason I do NOT post a poor code with tons of irrelevant stuff. And yes, I think 1000 lines of code written by someone else with no or cryptic comments is a lot - I rarely read such code because I consider it waste of my time. I don't expect others would read my code if presented in such way. The same is true for schematics - I can read my handwriting well. I don't expect it will be easy for you to read and follow my quickly sketched schematics. If I do it for others I try to do it nicely and precisely and often need more than one iteration.

I think many people feel it the same way. They try to provide information that they believe is important and avoid irrelevant stuff. If you think not enough information was provided you may ask - or ignore the thread at all. I don't see how not providing (possibly boring or misleading information) forces other to help me.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

Delta_G

And of course there's always the MCVE.  If you really just don't want to post your code, then write up something short that exhibits the problem.  At least then you can ask people to help with a problem that they can see instead of asking them to help with something hidden. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Delta_G

#10
Dec 14, 2018, 02:02 am Last Edit: Dec 14, 2018, 02:04 am by Delta_G
You will never understand it when you don't want to understand it. I don't want to waste others time. THIS is the reason I do NOT post a poor code with tons of irrelevant stuff. And yes, I think 1000 lines of code written by someone else with no or cryptic comments is a lot - I rarely read such code because I consider it waste of my time. I don't expect others would read my code if presented in such way. The same is true for schematics - I can read my handwriting well. I don't expect it will be easy for you to read and follow my quickly sketched schematics. If I do it for others I try to do it nicely and precisely and often need more than one iteration.

I think many people feel it the same way. They try to provide information that they believe is important and avoid irrelevant stuff. If you think not enough information was provided you may ask - or ignore the thread at all. I don't see how not providing (possibly boring or misleading information) forces other to help me.
I have just one question then.  How will the person you are asking for help from know what you've done wrong or how to fix it.  Let's say the code is just so long you just can't bring yourself to post it.  Let's say you're right and you shouldn't.  Now describe to me how someone would be able to help at all in that situation.  Tell me how they could do that. 

I get your reasoning there.  Now describe to me what the person on the other end does with that.  How will they help you?  What do you think they can do?  What do you want them to do?
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Go Up