Arduino Forum

Using Arduino => General Electronics => Topic started by: jakub014 on Mar 12, 2016, 09:53 pm

Title: Amperage too high? (solved)
Post by: jakub014 on Mar 12, 2016, 09:53 pm
Hey,
currently I'm working with my arduino uno on an 6x7 LED table for school. I use I2C port expanders(mcp23017) to control these RGB LEDs. (You can find a draft of my circuit diagram at the attachments or here: http://i.imgur.com/PgKxKyM.png) As you can see the circuit is parallel, so the amperage increases. My question would be how high would the amperage go and what can I do prevent my arduino from getting destroyed?
Some additional information:
Arduino Uno output U:5V I:20mA
RGB LED: Red: max. U:2V at 20mA
             Blue, Green max. U:3V at 20mA

Thanks for your answers in advance.
Jakub
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 12, 2016, 10:37 pm
Quote
As you can see the circuit is .....
Complete wrong.

(http://forum.arduino.cc/index.php?action=dlattach;topic=385992.0;attach=158740)

You need one resistor with each LED colour. That is like you have in the red only on the blue and green as well. Also loose the resistor the other side ( common connection ) of the LED. If you have 42 RGB LEDs then you will need 42 * 3 = 126 resistors.

So with a proper circuit you would draw 20mA per LED colour to give you 43 * 3 * 20 = 2520mA or 2.52 Amps. This is way way more that an Arduino 5V line can supply.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 12, 2016, 11:00 pm

Thanks for your answer.

This is way way more that an Arduino 5V line can supply.
Is there a solution to this problem?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 12, 2016, 11:03 pm
Quote
Is there a solution to this problem?
Yes use an external power supply.

By the way what is the Arduino doing here, just acting as a power supply?
Title: Re: Amperage too high?
Post by: jakub014 on Mar 12, 2016, 11:06 pm
I use the Arduino to toggle the LEDs off and on. Is something wrong with it?
Moreover my teacher told me to inform about transistors, are they a possible solution as well?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 13, 2016, 02:46 am
Quote
I use the Arduino to toggle the LEDs off and on.
That was not shown on the schematic you just had the LEDs going to a battery. Can you draw a schematic of what you actually have or want.

An Arduino output pin should not be asked to drive more than 40mA, and there is a total chip limit as well of 200mA for all the outputs added together. Further more there are group limits on ports.

Once we find out what you actually want to do we can talk about soloutions but at the moment this is a X-Y Problem (http://xyproblem.info/)
Title: Re: Amperage too high?
Post by: JimboZA on Mar 13, 2016, 05:50 am
transistors, are they a possible solution as well?
Like this (http://www.ecs.umass.edu/ece/m5/tutorials/multiple_LEDs_tutorial.html)?

Title: Re: Amperage too high?
Post by: jakub014 on Mar 13, 2016, 11:44 am
That was not shown on the schematic you just had the LEDs going to a battery. Can you draw a schematic of what you actually have or want.
Im apologizing for my vague question. You can find a more detailed version of the circuit at the attachments. This schematic shows only 1 port expander, in reality it should have 8.
Like this (http://www.ecs.umass.edu/ece/m5/tutorials/multiple_LEDs_tutorial.html)?
So in my case I would need an external power supply and 126 transistors(to toggle each color of the leds), or am I thinking wrong?
I also was thinking about what kind of power supply do I need and how do I connect the LEDs with it?

Besides, thank you for helping me.

Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 13, 2016, 12:21 pm
If you are using port expanders and only driving one colour LED from each of the port expanders that would be fine. The 5V would be supplied from an external power supply with the ground connected to the Arduino ground.

These days I would advise using Neopixel LEDs either as a strip or as individual 5mm LEDs. It is way the simplest solution.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 13, 2016, 01:12 pm
Im sorry if this is a dumb question but do I need something like this: https://www.antratek.de/usb-adapter-5v-2a?gclid=COjfvKbIvcsCFQhuGwod7r0DLw
And if I need this one, how do I connect it to my circuit?
Im wondering also why RGB LEDs and common LEDs make a difference in this circuit?
Title: Re: Amperage too high?
Post by: sterretje on Mar 13, 2016, 04:34 pm
There is no difference; in principle each LED needs a resistor. In an RGB LED you have three LEDs so you need three resistors.

With a single LED, it does not matter if the resistor is connected to the anode or the cathode (although there might be design considerations to use one over the other).
Because a RGB LED has one common pin, you can not connect the three resistors to that pin (as they will be shared between all LEDS) so you have to connect the resistors to the other three pins.
Title: Re: Amperage too high?
Post by: MarkT on Mar 13, 2016, 05:56 pm
Each LED either needs a constant current drive, or a resistor.  Some LED driver chips do constant
current drive and resistors would not be needed.
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 13, 2016, 06:56 pm
Quote
but do I need something like this: https://www.antratek.de/usb-adapter-5v-2a?gclid=COjfvKbIvcsCFQhuGwod7r0DLw
Yes.

Quote
And if I need this one, how do I connect it to my circuit?
Connect the ground to the Arduino ground and the +5V to the +5V power supply of your port expanders.
Title: Re: Amperage too high
Post by: jakub014 on Mar 13, 2016, 08:18 pm
Thanks for your answers

Im sorry to bother you even more, but now I got 3 (hopefully final) questions:

Connect the ground to the Arduino ground and the +5V to the +5V power supply of your port expanders.
1. If I do so, I don't need transistors, right?

2. What kind of port do I need for this power supply and with what kind of port can i connect it to my circuit.

3. Is it possible to supply my arduino with it as well?

4. Would the external supply deliver 2.5A to each expander(Im not sure if the expander can handle this) and would this circuit be parallel as well?(else, how would it look like?)
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 13, 2016, 09:14 pm
Quote
1. If I do so, I don't need transistors, right?
If you go with that last schematic with 8 port expander chips then no need for extra transistors.

Quote
2. What kind of port do I need for this power supply
I have no idea what you mean by this.

Quote
3. Is it possible to supply my arduino with it as well?
Yes.

Quote
Would the external supply deliver 2.5A to each expander
No, the total current it can supply would be 2.5A and that includes your Arduino.

Quote
and would this circuit be parallel as well?
I am not sure what you mean but I guess no.

You do know you will only be able to get 7 colours from those RGB LEDs with that circuit don't you?
Title: Re: Amperage too high?
Post by: Gerry48 on Mar 13, 2016, 10:17 pm
How much current dose the MCP23017 supply?  I don't think is will source or sink 20 mA.  You need an additional buffer like ULN2803A connected to MCP23017.

There's also common anode and common cathode rbg leds.  I would go with common anode.

Title: Re: Amperage too high?
Post by: jakub014 on Mar 13, 2016, 10:35 pm
@Grumpy_Mike
I have no idea what you mean by this.
I have literally no idea which parts I need to connect an appropriate adapter with my circuit. (I mean what kind of cables, ports if possible with links)
Also Im kinda confused of the circuit of the external power supply, I made a raw version of what Im thinking about :
(http://i.imgur.com/Efzwq1d.png)

You do know you will only be able to get 7 colours from those RGB LEDs with that circuit don't you?
Yup, I do.
@Gerry48
How much current dose the MCP23017 supply?
all combined outputs of one MCP23017 cannot exceed 150mA sink current and
one port can sorce or sink a max of 25ma
the MCP23017 has 16 Ports

btw I can't thank you all enough for helping me.

Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 13, 2016, 11:25 pm
You need to either cutoff the end of the USB connector and wire up the + and -, or you need to get a USB socket to plug it into and wire it up that way.

Or get an external 5V supply with wire ends as the output.
Title: Re: Amperage too high?
Post by: Gerry48 on Mar 14, 2016, 12:50 am
Vdd = 150 ma, that absolute maximum.  I'm assuming you want to connect 5 rgb leds to the port extender.  That means each port must get less than:

I_port = 150 mA / 15 = 9.4 mA  (this assumes all leds can be on at the same time)

If only one of the 3 leds per package is on at a time then:

I_port = 150 mA / 5 = 30 mA

The leds need about 20 mA each.  That means the MCP23017 will work without an additional driver if you limit active leds to 5 per port extender.  You also need common anode grb leds.  Do not get common cathode leds. 

Connect the anode lead of all 5 led packages together.  That connection goes to +5V of your external power supply.  Each red cathode lead connects to a 150 ohm resistor.  Each blue and green cathode lead connects to a 91 ohm resistor.  The other end of the resistors goes to a separate expander port.  The ground of the external power supply goes to MCP23017 ground.  The resistor is sized to provide 20 mA to each led.

Just to be clear, each MCP23017 should not have more than 5 leds on at a time.  You don't want to get close to the absolute max rating of 150 mA.







@Gerry48all combined outputs of one MCP23017 cannot exceed 150mA sink current and
one port can sorce or sink a max of 25ma
the MCP23017 has 16 Ports


Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 14, 2016, 04:39 pm
How much current dose the MCP23017 supply?  I don't think is will source or sink 20 mA.  You need an additional buffer like ULN2803A connected to MCP23017.
There is no need for this. If you look at the schematic the OP posted you will see he is running the LEDs at nothing like 20mA. With a 330R current limiting resistor the the red LED is drawing 9mA and the green and blue 6mA each. So that is 15mA per RGB LED. So for 5 RGB LEDs on one port it is only supplying 75mA. No need for any extra buffering.

Quote
There's also common anode and common cathode rbg leds.  I would go with common anode.
Totally irrelevant, you can source or sink current with the MCP23017. In fact a mixture of sourcing and sinking would allow the LEDs to be driven at a higher current without exceeding the absolute limits on the chip.

Quote
Just to be clear, each MCP23017 should not have more than 5 leds on at a time.
Rubbish, you haven't looked at the OP's actual circuit, all the LEDs can be on at once if he uses the resistors in his own schematic.

Quote
The leds need about 20 mA each.
No they don't. The 20mA current is the maximum they should be allowed to take not what they need.
Title: Re: Amperage too high?
Post by: Gerry48 on Mar 14, 2016, 07:00 pm
Quote
Rubbish, you haven't looked at the OP's actual circuit, all the LEDs can be on at once if he uses the resistors in his own schematic.
Take it easy there Grumpy.  I've seen the circuit.  You can't assume anything is correct.  This is the datasheet of your typical rgb led.

http://cdn.sparkfun.com/datasheets/Components/LED/YSL-R596AR3G4B5C-C10.pdf (http://cdn.sparkfun.com/datasheets/Components/LED/YSL-R596AR3G4B5C-C10.pdf)

Typical current is 20 mA.  Typical voltage drop is 2.0V for red and 3.2V for green and blue.

And if you had looked at the MCP23017 datasheet you would have seen absolute maximum source current is 125 mA while sink current is 150 mA.  In general, circuits can sink more current than they can source.  That's why it's better to use common anode leds.

No rubbish here.  The OP wanted to use a 330 ohm resistor.  According to the datasheet 90 ohms is in order.  Unless it's a very dark room, the leds won't be visible.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 14, 2016, 07:35 pm
@Grumpy_Mike I'm very grateful for clarifying these issues.

I hope these will be my last questions:

1. Im still not 100% sure about how to connect the power supply with my circuit and wanted to ask wether the following rough draft with only 2 Expanders of what Im thinking is right or wrong:
(http://i.imgur.com/G3rm8kk.png)
2. Do I need a 5V 2.5A adapter or less ampere because:
With a 330R current limiting resistor the the red LED is drawing 9mA and the green and blue 6mA each. So that is 21mA per RGB LED. So for 5 RGB LEDs on one port it is only supplying 105mA.
3. If I connect an adapter via USB with this: https://www.flikto.de/products/usb-type-a-female-breakout
(I hope it's a suitable part) Then how do I connect my arduino with it?(what kind of wire/port or component do I need to buy)
@Gerry48 I already have RGB LEDs with a common cathode, but they work fine with 330ohm resistors
(https://img2.brain4.photobox.com/3385764382e7cf35539515004f7d8ccb600a443be4f0658f63d8f8b3b43540a92d8d67d3.jpg)
Thanks for helping me once more
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 14, 2016, 07:42 pm
Quote
Unless it's a very dark room, the leds won't be visible.
Ah I see you specialise in crap then. That is even a bigger load of rubbish than your previous post. We have standards of advice here and your advise drops well below what is expected.
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 14, 2016, 07:46 pm
1) very wrong. The negative of the external power supply must be connected to ground. All the reset lines should be connected together and toggled with an output pin.

2) it does no harm having a power supply that is capable of more current than you need. It is often a good idea to to run them at only 80% full capacity.

3) connect the Arduino power via e 5V line on the Arduino.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 14, 2016, 08:07 pm
Thanks again,

just to be sure, is this circuit right?
(http://i.imgur.com/moWZEvE.png)

and im really really sorry for bothering you with such foolish questions but I still did not understand how to supply my arduino. I mean you have these arduino ports:
(http://gammon.com.au/images/ArduinoUno_R3_Pinouts.png)
and as far as I understood I just need a usual wire going to which port? Or am I completely wrong?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 14, 2016, 09:33 pm
You have to draw that schematic better. It looks like A0 is connected to Vcc and that the plus of the battery is connected to the plus of the Arduino. So it needs to me cleare what is connected to what.
To supply your Arduino with an external supply connect the gnd to the supply negative and the 5V regulated supply positVe to the 5V pin.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 14, 2016, 10:28 pm
You have to draw that schematic better.
I hope this is better:
(http://s16.postimg.org/uykzts711/circuit_5.png)
The red marked wires are + blue -
The expander pins A0,A1,A2 define the I2C adress, otherwise I could give them input with another 5V supply from the arduino (if thats possible)
And just to be 100% sure to connect the supply to the right arduino port, you mean this one:
(http://s10.postimg.org/xbusok1m1/arduino.png)

Edit: Im still wondering if 2.5A is ok for my project because: 1 LED 21mA
42*21mA=0.882A     0.882A+Arduino current is still about 1 A I think, so does it matter that I have like 1.5A too much or do I need that much current?
it does no harm having a power supply that is capable of more current than you need. It is often a good idea to to run them at only 80% full capacity.
in my case it would be like 40% of full capacity is that ok?


Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 15, 2016, 09:17 pm
The only thing missing from that diagram now is the 0.1uF ceramic capacitor between the Vdd and Vss pins on each expander chip, and the missing 4K7 resistors pulling up the I2C lines.

Quote
in my case it would be like 40% of full capacity is that ok?
Even better.

Quote
And just to be 100% sure to connect the supply to the right arduino port, you mean this one:
Yes.
I would disconnect the external circuit and the external power supply when you are uploading code and then reconnect it when you have removed the USB connection.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 15, 2016, 09:34 pm
The only thing missing from that diagram now is the 0.1uF ceramic capacitor between the Vdd and Vss pins on each expander chip, and the missing 4K7 resistors pulling up the I2C lines.
Im a bit confused now, can you explain me what these components do? Furthermore:
0.1uF ceramic capacitor between the Vdd and Vss pins on each expander chip
what do you mean with between, I was thinking there are 2 different wires, should I connect them with these Capacitors?

Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 15, 2016, 09:48 pm
Quote
what do you mean with between,
One end of the capacitor to the Vdd and the other end of the capacitor to Vss. It is decoupling and is not an option it is essential. See:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html (http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html)

Quote
can you explain me what these components do?
I2C works by the chips pulling down the signal wires. The resistors pull up the line when no chips are pulling them down. The Arduino does enable the internal pull up resistors on these two lines but they are no where close to being low enough. Without them the signals are severely degraded. Again this is not an option but a must do. See:-
http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors (http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors)
Title: Re: Amperage too high?
Post by: jakub014 on Mar 16, 2016, 05:55 pm
Thank you so much for your advice,

as far as I understood, I need 2 4k7 ohm resistors at the beginning of the SDA and SCL line and 8 0.1uF ceramic capacitor, right?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 16, 2016, 06:12 pm
Right. The resistors can be fitted anywhere, from the signal line to +5V, the position doesn't matter.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 16, 2016, 07:27 pm
I've got 2 questions left:

can I use the capacitors in a breadboard like this (imagine the resistor would be a capacitor):
(http://s27.postimg.org/v864si6mr/20160316_185846.jpg)
Do I have to care about the rating of a capacitor, because this (https://www.sparkfun.com/products/8375) one has  a rating of 50V

and I would use this (https://www.flikto.de/products/usb-type-a-female-breakout) to connect my adapter with the circuit. But Im wondering what is + and - there, and can I just put the - straight into the ground of this component?
A little question I have as well is wether I need adjust my arduino for the power supply at the 5V pin.
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 17, 2016, 04:36 am
Yes you can put components directly into the bread board like that. For the capacitor cut the leads short.

Yes you could use that board if you get a lead that delivers power like that. I think normally it is the type B that receives power not the type A

No preparation is needed to drive the Arduino with the +5V line.
Title: Re: Amperage too high?
Post by: raschemmel on Mar 17, 2016, 03:34 pm
@jakub014,
Why are you doing this ? Is this a school project ?
Based on the schematics you posted and the questions you asked, you have little experience with electronics. Are you a hobbyist or electronics student ?
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 05:32 pm
@raschemmel Unfortunately my IT teachers came up with the idea to make an arduino project over some months. We barely had any experience about electronic and arduino at the beginning. Additionally our teachers just gave us 2 lessons about electronics and 8 about arduino basics in general. So, Im apologizing for beeing such a difficult case, I thought it would be easier to control some LEDs.

@Grumpy_Mike  
I think normally it is the type B that receives power not the type A
Is that a problem? If yes, would you recommend me a board that fits in my project? (perhaps from here (https://www.flikto.de/search?q=usb+board), cause Im ordering most of the things there.)
Title: Re: Amperage too high?
Post by: raschemmel on Mar 17, 2016, 06:01 pm
USB-A is the flat one that plugs in a computer.
USB-B is the other end that plugs in a printer (or an arduino).
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 07:28 pm
So I could use for example this one (https://www.flikto.de/products/breakout-board-for-usb-microb)?
Title: Re: Amperage too high?
Post by: raschemmel on Mar 17, 2016, 07:49 pm
That adaptor would have to be the 5V source, because the other end would plug into the arduino and provide 5V to the arduino.

Is that what you are asking ?
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 08:15 pm
Is that what you are asking ?
Yes kind of, I meant wether this component would be fitting or not, but I think your answer expects this already, so my question would be solved.
Im still wondering what the ports of this board (VCC, GND, ID, D- and D+) are or which of them I need.
the board (https://www.flikto.de/products/breakout-board-for-usb-microb)
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 17, 2016, 08:46 pm
Quote
Im still wondering what the ports of this board (VCC, GND, ID, D- and D+) are or which of them I need
You need just VCC, and  GND to power your system.

I would advise against that micro connector. In my experience with the Raspberry Pi, these coupled with the lead often have a high resistance. As you are driving a high-ish current through them this can lead to an unacceptable voltage loss. Best go for the full size connectors.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 08:52 pm
So you would recommend me this one (https://www.flikto.de/products/usb-type-a-female-breakout) or none of them?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 17, 2016, 08:55 pm
No. Look at the USB socket that is on your Arduino. Use that type.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 09:12 pm
Ok I got 2 final questions:
1. I dont find any full size USB B breakouts, just micro or mini....
2. Im not sure what 0.1uF cermaic capacitor I need because they have always high voltage data. Can you show me one, which is suitable for this project?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 17, 2016, 11:00 pm
Quote
I dont find any full size USB B breakouts, just micro or mini....
Then get yourself either a raw socket OR a power supply with wire ends.

Quote
Im not sure what 0.1uF cermaic capacitor I need because they have always high voltage data.
The voltage is unimportant. But it has to be a ceramic capacitor.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 17, 2016, 11:10 pm
Then get yourself either a raw socket OR a power supply with wire ends.
I already got a power supply with a USB port, so Id prefer not to buy another one.
What is a raw socket and can I buy it? Otherwise I'd try to use the breakout you advised against because of its possible resistance. If I get a lower voltage it wouldn't harm my project, would it? So I'd try it out.

my last question regarding the capacitors is: Is a tolerance of 20% ok or should it be less?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 17, 2016, 11:23 pm
Quote
What is a raw socket
Just a socket, no breakout board, just mount it on strip board:-

Quote
and can I buy it
Socket (http://uk.farnell.com/te-connectivity-amp/292304-1/usb-2-0-type-b-receptacle-th/dp/1076665?MER=BN-1076665)

Quote
If I get a lower voltage it wouldn't harm my project, would it?
Yes it would.

Quote
Is a tolerance of 20% ok
Fine.

I am quite concerned with all these very very basic level questions. If you don't know this stuff then it does not bode well for the much more complex stuff of getting the actual chips wired up and programmed.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 18, 2016, 03:40 pm
I am quite concerned with all these very very basic level questions. If you don't know this stuff then it does not bode well for the much more complex stuff of getting the actual chips wired up and programmed.
To be honest, in my opinion the hardest part is to know what components you need. The programming shouldn't be that difficult because I can't that much wrong just toggle the LEDs off and on. Regarding the wiring: if I stick to the schematic I should be able to manage this.

If I get a lower voltage it wouldn't harm my project, would it?
Yes it would.
Really? Why? If Ill buy this part (https://www.sparkfun.com/products/12035) is there an easy way to check wether this part has a high resistance?
Also I looked up for a USB cable with open wires on the other end, but didn't find anything. In an early post you mentioned to cut an USB cable. Would the problem be solved if I just get an USB cable and cut it like this:
(http://i.imgur.com/YVRrcBo.jpg)

I'm really sorry for bothering you for so long, but I hope this is the last problem to solve.
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 18, 2016, 03:50 pm
Quote
is there an easy way to check wether this part has a high resistance?
No, it is something they don't tell you. I ended up measuring about six cables and they were all different, some were good, some bad and some in between.

A lower voltage on the Arduino could mean it would stop working. The Arduino can work at a low voltage but not at the full speed.

 
Quote
Would the problem be solved if I just get an USB cable and cut it like this:
Yes.

Quote
The programming shouldn't be that difficult because I can't that much wrong just toggle the LEDs off and on.
Have you read the data sheet? There are a lot of registers and options in that chip, it has to be set up correctly.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 23, 2016, 12:21 pm
Have you read the data sheet? There are a lot of registers and options in that chip, it has to be set up correctly.
Can you tell me how to set it up correctly or should I ask in a new thread about that?
Title: Re: Amperage too high?
Post by: JimboZA on Mar 23, 2016, 12:29 pm
Can you tell me how to set it up correctly or should I ask in a new thread about that?
I'd say you should read the data sheet and figure it out for yourself, only asking for specific help if you get stuck.
Title: Re: Amperage too high?
Post by: raschemmel on Mar 23, 2016, 01:42 pm
By all means, read the datasheet.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 26, 2016, 08:03 pm
I'm apologizing in advance for my incompetence and this inappropriate question, but:

I've read the datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf) but I'm still not sure what you meant by setting the chip correctly up. I think you meant this part of the sheet:
(http://i.imgur.com/kKlueCR.png)
(default: all bits 0)
If I use the default configuration I don't see any problems turning the lights on and off over the registers GPIOA and GPIOB (registers 12 and 13) but I might be completely wrong...
Title: Re: Amperage too high?
Post by: jakub014 on Mar 29, 2016, 09:45 pm
Hey, I'm sorry for asking that many basic stuff I hope this is the last question.
I've connected all wires like in the schematic on page 2. I added  2 4k7 ressistors at the beginning of the SDA and SCL line and 0.1uF ceramic capacitors between every SDA and SCL port of the 8 port expander chips. The program on the arduino should open some ports(output) to turn  LEDs on.

So if I turn on the power the arduino starts working(orange and green light of the arduino are on) but nothing else happens. My thought is that the SDA and SCL lines can't reach/communicate with the expander chips. Do you know what the problem is?

Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 30, 2016, 10:00 am
Quote
and 0.1uF ceramic capacitors between every SDA and SCL port of the 8 port expander chips.
The capacitors should be between the power and ground of thes chips, not on the SDA and SCL lines.
Have you wired the address selector pins differently on each chip?

Have you got the address correct? Post the code, in code tags, of what you are trying to use.

Have you tried an I2C scanner program to test if the Arduino can see those chips?
Title: Re: Amperage too high?
Post by: raschemmel on Mar 30, 2016, 12:23 pm
GM is right. Your description of the wiring inReply #53 suggests you have miswired it 9 ways from sunday ( especially the part abiut the two 4.7 k ohm resistors, which may or msy not already be on a breskout board if the I2C chips are on a breakiut bd.) Also yiur description of where you put the 0.1 uF decoupling caps siunds wrong as Mike mentioned. At this point there's nothing we can do without a schematic.  Post a schematic.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 30, 2016, 05:58 pm
GM is right.
The capacitors should be between the power and ground of thes chips, not on the SDA and SCL lines.
That was the problem and completely my fault. Im sorry.
Unfortunately theres still something not working at my project. If I run my programm everything works fine, but after some time the arduino just stops working/freezes.(arduino lights still on) The programm just gets stuck at some point. If I press the reset button at the arduino the program starts again but gets stuck again. The points when it stops working are mostly different. I've tried waiting for about 10 minutes but nothing happened. I used different codes to find the problem but it gets stuck always at some point. Here is the code I use at the moment.

Code: [Select]
#include <Wire.h>
void setup() {
 Wire.begin();
Wire.beginTransmission(0x20);
Wire.write(0x00);
Wire.write(0x00);
Wire.endTransmission();
//the setup sets the pins of IODIRA to outputs
}
void loop() {
for(int i=0;i<256;i++)
{
Wire.beginTransmission(0x20);
Wire.write(0x12); //0x12 register to set output low and high at GPIOA
Wire.write(i);
//the chip converts this value (in this case i) into a binary number and sets output high if theres a 1
delay(200);
Wire.endTransmission();
 }
}


If I run this code it usually gets stuck between  i=2 & i=6.

Can too long wires be the reason of this problem?
Title: Re: Amperage too high?
Post by: Grumpy_Mike on Mar 30, 2016, 06:15 pm
What part of
Post the code, in code tags,
Are you having trouble with?
Please read this:-
How to use this forum (http://forum.arduino.cc/index.php/topic,148850.0.html)
Because your post is breaking the rules about posting code.
Title: Re: Amperage too high?
Post by: raschemmel on Mar 30, 2016, 06:16 pm
Edit your post using the MODIFY button , highlight the code , and select the CODE TAGS [</>] toolbutton (first button from the left) and click SAVE.

Where's the schematic ?
We still don't know what you did with the 4.7 k resistors.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 30, 2016, 06:27 pm
Where's the schematic ?
(http://s23.postimg.org/3r71c4hjf/schematic.png)
This schematic shows only one expander chip. The other expander chips look similar except to A0,A1,A2 and the 4k7 resistors (these are only at the first chip).
We still don't know what you did with the 4.7 k resistors.
I put one on the SCL and one on the SDA line at the beginning (between A4, the sda port of the aduino and the sda port of the first chip, same goes for A5 and scl)
Title: Re: Amperage too high?
Post by: raschemmel on Mar 30, 2016, 08:44 pm
Quote
Unfortunately theres still something not working at my project. If I run my programm everything works fine, but after some time the arduino just stops working/freezes.(arduino lights still on) The programm just gets stuck at some point. If I press the reset button at the arduino the program starts again but gets stuck again. The points when it stops working are mostly different. I've tried waiting for about 10 minutes but nothing happened. I used different codes to find the problem but it gets stuck always at some point.  
Reply#28
(Quote from Grumpy_Mike)
Quote
The only thing missing from that diagram now is the ... missing 4K7 resistors pulling up the I2C lines.  
Reply from OP

Reply#30
Quote
as far as I understood, I need 2 4k7 ohm resistors at the beginning of the SDA and SCL line
Answer from GM
Reply#31
Quote
Right. The resistors can be fitted anywhere, from the signal line to +5V, the position doesn't matter.  
Apparently, you did not read Mike's comment from Reply#31 carefully.  He specifically states from the signal line to +5V, which is NOT what you describe in the following statement from Reply#59 and what appears in your schematic.

Reply#59
Quote
I put one on the SCL and one on the SDA line at the beginning (between A4, the sda port of the aduino and the sda port of the first chip, same goes for A5 and scl)



Of course it doesn't work !

I2C is OPEN COLLECTOR (https://en.wikipedia.org/wiki/Open_collector)

The 4.7 k ohm resistors are supposed to be pullup resistors from SDA (A4) & SCL (A5) to +5V !

They are NOT supposed to be in series.

Many breakout boards have the pullup resistors on board. They are not, (AFAIK) provided as internal pullups with I2C chips.
Title: Re: Amperage too high?
Post by: jakub014 on Mar 31, 2016, 04:18 pm
Im sorry for beeing so dull. After I put the 4k7 resistors to the right spot everything started working.
My problem is solved. Thank you all for helping me soo much.

Jakub
Title: Re: Amperage too high?
Post by: alnath on Mar 31, 2016, 04:29 pm
My problem is solved. Thank you all for helping me soo much.

Jakub
then you could do 2 things :

- edit your 1st post and write (solved) at the end of the title
- if you want to thank the people you found helpful (maybe first Grumpy Mike and Raschemmel ... ) :click on [add] on the right of "karma" for each of them ;-)
Title: Re: Amperage too high?
Post by: raschemmel on Mar 31, 2016, 04:33 pm
@Alnath,
Thanks