gpio & f0nera problems...

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware
Author Message
emuboy
DD-WRT Novice


Joined: 23 Mar 2007
Posts: 11

PostPosted: Wed Oct 03, 2007 5:23 pm    Post subject: gpio & f0nera problems... Reply with quote
I have done this little circut whit a fonera and a relay (not solid state) :
Code:

                        ----------------
gpio 3 pin---->|                     |--------220v out ---------|| wall plug 
                       |    relay         |                                                           
+5v powre----------->|___________|-------- 220v in ----(light bulb)----||   
                                                                             



why if :

# echo 1 > /proc/gpio/3_dir
light bulb is on and
#echo 1 >/proc/gpio/3_dir
light bulb still on????

there's a bug in the circuit? i must use a diode?
help me please....
Sponsor
BrainSlayer
Site Admin


Joined: 06 Jun 2006
Posts: 4915
Location: Dresden, Germany

PostPosted: Thu Oct 04, 2007 2:22 am    Post subject: Reply with quote
3_dir just sets the direction of the gpio. input or ouput

3_out is important for you

_________________
one cigarette costs 2 minutes of your life.
one bottle of beer costs 4 minutes of your life.
one working day costs 8 hours of your life.
emuboy
DD-WRT Novice


Joined: 23 Mar 2007
Posts: 11

PostPosted: Thu Oct 04, 2007 5:34 pm    Post subject: Reply with quote
uh...well...

if

echo 1 > /proc/gpio/3_dir

blulb on and 3_out is 0

and

echo 1 > /proc/gpio/3_dir

cat 3_dir = 0
cat 3_out = 0

but bulb still on...
dg1kjd
DD-WRT Novice


Joined: 07 Mar 2007
Posts: 10
Location: Dresden, Germany

PostPosted: Thu Oct 11, 2007 7:31 pm    Post subject: you probably fragged it Reply with quote
Hi,

the Atheros WiSOC is not designed to drive a relay directly.
You probably fragged the GPIO pad cell by now. Whilst modern IO pads are designed to withstand short circuits and all kinds of other abuse within the supply voltage limits the lack of the recovery (kickback) diode in your design might have meant its death.
I would suggest using a simple NPN (BC238 or something) bipolar transistor as driver and 1N4148 as recovery diode at the relay coil.
Then also make sure to use the GPIO in totem-pole mode, not open-drain if that is configurable.

Oh, and yeah, make sure you dont hurt yourself, rereading this post it sounds really dangerous. Smile

--j
emuboy
DD-WRT Novice


Joined: 23 Mar 2007
Posts: 11

PostPosted: Thu Oct 11, 2007 8:18 pm    Post subject: Reply with quote
hum...ok...tanks...weeellll....my backup fonera is going to hate me Very Happy

at this point, the gpio is death?no recovery?
dg1kjd
DD-WRT Novice


Joined: 07 Mar 2007
Posts: 10
Location: Dresden, Germany

PostPosted: Fri Oct 12, 2007 11:36 pm    Post subject: probably... Reply with quote
In fact you can be pretty happy that (aparently) not much else broke.
You see an inductance such as a relay coil will always try to keep the current flow steady. That is,
if during on-time there are 20mA flowing through the coil and then by turning off the output
it stops, the coil will *force* the current flow to continue until the energy stored in its magnetic
field is gone.
That is, whatever voltage needed to keep these 20mA flowing (cf. Ohms law) will be generated
by the coil and therefore be applied to the pad. This can mean quite some overvoltage that
probably fragged the driver and clamp diode within the chip. The precise behaviour of such a
circuit can be described by a first order exponential differential equation, but this would go
too far for this board. Use a NPN transistor driver and recovery diode protection I would
suggest.

And, oh yeah, next time make sure to apply your hacks to a borrowed AP first. Wink

--j
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum