Notifications
Clear all

Arduino Nano problem using A6 and A7

13 Posts
3 Users
0 Likes
1,658 Views
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

I have an Arduino Nano question. I can't get A6 and A7 to function as digital outputs in my 'Simon' project. Do I need something special to get these ports to work?

Most of the Analog pins run two digits of common anode seven segment displays (green). I am using the SevSeg.h library to initialize the pins as outputs and drive the two displays. Most elements work, but not segment D and E. The common anodes go to D7 and D8 and are a problem also. The A6 goes to segments 'E' cathode and A7 goes to segments 'D' cathode. I have tested A6 and A7 with a digitalWrite(20,LOW) and digitalWrite(21,LOW) followed by digitalWrite(7,HIGH) to fire two segments on the ones digit, but no action on segments E and D lights. I even added a pinMode command to pins 20 and 21 as outputs, but still no lights on the seven segments.

Also, only one digit lights either tens or ones, never both. They alternate each 'level update' lighting tens on one loop then ones on the next loop.

330 ohms to each segment pair (eight resistors including DP)
200 ohms to each of 4 simon leds
internal 30K pullup on 4 simon switches

Nano unused pins D0, D1, D13.

I have produced a PCB for this already too.

Any tips or help on this project would be appreciated.


   
Quote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @rvbarrett

I have an Arduino Nano question. I can't get A6 and A7 to function as digital outputs in my 'Simon' project. Do I need something special to get these ports to work?

I think that you'll find that A6 and A7 are input only. You'll have to swap them for a couple of inputs and use the other pins for output.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

not good news, but thanks Will. 

At least there are pins that can be used.  Now it will be a test of my ability to re-wire the schematic and solder a few jumper wires on the PCB.   


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@rvbarrett 

It's been years since I went through this, but here's more info

https://forum.arduino.cc/t/solved-can-pins-a6-and-a7-be-used-as-outputs-on-the-nano/656871

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @rvbarrett

At least there are pins that can be used.  Now it will be a test of my ability to re-wire the schematic and solder a few jumper wires on the PCB.   

I don't think you'll find rearranging the schematic too hard (although rerouting the PCB may be a pig).

As for the existing board, just use a screwdriver to gouge out enough of the traces to the 4 pins you need to swap and solder the jumper from the NANO pins to the new PCB points.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

Thanks,  re-wired done, but not yet documented in the schematic.  

now that the seven individual segments light how do light both digits? 

Next issue is that only one of the two seven segments lights at one time.  Either tens digit or ones digit.  


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@rvbarrett 

Generally, unless you're using a driver, you'll need to use 8 pins for the LED segments (7 if you're not using the decimal point) and one pin for each digit.

It would be hard to tell you what's wrong unless we can see the wiring diagram and possibly your sketch (assuming there's nothing wrong with the wiring).

I think you need to make about 10 posts or so before you're allowed to add attachments (such as a wiring diagram) so your first attempt(s) may not work too well.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

From my software experiments on the re-wired seven segments I have come to the conclusion that I will need to add a Timer Interrupt Service Routine that runs a single command.  

Display.refreshDisplay(); 

I think that a frequency of about 20 Hz should do the trick.  

Thanks again for the encouragement and assistance Mr. Will.

PS It takes 5 posts to get the attachment block lifted. 😎 

Simon PCB03

 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1680
 

Hi @rvbarrett ,

  I have only glanced at this discussion, and I don't know what your software is doing, so please treat this as a friendly suggestion to check, not a definitive statement. If I have made a mistake or misunderstanding .. apologies.

For maximum brightness, my understanding is that is 'usual' to drive all the required cathodes for a given digit at the same time, using the anode drive to select (and power) the required digit.

(In theory the software could drive only one cathode at a time, and hence 7 time slots would be needed to power each digit - this would severely limit the brightness and I haven't seen it suggested.)

Thus, to show an '8', all 7 of the cathodes will be driven low, and the anode of the selected digit high.

This means the total anode current is 7 times the individual segment cathode current.

With 330 Ohm cathode resistors, I guess the current for each cathode will be about 8-10mA.

Assuming it's 10mA per cathode, then the anode current will be 70mA.

A quick glance at the microcontroller data sheet, suggested maximum current per pin is 40mA.

This suggests you might be asking it to pass nearly double the maximum rating .. it may well withstand it for a while, but it suggests premature failure is likely, and the anode drive voltage may be lower than you expect.

If my concerns are justified, I would recommend using a single transistor circuit to amplify each anode drive.

Best wishes, Dave


   
ReplyQuote
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

thanks @davee  

I had not looked at that current, thanks for your concern.  

Not running at full brightness, I am getting 1.20 volts across each 330 ohm resistor for a current of 3.6mA each segment.  Times 7 segments give 25.5mA for each display's anode.  Shouldn't be a problem. 


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1680
 

Hi @rvbarrett,

  If current is actually 3.6mA/segment, then not a problem as you say.

If you used a multimeter, I presume you made sure the segment was on 100% of the time and you weren't getting an 'average' reading of on and off. (Sorry, if this is obvious to you.)

A quick look at a seven segment data sheet suggests LED voltage drop of about 2.4V, so that suggests 1.4V total drop from the microcontroller outputs ... more than I expected, but probably still within spec.

Best wishes for your project and apologies for any misguidance. Dave


   
ReplyQuote
RVBarrett
(@rvbarrett)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

Thanks @davee for more important points I had overlooked.  

The 1.2 volt drop was at a 50% duty cycle of normal operation of the LED segments.  When in a static test mode the drop across the 330 ohm resistors was 2.8 volts giving more like 8.5mA per segment.  Times 7 segments gives nearly 60mA of instantaneous current to light all elements.  Clearly too much current for a Nano pin.  

From this I assume that I undervalued the seven segment resistors and should increase them to over 500 ohms to get the current under 40mA on each anode.  


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1680
 

Hi @rvbarrett,

   In that case, adjusting the resistors would be one course of action.

   The alternate, which might be preferable to maintain brightness, could be to use add a transistor .. as an example see  ..

https://embedded-lab.com/blog/lab-11-multiplexing-seven-segment-led-displays/

which shows the addition of a pnp transistor and associated base resistor for each anode drive.

I would expect almost any 'general purpose' small pnp transistor capable of at least 100 mA collector current would do. (Maybe look at the datasheet for BC557 suggested, as a rough guide to general characteristics.)

Note, you will need a 'trivial but vital' software change, as the high/low drive to the anodes needs to be reversed since a low from the microcontroller, will turn the transistor on (and vice versa).

Best wishes, Dave


   
ReplyQuote