bizarre Digispark /Attiny85 input Voltage Levels! Help?

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am using a Digispark, or probably a china-copy scince Pin5 is an Reset.

I am trying to make a rotary encoder work on Pin1 1 and Pin4.(LCD in i2c on Pin0 and 2 )

I noticed that despite a 4.7k pullup resister the voltage is only around 2V if the Pin is configured as input.sad(with or without pullup doesnt matter)

If i configure the pin as output i am getting 0 and 5V levels though.

I got everything working using 2k pullups giving me 2.8V levels which is sufficient.laugh

But I dont understand why the Voltage is so low. Is this normal and maybe linked to the onboard USB? 

Or is there some configuration problem? What is a good value for the pullup?

Moreover Pin3 produces a reset also. WTF?surprise

 

Thanks for any help.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

blubbersprudel wrote:
I noticed that despite a 4.7k pullup resister the voltage is only around 2V if the Pin is configured as input

What pin are your talking about, or is this both pins?

 

Let me backup and say Welcome to AVRFreaks.

 

The tiny85 is a wonderful chip but has a limited number of io pins, so looking at what I think is the digispark schematic I see only three out of the five io pins that are free to use, and one of those has an LED on it, so is best to use it as an output (pin 2 on the connector), with 1 and 3 that are free to use.  The others are used for USB comms, and one is the reset pin.

 

Can you post a picture of your setup, use the icon that looks like a picture with a mountain on it to post in line rather then as an attachment.

 

Jim

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

thanks for the reply.

Since i dont have a breadboard a picture wont show u much laugh

I need pin 0 and 2 for I2C so I use 1 and 3 for input.

Is it not possible to use the pins associated with USB if u are not loading but just running your program?

 

Thx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

blubbersprudel wrote:
Since i dont have a breadboard a picture wont show u much

Eh??

 

We don't know what you have - post a picture so that we can see what you have, and how you have it set up.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


blubbersprudel wrote:
I need pin 0 and 2 for I2C so I use 1 and 3 for input.

The schematic shows jp3 having pins 1-6, so lets start by using the same pin number scheme....   ok, looks like your referring to port bit # and not the connector jp3 numbering...

With limited port pins, you will have to be careful with and understand how each pin is used, and see what pins can be shared with other uses.

Is there some reason you choose the T85 for this app, and not another that would have more port pins available?

I assume you load your app via a bootloader using the USB port, is that correct? 

Still a picture of the set up and even a description of what type of app your making would help us to under stand your needs better.

Jim

 

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

blubbersprudel wrote:
Moreover Pin3 produces a reset also

Again what pin 3 are you talking about, PORTB3, chip pin 3 or connector pin 3?

Are you running an Arduino sketch, or a bare chip program?

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

Last Edited: Thu. Nov 21, 2019 - 07:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am trying to make a rotary encoder work on Pin1 1 and Pin4.(

scince Pin5 is an Reset. 

 

 

Welcome to AVRFreaks.

 

Are you sure you have an ATTiny 85 ?

 

I assume you have an 8-pin package, (PDIP, SOIC, or TSSOP, and not the 20-pin QNF or MLF package).

 

Pin 1 is the Reset\ pin, not pin 5.

 

Pin 5 could be connected to a push button switch, or whatever else, but it isn't the Reset\ pin.

 

Next, as a general rule, you ought to reserve the Reset\ pin to be used only for the reset signal.

Do NOT try to use it as a general purpose I/O pin.

 

I don't use the T85, but for most AVR's in order to use the Reset\ pin for other than the reset signal one has to set a "Fuse", (internal register), to reconfigure the pin for use as general purpose I/O.

AND, once that is done, it no longer works as a Resest\ pin, which can make it very difficult to re-program the chip if your program doesn't work perfectly the first time!

 

So, as a general rule, unless you have a lot of AVR experience, and you are mass-producing many, many boards, and the cost differential between the T85 and a micro with more I/O pins truly makes a difference, just select a micro with more pins to start with rather than use the Reset\ pin as a general purpose I/O pin.

Your life will be much better with fewer hassles!

 

JC

 

Edit:

Cross post with Jim, above.

Again, a photo of your board / setup, and a schematic, by the OP of what he is actually using, would be helpful.

 

My comments above assumed the Pin number comments referred to the pins on the micro itself, not on any headers.

Last Edited: Thu. Nov 21, 2019 - 07:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again,

I am verry sorry. I did mix up pins and ports. I have always been speaking of gpio ports (hece starting with 0 and reset on 5)

And below the picture of my setup, but as i told u is hard to see anything.

 

@ki0bk: thx for the scematic. it seems the Zehner Diodes D1 and D2 indeed limit the Voltage on these ports. But it should be 3.6V (which would be sufficient for a high signal) and not 2V.

As i told u the setup is working, I am just worried (and curious) about the small pullup resistors (2k2) necessary to attain at least 2.8V on PORTB2 and 5.

 

Thx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


blubbersprudel wrote:
But it should be 3.6V (which would be sufficient for a high signal) and not 2V.
That depends entirely on the strength of the signal driving it, and the characteristics of that particular zener.

 

Take for example the MMSZ4xxxT1G series.  The below chart is revealing:

 

 

This doesn't show the 3.6V variant, but look at the 2nd trace from the left.  That is for the 2.4V variant.  Note how when Iz is 1mA, Vz is only 2V.  When Iz is 0.1 mA, Vz drops even lower to about 1.4V.  Only at the rated Iz of 20 mA will Vz be the expected 2.4V.

 

The 3.6V variant likely exhibits a similar curve.  With a 4K7 pull-up to 5V, and working with your observed Vz of 2V, the current Iz will be only (5 - 2) / 4700 = 0.63 mA.  The digispark uses 66R5 resistors, so the expected Iz when USB is active is (5 - 3.6) / 66.5 = 21 mA.

 

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahhh, thanks a lot.

I Think that explains it!

Looks like i have to catch up on my knowledge on zener!

 

Thx