Using all 17 available GPIO pins (to build a binary clock)


125 posts   Page 3 of 5   1, 2, 3, 4, 5
by Grumpy Mike » Thu Nov 01, 2012 5:07 pm
Un4Seen wrote:the ULN2003 should be fine too.

Odd when I pointed you to the link where I used this chip you said it was beyond you.
http://www.thebox.myzen.co.uk/Raspberry/Buffer_Board.html
Seriously can you revisit the page and say what you did not understand as I am always looking to improve what I do.
Cheers.
User avatar
Posts: 784
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by Un4Seen » Thu Nov 01, 2012 9:12 pm
joan wrote:You might want to check that the devices you buy have the standard 0.1" pitch between pins. If not you might have trouble soldering them or fitting them into a breadboard.

Good point! Thanks :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Fri Nov 02, 2012 8:15 am
This is getting a bit far from the topic of Raspberry Pi and more towards the topic of electronics in general, but I decided to share some info anyway (related to this project), somebody might find it really useful :)

This morning I decided to experiment a bit with white, blue and orange LEDs, to see how far I can starve them and still get acceptable light from them (how little current is enough). The results are very surprising (at least for me). As you know the current recommended by the manufacturer for standard LEDs like these is 20 mA. Well, I found that giving them 20 mA is a huge waste :) At 5 mA their light is barely less than at 20 mA (at 5 mA their light is still so strong that it hurts to look right into them). But what is even more surprising is that their light starts to decrease noticeably only betwen 1-2 mA and they still provide quite acceptable light at only 0.5 mA!!! I did nt starve them even more, but I'm guessing the limits can be pushed even more.
It seems that the blue LEDs give the strongest light at very low currents, the oranges are next in line and the white ones lose most of their light at very low current values. Well this is true for the 3 LEDs I experimented with, perhaps the differences come not from the color, but from tiny manufacturing differences betwen these 3 particular LEDs. Perhaps such differences exist among different instances of the same color.

Hopefully my multimeter is accurate and has not fooled me. Also, I did these measurements with a power supply that has an open circuit voltage of 8V (which surprises me quite much because it's a Nokia phone charger and it's clearly labeled with 5V @ 350 mA). Hopefully at the 5V coming from the Pi the behavior of the LEDs won't change.

I decided to add individual adjustable 10K resistors to each LED (in line with a regular one calculated to let 5mA through), so that I can adjust their brightness from 5mA to less than 0.5mA because I intend to run the led clock all the time and at night it can be quite disturbing when 17 LEDs give a strong light and you're trying to sleep in the same room :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Fri Nov 02, 2012 8:58 am
Grumpy Mike wrote:
Un4Seen wrote:the ULN2003 should be fine too.

Odd when I pointed you to the link where I used this chip you said it was beyond you.
http://www.thebox.myzen.co.uk/Raspberry/Buffer_Board.html
Seriously can you revisit the page and say what you did not understand as I am always looking to improve what I do.
Cheers.


Sorry for the late reply, Grumpy Mike.
Indeed, 1-2 days ago that post was beyond my understanding. I had no idea what an ULN2003 is, what a buffer is (I still haven't looked it up but I suspect it's a capacitor?), what a darling is, what a buffered output is, what reverse biased EMC diodes are, etc. But I guess the biggest problem at the time was that I did not understand the purpose of the ULN2003 ICs. Now that I know that they are something like 8 transistors in a common package, the post makes much more sense (although it does use the above mentioned terms, which for the amateur in me are unknown, but I guess that if I really really had to, I could figure those out too). Generally speaking, your post target people who have a higher level of electronics knowledge than me :) For me to fully understand that post I would have to read at least 3 times that much external information to figure out the meaning of the used terms. If you wish to target complete amateurs too, you cold explain things in a bit more detail or you could make a link out of every term that you suspect an amateur would not understand. Sure, Google is just as good as links in your post, but unfortunately readers tend to be lazy, and I'm afraid I'm no exception :?
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Fri Nov 02, 2012 9:05 am
Un4Seen wrote:I decided to add individual adjustable 10K resistors to each LED (in line with a regular one calculated to let 5mA through), so that I can adjust their brightness from 5mA to less than 0.5mA because I intend to run the led clock all the time and at night it can be quite disturbing when 17 LEDs give a strong light and you're trying to sleep in the same room :)


You could drive them with my softwarePWM code... That way you can vary the effective brightness in software - or if you're up for more programming, have it automatically dim at a set time and get brighter again...

For the ultimate in control, you'd need a light sensor input and arrange it so that the brighter it is, then the brighter the LEDs are - so at night when you turn the light off, then the LEDs go dim...

And/Or use them as a flashing alarm, etc. many possibilities...

The down-side is that you're run out of IOs on a Rev 1 board - if you have a Rev 2 then you have 4 more GPIOs to play with, although interfacing an analog light sensor is somewhat interesting, but will be the subject of a blog post I'm going to do soon...

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Fri Nov 02, 2012 9:21 am
Oh man, your idea with the light sensor is great. I feel that I won't be able to resist it... :) For now I'm proceeding with the original plan because I'm dieing to see some results and because that will give me a clear idea of what is possible, what is not and how it could be improved. But I have a pan for the future to make a second version of the binary LED clock, with a professionally printed circuit board instead of ugly wires all across. I want to leave the whole circuit visible and put it in a transparent plastic box, just like the one I have my Pi in. It will be what I like to call "geekly elegant" :) In that second version I'll probably include the light sensor as well, but I think I'd like to do the dimming (depending on the sense light) from hardware. I'd like to use the Pi only to tell the clock which LED to light up.
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Fri Nov 02, 2012 9:27 am
Un4Seen wrote:Oh man, your idea with the light sensor is great. I feel that I won't be able to resist it... :) For now I'm proceeding with the original plan because I'm dieing to see some results and because that will give me a clear idea of what is possible, what is not and how it could be improved. But I have a pan for the future to make a second version of the binary LED clock, with a professionally printed circuit board instead of ugly wires all across. I want to leave the whole circuit visible and put it in a transparent plastic box, just like the one I have my Pi in. It will be what I like to call "geekly elegant" :) In that second version I'll probably include the light sensor as well, but I think I'd like to do the dimming (depending on the sense light) from hardware. I'd like to use the Pi only to tell the clock which LED to light up.


Well - this is why I suggested starting with something now, then building on it - otherwise you'll end up with a huge plan and never be able to implement it. By now you could have had 17 LEDs going and tested the software...

I know someone else in this thread suggested not doing it this way, but it's how I've worked most of my projects - you start small and build on it - you get imediate results and and build ot in. The important thing I've realised is to not be afraid to throw things away and start again. (whether that's a few 1000 lines of code, or a hardware design that could be better done some other way) So you realise quickly if one way isn't going to work or be practical, change/adapt/try again...

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Fri Nov 02, 2012 10:37 am
Yes, I guess you're right :) However, what I'll do in the first step is going to be a finished product in a way. It will be the "RPI binary led lock v1". In the second phase I'm not going to modify v1, I'll build v2 from scratch again :)

Oh boy, I just returned from the shop. I've bought components almost worth a Pi's price :) (some of them not for this project). The sad thing however is that I could not find a 26-pin ribbon cable in the whole town, so I had to order one from ebay and it will take about 3 weeks to get here form China :(
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by techpaul » Fri Nov 02, 2012 10:41 am
Un4Seen wrote:Yes, I guess you're right :) However, what I'll do in the first step is going to be a finished product in a way. It will be the "RPI binary led lock v1". In the second phase I'm not going to modify v1, I'll build v2 from scratch again :)

Oh boy, I just returned from the shop. I've bought components almost worth a Pi's price :) (some of them not for this project). The sad thing however is that I could not find a 26-pin ribbon cable in the whole town, so I had to order one from ebay and it will take about 3 weeks to get here form China :(

Farnell/CPC list them on their Pi page. Many other places have such things in UK.

Alternatively you can look at things like my GPIO boards for direct plug in no cable required. See link below
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/
Posts: 1510
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
by gordon@drogon.net » Fri Nov 02, 2012 11:14 am
Un4Seen wrote:Yes, I guess you're right :) However, what I'll do in the first step is going to be a finished product in a way. It will be the "RPI binary led lock v1". In the second phase I'm not going to modify v1, I'll build v2 from scratch again :)

Oh boy, I just returned from the shop. I've bought components almost worth a Pi's price :) (some of them not for this project). The sad thing however is that I could not find a 26-pin ribbon cable in the whole town, so I had to order one from ebay and it will take about 3 weeks to get here form China :(

http://www.tandyonline.co.uk/components ... ocket.html
http://www.tandyonline.co.uk/components ... cable.html

or ready made:

http://www.skpang.co.uk/catalog/gpio-ca ... -1120.html

or just use female to male jumpers to go from Pi to breadboard, or something like this:

http://www.skpang.co.uk/catalog/adafrui ... -1125.html

Lots of options locally without resorting to ebay.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Fri Nov 02, 2012 11:21 am
I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Fri Nov 02, 2012 11:28 am
Un4Seen wrote:I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(


A-Ha. Here was me thinking you were in the UK for some reason!

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Fri Nov 02, 2012 11:30 am
gordon@drogon.net wrote:
Un4Seen wrote:I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(


A-Ha. Here was me thinking you were in the UK for some reason!

-Gordon


I wish I were :) UK would be the best place for my other hobby too: steam locomotives. Maybe one day... :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Fri Nov 02, 2012 11:33 am
Un4Seen wrote:
gordon@drogon.net wrote:
Un4Seen wrote:I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(


A-Ha. Here was me thinking you were in the UK for some reason!

-Gordon


I wish I were :) UK would be the best place for my other hobby too: steam locomotives. Maybe one day... :)


I'll make you more jealous then - I live 10 minutes walk from: http://www.southdevonrailway.co.uk/ ;-)

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Fri Nov 02, 2012 11:36 am
gordon@drogon.net wrote:I'll make you more jealous then - I live 10 minutes walk from: http://www.southdevonrailway.co.uk/ ;-)
-Gordon

Now you're torturing me! :D
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by techpaul » Fri Nov 02, 2012 11:47 am
Un4Seen wrote:I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(

Might I suggest you at least change your profile to say you are in Romania when you do posts, then we might get a clue.

Helps when suggesting where to get things or how to help you
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/
Posts: 1510
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
by Un4Seen » Fri Nov 02, 2012 11:51 am
techpaul wrote:
Un4Seen wrote:I wish it were that easy :) Life is so much simpler when you want to put together a circuit and you live in the UK or in the USA. But I live in Romania and for example Element 14 delivers any package to my town for about 30$ just for transport :(

Might I suggest you at least change your profile to say you are in Romania when you do posts, then we might get a clue.

Helps when suggesting where to get things or how to help you


Done :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Sat Nov 03, 2012 12:47 pm
I've got most of the soldering done, the LEDs, resistors, variable resistors and ULN2003 ICs are all soldered to my board and now I want to solder a 26-pin IDC connector onto the board. Unfortunately I realized that I'm confused about how the ribbon cable connects two 26-pin IDC connectors :(

Imagine that you put the PI's 26-pin connector and another 26-pin IDC connector next to each other, the Pi on the left and the other connector on the right, aligned in parallel and vertically, looking at them from the top. In other words, the PI is in the position described by Gordon here: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ and the other connector is in the same position, next to the Pi, on the Pi's right. Now the top pins on the Pi's connector, from left to right, are 3.3V and 5V. When I connect the two connectors with the ribbon cable (see here: http://www.ebay.com/itm/170720885743?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649), will I get the same layout of pins on the other connector? Will I get the same 3.3V on the left and 5V on the right, just like on the Pi's connector, or will they be inversed? Note that I imagine the ribbon cable standing straight, not bent or anything (although I don't think that matters).

So the question in short is: does the ribbon cable keep the position of pins the same way as it's on the Pi or does it interchange the left pins with the right pins?

Thanks!
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Sat Nov 03, 2012 1:02 pm
Un4Seen wrote:So the question in short is: does the ribbon cable keep the position of pins the same way as it's on the Pi or does it interchange the left pins with the right pins?

Thanks!


If you don't twist the cable, it will keep pin for pin.

So connecting a ribbon cable to the pi, if the red-stripe is to the right (Pi with composite video facing you), then the red-stripe wire is pin 1.

e.g. In this picture: Image the 26-way connector on the ladder board is laid out identically to the one on the Pi - ie. you could put the board cirectly on-top of the Pi in the same orientation and it would work.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Sat Nov 03, 2012 1:12 pm
Thank you, Gordon! You saved me again :) Well, if the layout is kept, than soldering the connector will be as simple as eating a Pi(e) :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Sat Nov 03, 2012 2:43 pm
Just for the sake of curiosity... what happens if, by accidental soldering, two GPIO ports of the RPI become connected to each other (not GND, 3.3V, 5V, DNC or other special pins, just regular GPIO pins)? :) It almost happened... :?
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Sat Nov 03, 2012 3:00 pm
Un4Seen wrote:Just for the sake of curiosity... what happens if, by accidental soldering, two GPIO ports of the RPI become connected to each other (not GND, 3.3V, 5V, DNC or other special pins, just regular GPIO pins)? :) It almost happened... :?


If the Pi's not turned on, then nothing ;-)

That's what testing with a multimeter is for...

However if you short 2 together and make both outputs and drive one high, then it'll effectively short circuit the system - it'll probably just reboot, but could potentially destroy one or both the GPIO pins or worse...

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Sat Nov 03, 2012 3:09 pm
Doesn't sound good at all :) Yes, I do test with a multimeter, but still I worry about this :)

By the way, I was thinking about the following test: when it's finished, power on the clock from a non-Pi power source and simulate the signals from the Pi. Could this be done with the multimeter? I mean is there some mode on the multimeter (say, the diode test mode?) in which I could connect the negative lead of the multimeter to the pin where the PI's 0V pin is supposed to be and touch the pins which are supposed to be connected to the programmable GPIO pins with the multimeter's positive lead. Would this open the transistors in the ULN2003 ICs and would I see it working just like the signal was coming from the Pi? Perhaps I should use some other mode on the multimeter? Is this possible at all?
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by gordon@drogon.net » Sat Nov 03, 2012 3:19 pm
Un4Seen wrote:Doesn't sound good at all :) Yes, I do test with a multimeter, but still I worry about this :)

By the way, I was thinking about the following test: when it's finished, power on the clock from a non-Pi power source and simulate the signals from the Pi. Could this be done with the multimeter? I mean is there some mode on the multimeter (say, the diode test mode?) in which I could connect the negative lead of the multimeter to the pin where the PI's 0V pin is supposed to be and touch the pins which are supposed to be connected to the programmable GPIO pins with the multimeter's positive lead. Would this open the transistors in the ULN2003 ICs and would I see it working just like the signal was coming from the Pi? Perhaps I should use some other mode on the multimeter? Is this possible at all?


This is why I suggested starting with one LED on a breadboard...

So you could built it up incermentally, gaining confidence and experience, etc.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1527
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by Un4Seen » Sat Nov 03, 2012 4:00 pm
gordon@drogon.net wrote:
Un4Seen wrote:Doesn't sound good at all :) Yes, I do test with a multimeter, but still I worry about this :)

By the way, I was thinking about the following test: when it's finished, power on the clock from a non-Pi power source and simulate the signals from the Pi. Could this be done with the multimeter? I mean is there some mode on the multimeter (say, the diode test mode?) in which I could connect the negative lead of the multimeter to the pin where the PI's 0V pin is supposed to be and touch the pins which are supposed to be connected to the programmable GPIO pins with the multimeter's positive lead. Would this open the transistors in the ULN2003 ICs and would I see it working just like the signal was coming from the Pi? Perhaps I should use some other mode on the multimeter? Is this possible at all?


This is why I suggested starting with one LED on a breadboard...

So you could built it up incermentally, gaining confidence and experience, etc.

-Gordon


Yeah, I see what you meant... :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania