As Borat would have said, Great Success!
Firstly I had some trouble with decoding the signal from the rotary dial. It triggered the interrupt function (ISR) in the code in weird ways. The principle behind the rotary dial is that you wind a spring up when you turn the wheel and when you release the spring pulls the dial back. On the way back there is a breaker inside the mechanism that makes a connection everytime you pass a digit. So for example an 8 would be a squarewave-package with 8 falling edges (starting and ending in HIGH, in my case 5v).
As you can see on the picture here the bounce was clear when showed on the scope:
![](https://cdn.hackaday.io/images/5136911523255684828.jpg)
It was solved with a software debouncer.
I then was able to read the digits and write code for dialing a code.
There is still a lot of improvements needed in software for special cases and so on but this is the first time I can enter a code and make the box open.
The sequence below goes like this:
- Log any digit entered
- If there has been 4 digits entered, check if those 4 is the correct code
- if yes, open the box
- then leave the box open until you push the "edject" button
- close the box
- reset the code
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.