leds test problem


10 posts
by sqaure » Fri Dec 21, 2012 8:11 am
When I wire the gertboard for the leds test the first four or five (I forget sorry, if it is important I will run the test again) leds are constantly blinking lightly.

They are blinking/flickering before, during, and after the test, although the test still seems to run fine. The other leds seem to follow the test perfectly.

I have ran the button test flawlessly and the I/O test flawlessly (I also tested each led with the I/O test and they do not flicker or do anything weird in this case).


Any ideas what is wrong?

Thanks
Posts: 32
Joined: Fri Dec 21, 2012 8:06 am
by alexeames » Fri Dec 21, 2012 3:12 pm
You'll be glad to know the answer it nothing is wrong.

http://raspi.tv/2012/gertboard-is-a-proximity-sensor

Check out the video in the above blog.

Basically what is happening here is that there are no pullup resistors on the buffer ports. This means that they are floating and if you put your hand near or touch the board it can be enough to induce a signal. It would have involved soldering an additional 12 SMD components to put them on, so Gert had mercy on us and omitted them deliberately.

The pre-built Gertboard coming out soon has pullups in place.

There's nothing to worry about, it's just a bit alarming the first time it happens :D (Particularly if you're still not sure if you put your board together properly or not)
My Pi uses 2 watts - what what? ---- HiRes early production Pi photos RS Front Back | Farnell Front Back
User avatar
Posts: 2018
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by sqaure » Fri Dec 21, 2012 11:00 pm
yes but I am not even remotely close to the board and it still flickers
Posts: 32
Joined: Fri Dec 21, 2012 8:06 am
by alexeames » Fri Dec 21, 2012 11:06 pm
sqaure wrote:yes but I am not even remotely close to the board and it still flickers


You should be able to clear it by running your finger up and down the long row of pins marked BUFF1 - BUFF12.
My Pi uses 2 watts - what what? ---- HiRes early production Pi photos RS Front Back | Farnell Front Back
User avatar
Posts: 2018
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by amateurasu » Wed Feb 20, 2013 1:30 pm
I find this behavior pretty bothersome as well. The user guide does mention that "Depending on the type of 74xx244 buffer chosen, the LED could behave randomly if the port is not driven properly." The ones that came with my kit were HC's. Anybody know which family would make the LEDs not behave randomly? Or, failing that, where these pullup resistors need to go?
Posts: 8
Joined: Mon Jan 30, 2012 9:13 am
by gordon@drogon.net » Wed Feb 20, 2013 2:16 pm
amateurasu wrote:I find this behavior pretty bothersome as well. The user guide does mention that "Depending on the type of 74xx244 buffer chosen, the LED could behave randomly if the port is not driven properly." The ones that came with my kit were HC's. Anybody know which family would make the LEDs not behave randomly? Or, failing that, where these pullup resistors need to go?


If you have plenty of jumper wires, then you can wire them from the Bx pins to the 0v pins next to each BufX pin. this will ground the inputs and stop the unused LEDs from flickering.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by amateurasu » Thu Feb 21, 2013 1:37 am
They flicker even when I am using them, though. I was tinkering with the ATMega, wiring up all 12 LEDs from the ATMega pins to BUF1-12, leaving all the in/out jumpers disconnected, exactly as described in the user guide:

"There is a third option for using this port: if neither the input nor output jumper is placed the I/O pin can be used as a simple ‘logic’ detector. The I/O pin can be connected to some other logic point (i.e. one that is either at 0V or 3.3V) and use the LED to check if the connect point is seen as high or low."

I still get random activity on the LEDs that aren't being driven at that particular moment, but which are still wired up and in theory being held low by the ATMega.
Posts: 8
Joined: Mon Jan 30, 2012 9:13 am
by gordon@drogon.net » Thu Feb 21, 2013 8:51 am
amateurasu wrote:They flicker even when I am using them, though. I was tinkering with the ATMega, wiring up all 12 LEDs from the ATMega pins to BUF1-12, leaving all the in/out jumpers disconnected, exactly as described in the user guide:


If you connect from the ATmega to the BUFx pins, then you're connecting the output to a buffer gate input which is connected to the LED. See the circuit diagram on page 12 of the manual. This is fine as long as you have both the input and output jumpers removed. In this case the output from the ATmega is not buffered, but it's driving an LED as well as what else you're connecting to it. ATmega pins can drive (IIRC) 40mA so you're OK with a bit more load directly on then than the Pi is.

If neither the input nor output jumpers are present, then this should be fine - the LED will reflect the state of the ATmegas pin - but if that pin is in input mode, then the LED will be indeterminate unless the internal pull-up on the ATmega is activated - at which point the LED will be ON. The LED will correctly reflect the state of the pin when it's turned to output mode.

Personally, I'd suggest connecting the ATmega to the Bx pins on the Gertboard, then enable either the input or output jumpers on the buffers depending on the pin mode on the ATmega - but you'll still get the same effect if the pin is set to an input (and the jumpers set to input) if nothing is connected to the BUFx pin.

"There is a third option for using this port: if neither the input nor output jumper is placed the I/O pin can be used as a simple ‘logic’ detector. The I/O pin can be connected to some other logic point (i.e. one that is either at 0V or 3.3V) and use the LED to check if the connect point is seen as high or low."

I still get random activity on the LEDs that aren't being driven at that particular moment, but which are still wired up and in theory being held low by the ATMega.


I'd double check your wiring and the jumper settings. Also study the circuit diagram - which I'll copy below:
Image
"Raspi" is the Bx pin, and "I/O" is the BUFx pin on the Gertboard.

The only time the LEDs on my Gertboard flicker is when I've not connected anything to the buffers, or they're connected to the Pi and the Pi's pin is in input mode with the internal pull up/downs disabled.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by amateurasu » Sun Feb 24, 2013 4:37 pm
Yeah, I hooked 12 pins from the ATMega up to the 12 BUFx pins at the edge of the board. All of the in/out jumpers on the buffers are removed. There's not a whole lot of wiring to recheck. And every one of the ATMega pins is set as an output. The LEDs consistently come on when I am driving them on, but they do not consistently stay off when I turn them off. In the off state, they still fluctuate randomly when I move my hand nearer to/farther from the board, set something down on the table, etc, just as they do when not hooked up to anything.

I guess I'll try what you mentioned about hooking the ATMega to the Bx pin instead. It looks like it would be better to use the input jumpers, though. That way, the ATMega will drive the LEDs directly (albeit through an extra resistor). If I use the output jumpers, won't it have to go through both the output and the input buffers? Given the flakiness a single buffer is causing, I'm not inclined to double down... ;)
Posts: 8
Joined: Mon Jan 30, 2012 9:13 am
by gordon@drogon.net » Sun Feb 24, 2013 5:28 pm
amateurasu wrote:Yeah, I hooked 12 pins from the ATMega up to the 12 BUFx pins at the edge of the board. All of the in/out jumpers on the buffers are removed. There's not a whole lot of wiring to recheck. And every one of the ATMega pins is set as an output. The LEDs consistently come on when I am driving them on, but they do not consistently stay off when I turn them off. In the off state, they still fluctuate randomly when I move my hand nearer to/farther from the board, set something down on the table, etc, just as they do when not hooked up to anything.


That really shouldn't be possible.

I'm inclined to think that you really haven't put the pins into output mode.

If you digitalWrite (pin, 1) on the ATmega when the pin is in input mode, then you enable the internal pull-up resistor - this will have the effect of setting the pin to a logic 1 - although very "weakly" but good enough for the 74HCT buffer to register a 1 and turn the LED on. If you then digitalWrite (pin, 0) it disconnects the internal pull-up and the pin is them subject to stray capacitance.

The pins default to input mode, to make them outputs you must call pinMode (pin, OUTPUT) ; first.

Do post your ATmega code.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK