Post about your Basic project here

Moderator: Mmiscool

User avatar
By ardhuru
#56663 After a lot of help from the great folks on this forum, my door opener is ready to be installed. Here are a few features:

1) 5 digit code (can be changed over Wifi, IF you have the router password AND the ESP login password) to open the door.

2) Monitors status of the door, graphically.

3) Audio cues for keypad entry

4) Show the temperature, and uploads it to Thingspeak. WHY, in a garage door opener?? Well, why not? The hardware is already there, and I happened to have a spare DHT lying around.

The Android app for the keypad is done in Basic4Android (B4A).

Still a bit rough around the edges, but seems to do whats expected of it.
You do not have the required permissions to view the files attached to this post.
User avatar
By Electroguard
#56705 It certainly looks to be a well thought out and potentially useful project, so hopefully is more than a boast and will be shared. I especially like its potential as an Esp_Basic user interface offering clear intuitive graphical feedback - presumably slight modifications might offer control and feedback of lights and PIR alerts etc?

Never heard of Basic4Android, so had a quick look, but not very keen on their sales policy... the more honest flip-side of a $59 product with 2 months free upgrades is $59 for something that will not be supported after 2 months (but even returnable hardware is supported with 1 years warranty), so is it something an old duffer might consider money well spent?
User avatar
By ardhuru
#56785 A boast?! No, just a desire to thank everyone without whose help I could not have finished this. Also, this will need to be polished a lot more till I'd consider it boast-worthy ;)

Anyway, here we are;

Code: Select alldim msg(6) 'Array for incoming password entries
relay = 0 'Relay on gpio.0
led = 3 'Led on gpio.3
switch = 2 'Door switch on gpio.2
dht.setup(11,1) 'model, pin1
timer 1000, [blipLED]
interrupt switch, [shutter]
button "Exit", [Out]
dlay = 1000 'Time the relay would be on
io(po,relay,0)
pwd = read.val("myfile")
udpbegin 5001

n = 1

[begin]
udpbranch [udpreceived]
wait

[udpreceived]
msg = udpread()
'UDPREPLY msg   'Acknowledge BACK to sender
'delay (50)           'for keypad beeps
if msg = "Clear" then
    n = 1
    UDPREPLY "Password?"
'    print "Clear"
    goto [begin]
endif
'UDPREPLY n
If n = 1 then UDPREPLY "*"
    If n = 2 then UDPREPLY "* *"
        If n = 3 then UDPREPLY "* * *"
            If n = 4 then UDPREPLY "* * * *"
                If n = 5 then UDPREPLY "* * * * *"
   
msg(n) = msg
'print n & " " & msg(n)

if n = 5 then
msg = msg(1)*10000+msg(2)*1000+msg(3)*100+msg(4)*10+msg(5)

if msg = pwd then
UDPREPLY "right"
io(po,relay,1)
delay (dlay)
io(po,relay,0)
UDPREPLY "ledoff"
else
UDPREPLY "wrong"
delay (dlay)
UDPREPLY "ledoff"
endif
n = 1
goto [begin]
endif

n = n+1
return

[blipLED]      'Flash the LED, and read the DHT sensor and upload to Thingspeak            
io(po,led,1)
                 
delay 1         ' (blink and you miss it!)
io(po,led,0)
    t = dht.temp()
    h = dht.hum()
    c = c+1
   d = d+1   
'                    print t & degree
        UDPREPLY " " & t
                   
        if c = 15 then
        c = 0
        thing = t & "&field2=" & h
        sendts("XXDF54BWWFYXXXXX", "1",thing)
endif       
goto [begin]

[shutter]      'Got here because door switch changed
if io(laststat,switch) = 1 then UDPREPLY "open" else UDPREPLY "closed"
goto [begin]

[Out]            'Enables interrupting program and access main menu
Exit


B4A is considered an excellent product to develop Android apps, and is considered to be fairly easy to use, specially if you're used to VB. I'm not, so I'm still learning.

I agree with your observation about their pricing strategy, however. I purchased their version that had a 2 year upgrades support, and I got a decent price thru' a referral. I can live without the updates after that, I guess.

On the ESP8266Basic side, just configure your ESP to work as a station and connect to your router in the settings page, define a fixed ip of 192.168.1.250 (also in the settings page; the B4A app is written to work with this ip) and no more credentials will have to be defined in the code.

The password file 'myfile.dat' is a simple file with a 5 digit number, and has to reside in the \data folder in the ESP spiff

The hardware is so simple, I guess a schematic isn't really required. Anybody needs any more information, just holler!