Notifications
Clear all

Implementing a safe unlock application

60 Posts
6 Users
6 Likes
1,027 Views
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

Hello, where are you guys based, I thought you were in the USA and with a nice time zone difference… ??? 😅

today I manage to have the deep sleep working using the keypad without the extra button. but not correctly.

what isn’t working is that I need to press two keys for each digit, example to enter 3699# I need to press 232629292# and it works

I haven’t  managed to make it work yet with pressing only one key for each digit and not two in a very consistent manner. I must be making a mistake or two somewhere. But I am not playing on this all day long, maybe an hour per day only, and not each day. I also have to spend time learning c++ and understanding how the 328p operates. 

I know about the voltage regulator as well as the led indicating the board is powered. I found a few videos about this. This is why I whished to use a 3.3v 8mhz version of the pro mini without voltage regulator and without the led. And my LiFePO4 3.3v battery.

using a button to wake up the board is probably more work than managing to make my current piece of software work. I have to change my code to wake up on INT0, use a timer to stay awake for say 5 seconds without going to sleep after the last key press. 

I made it work easily to wake un the 328P with INT0 or INT1 pins. However, as of now the cpu goes to sleep in between each key press otherwise I will need to change the code to loop until the code is entered AND in a time frame given before going to sleep. 

I have made it work with a mix of hardware solution and a modified version of the c++ code for the keypad to detect a high instead of the low when a key is pressed, this way I could use four diodes and connect them to int0… worked, but not 100% again… I missed keys but without a pattern so not easy to debug… 

the latest libraries for Arduino hw are for the esp32… This is why I wish to give the esp a try also. 

i wish however to understand where I am making a mistake in my code, I have an idea but won’t be able to test it before this evening my time… in 7/8 hours my time… 

Thanks again for your input. 

charles


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 959
 
Posted by: @papymouzot

Hello, where are you guys based, I thought you were in the USA and with a nice time zone difference… ??? 😅

🤣 Yes... insomnia will do that to you.  I'm in the Eastern (US) time zone.  I believe @zander is on the west coast of Canada... Pacific time.  Hopefully, he's still getting a few Zzzzzz's.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3403
 

@inq Up at my usual 530.

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3403
 

@papymouzot The Pro Mini is a retired product. Using a more modern board like the ESP32-S3 or Raspberry Pi PICO or any of the RP2040 boards will start you at a lower power level out of the box vs a 10 yr old technology. In the industry of micro electronics, 10 years is forever. As I pointed out earlier, the nerds have an excellent article showing the power consumed for each sleep mode. The specs say 5ua but practical experience says 10 or 20ua is achievable.

I don't recall seeing what your design target is but at 20uA you will consume 175 mAh per year. A CR2032 coin battery will last a little over a year and obviously slightly larger form factors like a AA size will last many years.

Good luck.

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

Hello, I left you without news for a few days, I had a mountain bike accident and I just left the hospital yesterday... I look like if I hit a train in the face... 31 stitches visible, nose broken in four places, lower lip completely damaged and reconstructed but I don't know how it will look like... My face is swollen with a mix of dark red, violet and blue.... I am however very lucky when considering the accident I had... I can walk no problem, I have both eyes intact... I will get lots of scares, yes, but not a wheelchair... My helmet was completely destroyed, my glasses too.. I was unconscious for over 15 minutes... my friends I was riding with where incredibly scared ! I was in a mountain ski resort nearby where I live, two hours by car and I won a helicopter trip to go to the hospital, only a 15mins ride 🙂 🙂 🙂

before that, I had an issue with my application, small maybe, I sort of bricked an Arduino Mini Pro board 5V 16mHz.

I loaded a program on it which still runs, and runs well, I have at the same time the keypad entries working and the deep sleep implemented, but probably too fast, I don't know,  it does accept key presses from the keyboard and reacts correctly to them but I can't load a new sketch onto it and the sketch which is running is incomplete for my "safe unlock application"

When I try to do so I get the following message:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

I have also tried to re-burn the boot loader using another Arduino board as ISP and it doesn't work either. (I have done it already with success on another board)

I looked on Google to find a reason for this behavior and hopefully a solution to my issue, but without success. 

If one of you has a solution, I'll greatly appreciate !

Today I am scared to continue testing with another Arduino board I have in case I brick it too, I have not received yet the ESP boards. I received a pro mini 3v3 8MHz but I need to solder the pins on it to test, and, in the meantime, I learnt that I can burn a boot loader on a 3.3v only with another board powered also under 3v3v... so to be on the safe side I need another one.... Well, not so much an issue at present.

I really would like to unbrick my 5v Mini Pro board and continue the programming of my application to find at which point it fails. Any help will be greatly, greatly appreciated...

à bientôt les gars !


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 959
 

OMG! - If that happened to me, I don't think I'd be back on the forum for months (or years).  That has to be life changing.  (The wake up call, not the actual injuries).  I hope you have a speedy recovery and can "get back up on that horse" if mountain biking is a passion of yours.  

You must want this safe mechanism pretty bad!

As I've mentioned before, I'm no hardware guru, so you might take it with a grain of salt... but when that kind of unexplained behavior, I assume its my hardware design and I take it all off and see if I've screwed up the MPU board.

Often in these cases (I only use ESP devices... not sure about Arduinos) there are some pins that MUST be in a certain state (HIGH/LOW) during upload and certain (possible other) pins that have to be in a certain state during boot.  If your hardware naturally brings them to the other state, your device won't load and/or won't boot.

Hope that helps.

Take care.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

Thanks Inq,

I tend to recover quickly normally, I never had such bad injuries on my face to date however... I will endup with a few scares for sure... the one I worry for is my inferior lip as it was hanging with only a small bit attached after the accident before they stitched it back in place, tomorrow I have another scan to check how my brain still copes with the little hemorragia I had in my head, this was the only "important" worrying bit... But, to be honest, although I am myself in sleep mode, I think I am not doing too bad...

I will check later again for the "Bricked" Arduino Pro mini, I am a bit tired now although it is only mid-day. The code on it still runs fine, it boots fine, I just can't reprogram it. I tried changing the boot loader as this operation bypasses the USB adapter if this was the cause of the issue.

I have spent my morning working on my "Safe unlock/lock keypad system" and at present it works,  but a few things I dislike.

1) I needed to add a minimum delay of 500ms after key entry and go-to-sleep mode, this was the reason I got strange behavior in my sketches before. I discovered this by chance to be honest.

2) The keypad management when sleep mode is used doesn't work with the latest keypad library (for Arduino UNO/Nano/Mini...) I had to use an old one with two tricks. I will write to the author of the library to have his views, his code is a bit too technical for my current programming level.

3) I need now to replace the relay board I have with another one (maybe mosfet) to be activated only when pin is HIGH. The one I have is actually activated when pin is LOW which isn't good for power consumption as I need to have the pin for the relay HIGH all the time and I don't want that.

4) I need to solder the headers on my 3.3v 8MHz Arduino Mini Pro I received to test with this one on a LiFePO4 battery with no leds on the board and no voltage regulator.... not now, I am good for a small nap 🙂 🙂 

 

 


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3403
 

@papymouzot OMG, that is unreal. Just take some time to get better, the safe will wait.

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  
5c8b2230 418d 4da3 9bff 3e36f4f70d17

Back from the hospital, another few weeks and I'll be like new 🙂 


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3403
 

@papymouzot First, I hope you are recovering.

As far as your project do a search on 'trigboard', or 'up time', or 'sleepy', or 'wake'.

Here are a couple I found

https://github.com/tstoegi/MicroWakeupper

https://trigboard-docs.readthedocs.io/en/latest/index.html#

PiShop for sleepy, and 'up time' solutions.

 

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

Thank you Ron, my visage is healing quite well, the worst thin is that I have terrible headaches which prevent me to do anything 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1476
 

@papymouzot

Posted by: @papymouzot
5c8b2230 418d 4da3 9bff 3e36f4f70d17

Back from the hospital, another few weeks and I'll be like new 🙂 

Fark... yet they say... helmets work!

Mate, take care, I really feel for you and hope you fully recover!

Cheers


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

Hello from the South of France, where it is still too hot and no rain...

I start to feel a bit better today, thanks god !

Yesterday I worked on my application and built on a test board with the hardware as it will sit inside the safe (Arduino min pro 3.3v 8mhz, Mosfet to activate relay, a dual color led, a connector for the touch keypad and a buzzer).

The code works fine now, I had two issues which have been solved using workarounds I am not pleased with. 1) it doesn't work with the latest keypad library, only with an old one 2) I need to have a delay of 0,5 secs in between each key press otherwise it doesn't work...

I have a few things left to do now, probably will do them this evening.

a) add code to check the battery voltage when password buffer is full and do something to indicate a battery low condition, maybe 10 beeps along with red led flashing. I can't do this at each keypress

b) add code to disable password entries for 15 minutes if wrong password has been entered three times, probably slow blink of the red led.

c) remove power on led from the Arduino

 

à bientôt !

Charles


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 959
 

Glad to hear you're recovering well.  I just had a thought, what happens when the battery goes out with the safe closed.  Is there some backup way of opening?  Apologies if that has already been discussed.  I might not have read every post along the way.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Papymouzot
(@papymouzot)
Eminent Member
Joined: 4 months ago
Posts: 24
Topic starter  

We havent discussed about this, I was extremely lucky when the original electronic board which sits inside the safe's door became faulty, I retrieved a few weeks later the backup key where it was somehow logic to hide it....22 years ago !!! 🙂

It took me a long time to open the safe with the backup key, there was a trick which I am not going to explain here, but the guy who designed the trick wasn't playing with a full deck...  I was very lucky when I found it...

 


   
ReplyQuote
Page 4 / 4