stickman007

DIY "no-slam" Circuit?

30 posts in this topic

This is the proposed wiring schematic. The GPIO pins will not match the above programs (yet), but they will once I can merge the 2 programs together.

 

NoSlamOneTouch Schematic.001.jpeg

 

In addition, I'm going to try and 3D print some connectors in attempt to make a pigtail so everything will be plug and play.

 

 

2 people like this

Share this post


Link to post
Share on other sites

Hardware prototype done! Software loaded...will plug it in to test. With the current setup, the module will be in the car near the SAM, and a 4-wire harness will be plugged into the window switch via an adaptor pigtail. The door grounding signal will be pulled from the SAM unit. No soldering or wire cutting.

 

FDF77E81-703D-4FE1-8379-67B9AE9F1524.jpeg

2 people like this

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Decided to hook up the module to Red Pxl today...nothing caught on fire...hahahaha!

 

But the board didn't work. The input signals weren't reading correctly and later was traced to a bad batch of relays. All 4 of my 5v relays were duds when bench testing them. I used relays to step down my voltage from 12v to 3.3v for sensing input. Didn't have any optoisolators or the proper resistors to make a voltage divider. Just made an order on Aliexpress...guess will update on progress in about a month when the stuff shows up?

 

Edited by stickman007
1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Still no sign of my Aliexpress order...they haven't even shipped anything yet. But, I did finish drawing my schematic and lined it up with my python code so here they are for those who want to try and put something together.

 

NoSlamOneTouchSchematic.jpg

 

import RPi.GPIO as GPIO
import time

downIn = 11
upIn = 15
downOut = 12
upOut = 16
doorIn = 13

def setup():
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(downIn, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(upIn, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(downOut, GPIO.OUT)
    GPIO.setup(upOut, GPIO.OUT)
    GPIO.setup(doorIn, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def one_touch():
    while True:
        if GPIO.input(downIn)==GPIO.HIGH:
            print('Window going down')
            start = time.time()
            time.sleep(0.2)
            while GPIO.input(downIn)==GPIO.HIGH:
                time.sleep(0.1)
                length = time.time() - start
            if length > 1:
                print('One-touch activated')
                GPIO.output(downOut, GPIO.HIGH)
                time.sleep(4)
                GPIO.output(downOut, GPIO.LOW)
        if GPIO.input(upIn)==GPIO.HIGH:
            print('Window going up')
            ustart = time.time()
            time.sleep(0.2)
            while GPIO.input(upIn)==GPIO.HIGH:
                time.sleep(0.1)
                ulength = time.time() - ustart
                if ulength >1:
                    print('One-touch activated')
                    GPIO.output(upOut, GPIO.HIGH)
                    time.sleep(4)
                    GPIO.output(upOut, GPIO.LOW)
        time.sleep(0.5)

def no_slam():
    while True:
        if GPIO.input(doorIn)==GPIO.LOW:
            print('Door is opened')
            GPIO.output(downOut, GPIO.HIGH)
            time.sleep(1)
            GPIO.output(downOut, GPIO.LOW)
            GPIO.wait_for_edge(doorIn, GPIO.RISING)
            print('Door is closed')
            GPIO.out(upOut, GPIO.HIGH)
            time.sleep(1.5)
            GPIO.output(upOut, GPIO.LOW)
        time.sleep(1)

def destroy():
    GPIO.out(downOut, GPIO.LOW)
    GPIO.out(upOut, GPIO.LOW)
    GPIO.cleanup()

if __name__ == '__main__' :
    setup()
    try:
        one_touch()
        no_slam()
    except KeyboardInterrupt:
        destroy()

 

For those who don't want to type the whole thing, here's the python file.

NoSlam-OneTouch Program.py

Edited by stickman007
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

    Chatbox
    You don't have permission to chat.
    Load More