Searching \ for 'ac line + pullups ??' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/power.htm?key=ac
Search entire site for: 'ac line + pullups ??'.

Truncated match.
PICList Thread
'ac line + pullups ??'
1999\04\20@224323 by Glen

flavicon
face
hi & thanks for you time , i appreciate it
this is my problem.

switch a&b set a value (00.01,10,11)
selected code is checked with lookup table ( on startup only )
table value placed in var "strttmr"
continue with code

                                         swA
                                   |-----/  -----| rb0
       gnd                       |                 |
       |------------------|-----/  -----| rb1    16f84
                                           swB    |
     ac                                              |
       |--------/\/\/\/\------------------| rb3
                10m with 240v

the circuit works when a single strttmr value & no pullups are used.
(SWITCHS  A & B ARE NOT USED AT ALL)

i am using rb3 to sense the ac line i/p.& synchronise
(i am testing with 16vac till i get the code to work correctly)

when i use pullups the prog won't work , because the ac i/p (rb3)
doesn't go down
to read a zero , goes no lower than 1.8v
but when i get to using the 240v line voltage the same problem would
arise,
can't read zero crossing due to pullups!
*****************
with this modification using selectable switch values via lookup table
& since i need pullups to read the two switches.( at powerup only )

is their a way to code other than to enable pullups to get the switch
values &
then disable rb3 pullup
so rb3 can sense line & synchronise(able to read zero crossing)
(beside using 2 pullup res. on rb0 & rb1 keeping pullups disabled )
heres the code (lookup table only included in sub routines)

;   vars
PORTA   equ     0x05  ;CPU equates (program memory map)
PORTB   equ     0x06  ;CPU equates (program memory map)
souter equ 0x0c ;
sinner equ 0x0d ;
inners equ 0x0e ;
outers equ 0x0f ;
innerf equ 0x10 ;
outerf equ 0x11 ;
chkcnt equ 0x12 ;
strttmr equ 0x13 ; no of counts
switch equ 0x14 ;
STATUS equ 0x03    ;CPU equates (program memory map)
w       equ     0  ; destination designators
f         equ     1 ; destination designators

;**********************************************************************
;                   porta set-up
       org     0x000             ;address 000 program start
start   movlw 0xff              ;ff hex moved to w register
       tris    PORTA             ;porta set as inputs
;
;**********************************************************************
;                    PORTB set-up
       movlw   0x0f            ;00001111 hex moved to w register
       tris        PORTB         ;PORTB set o/p's 4,5,6,7,inputs
0,1,2,3
;
;**********************************************************************
        clrf  STATUS
; ============= prescaler setup ==============
        movlw     b'01000111' ;scale 1:256 , pullups enabled
        OPTION
; ============= counter setup ==============

;code below is used for 2 switches
; init strttmr from input pins
            movf       PORTB,w          ;get values of RB0 & RB1
            andlw     0x03             ; extract out bits 0,1 of PORTB
(strttmr value)

CALL     table                         ; use look up table
            movwf     strttmr     ;move selected value from table to
strttmr

;**********************************************************************
;       ============== program start =============
        movlw     0x00              ;move 00 hex to register w
        movwf     PORTB             ;move register w to PORTB (clear
PORTB)

; ============= initialise timer setup ==============

       initmr         movlw .215          ;40 * .000256 = 10 ms
        movwf     TMR0

loop CALL     chcycs    ;check for zero crossing
        CALL     sttimer
        CALL      tog

; ============= check timer ==============
        movf         TMR0,w          ;move f reg to w
        btfsc         STATUS,Z         ;if !0 ,GOTO loop
        GOTO      loop
        decfsz         strttmr,f             ;decrement strttmr by 1
        GOTO         initmr              ;go around for next delay

;drop thru to stop

stop     GOTO         stop
;=======================================================================

;                       delay sub-routine
table     addwf         PCL,f
            retlw         d'25'         ; 00 : 250ms (switch position
1)
            retlw         d'50'         ; 01 : 500ms (switch position
2)
            retlw         d'75'         ; 10 : 750ms (switch position
3)
            retlw         d'100'         ; 11 : 1000ms (switch position
4)

thanks heaps
in advance
glen

1999\04\21@200122 by Glen

flavicon
face
thanks for letting me know , mark !
i was wondering why some of the postings i read were distorted.

opto's are quite $$$ . space is a factor , i was going to use 2 diodes +res

ac---------|>-----|        res
240v             |------/\/\/\-----|rb3    (values for 240v)
ac---------|>-----|        10m

i've tested this out on 16vac (res lower value)while i get the code working righ
t.had no probs.with
sync.
the prob was pullups (set pullups does all portb pins) when pullups are used to
get switch values the
pullup on rb3 is at 1.8v & can't detect zero crossing.
once the sw val.is selected (which is on powerup) i just remove pullups ,everyth
ing ok then.
thankyou very much for your time & advice
glen
ps if i was after better accuracy ,yeh i'd look at opto
**************************
Mark Jurras wrote:

> Glen,
>
> When posting code and schematics use a fixed width font such as Courier. Every
computer has a
> fixed width font. You posting was some variable spaced font that was different
spacing than any
> variable spaced font that I and many others have. It was difficult to read.
>
> I would use an opto-isolator on AC signal to generate the sync pulses. That wa
y all the PIC inputs
> would be at VCC levels and you get around all the internal diode conduction pr
oblems that others
> with better knowledge of the PIC can tell you about when you feed with HV on t
he inputs.
>
> HTH,
>
> - -Mark
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com

1999\04\22@010559 by Bill Sherwood

flavicon
face
Hey Glen,

I've just picked up on this thread so forgive me if I've missed something.

What you are doing here is dangerous!  I gather someone recommended
optoisolators for the safety factor but if you think they're too expensive
use a small power transformer with a low secondary winding (say 6.3vac) and
a bridge rectifier (no filter capacitor) and resistive divider or zener to
get your zero crossing points - if the application is mains powered you
could even use your existing supply/plugpack if you insert an isolating
diode in there to isolate the filter cap.

Or you could make your own transformer using some turns around a current
carrying wire - the result in either case being good isolation from the
mains.  Try and stay away from the single big resistor method as only
special types are rated at high voltages (you may fry yourself as well as
your micro...).

In any application your safety and future persons' safety (who may access
the unit) is paramount - with mains there is usually no second chance.  Do
it right the first time - safety first, price next.

>ac---------|>-----|        res
> 240v             |------/\/\/\-----|rb3    (values for 240v)
>ac---------|>-----|        10m
>

Please don't take this as a flame.
Regards,
Bill

W J Sherwood
Senior Electronics Technician
WNI Science & Engineering
31 Bishop St, Jolimont
Perth, West Australia 6014
tel +61 8 9387 7955
fax +61 8 9387 6686

1999\04\22@013315 by Dave VanHorn

flavicon
face
> In any application your safety and future persons' safety (who may access
> the unit) is paramount - with mains there is usually no second chance.  Do
> it right the first time - safety first, price next.


Absolutely right. NEVER rely on a single component for a safety barrier,
(transformers ok, they have multiple layers of insulation) for a safety
barrier.  Resistors and caps short, even with no electrical or mechanical
stress at all.

1999\04\22@054230 by Nic van der Walt

flavicon
face
).
>
>In any application your safety and future persons' safety (who may access
>the unit) is paramount - with mains there is usually no second chance.  Do
>it right the first time - safety first, price next.
>
>>ac---------|>-----|        res
>> 240v             |------/\/\/\-----|rb3    (values for 240v)
>>ac---------|>-----|        10m
>>
>

1/4W resistors are usually rated at 100V-200V depending on type.
Consider putting five 2M2 resistors in series. This gives you
some form of redundacy. Doing the same with the diodes might help,
but is not that important.

Regards,
Nic

1999\04\22@112745 by wwl

picon face
On Wed, 22 Apr 1998 11:31:13 +0200, you wrote:

>).
>>
>>In any application your safety and future persons' safety (who may access
>>the unit) is paramount - with mains there is usually no second chance.  Do
>>it right the first time - safety first, price next.
>>
>>>ac---------|>-----|        res
>>> 240v             |------/\/\/\-----|rb3    (values for 240v)
>>>ac---------|>-----|        10m
>>>
>>
>
>1/4W resistors are usually rated at 100V-200V depending on type.
>Consider putting five 2M2 resistors in series. This gives you
>some form of redundacy. Doing the same with the diodes might help,
>but is not that important.
Use metal-glaze resistors which are rated for high voltage operation.
Resistors don't fail low-resistance. This is recognised even by very
stringent safety standards like those for intrinsically-safe equipment
for use in explosive atmospheres. Watch those creepage/clearence
distances, though.

1999\04\22@114810 by Tjaart van der Walt

flavicon
face
Mike Harrison wrote:
{Quote hidden}

To protect the PIC inputs, I'd also split the resistor up into three
series resistors and add a 10V Zener, a 10pF, and a 100pF cap in
parallel on the node closest to the PIC. No transient = no comeback.

--
Friendly Regards          /"\
                         \ /
Tjaart van der Walt        X  ASCII RIBBON CAMPAIGN
spam_OUTtjaartTakeThisOuTspamwasp.co.za  / \ AGAINST HTML MAIL
|--------------------------------------------------|
|                WASP International                |
|R&D Engineer : GSM peripheral services development|
|--------------------------------------------------|
| Mobile : .....tjaartKILLspamspam@spam@sms.wasp.co.za  (160 text chars) |
|     http://www.wasp.co.za/~tjaart/index.html     |
|Voice: +27-(0)11-622-8686  Fax: +27-(0)11-622-8973|
|          WGS-84 : 26¡10.52'S 28¡06.19'E          |
|--------------------------------------------------|

1999\04\22@122147 by Wagner Lipnharski

picon face
hmmm, what happens if one of the diodes just short circuit?
Why don't use protective resistors "before" the diodes instead after?

By the way, we already produced a power meter up to 480 Volts, and the
best safety option for the current (and voltage) drop resistor is using
at least 3 resistors in series, they isolate better high voltages and
increase the damage caused by burnout possibility.

Wagner.

ps: exercising my pester position in this list, I'd like to say that a
10 meters resistor is the biggest I ever saw, and that Mr. Volt would be
revolted seen his name in lower case (240v). :)

Glen wrote:
{Quote hidden}

ght.had no probs.with
> sync.
> the prob was pullups (set pullups does all portb pins) when pullups are used t
o get switch values the
> pullup on rb3 is at 1.8v & can't detect zero crossing.
> once the sw val.is selected (which is on powerup) i just remove pullups ,every
thing ok then.
> thankyou very much for your time & advice
> glen

1999\04\22@122556 by Dave VanHorn

flavicon
face
> ps: exercising my pester position in this list, I'd like to say that a
> 10 meters resistor is the biggest I ever saw, and that Mr. Volt would be
> revolted seen his name in lower case (240v). :)

Indeed, but a 10 meter long resistor should be pretty safe :)
What value to use though?

1999\04\22@130306 by Wagner Lipnharski

picon face
oh, I am sorry, I tought the device would has no human operator..., but
lets calculate, suppose the unit is wired to 240VAC via 10 MOhms
resistors, add more 200 kOhms for human body low resistance, the
possible current through the body would be just less than 24uA, the same
current that crosses your body when you touch directly a 12V battery or
AC wall wart, it will not kill you, but... :) ... use an isolation
transformer... even that thousands of old electronic equipment were
produced without any isolation, and they carry live AC Voltage,
sometimes the ground conductor is not even connected... I bet you have
some appliance at your home that you don't dare to touch its metalic
frame through a wire, while standing bare foot outside... :)

Wagner Lipnharski wrote:
{Quote hidden}

1999\04\22@173706 by paulb

flavicon
face
Dave VanHorn wrote:

> (transformers ok, they have multiple layers of insulation)

 Hmmmph!  I have distinct suspicions about many of the transformers I
see!
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...