This is my first real time delving into trying to understand bitwise operators and shifting bits.
This project is really helping me understand it better as I am using some bitwise operations in this program (it wouldn't be the Tiny Bit Machine otherwise!).
I was having an issue with toggling the least significant bit in a byte. Eventually I figured out to just XOR the bit. When I was trying to OR if new bit was 1 or AND if new bit was 0, which worked fine on bits 0-6, but when toggling the LSB, sometimes it would flip the bits in entire byte in a strange way... still haven't figured out why but now that is working correctly.
Now the deepsleep registers work, can put the device in PWR_DOWN_MODE for 1-8 minutes depending on the specified register.
The device will also go into power saving mode indefinitely if VCC voltage drops below 2 volts. I chose 2 volts because the LED are pretty dim after this, and if the device was left on and the user has not saved their program, theres a better chance of picking it up before the voltage can't run the device.
I will have to test how long the device will run in the power saving mode after low voltage is hit.
The buttons are fed by a 20k resistor, so that adc pin is always pulled high through that resistor.
The VCC adc voltage is fed through a 100k resistor.
Should be pretty easy to calculate power consumption of those two external pullups.
The attiny85 is actually deep sleeping for one second, then incrementing a counter until the specified time has been reached.
When in deepsleep for low power state, it does this and rechecks voltage every minute.
I was able to punch in a simple blink program and run it on the device. I can't imagine anyone writing a very long program on this, its very tedious. I have to have my printed sheets of op codes by me and keep referencing them while writing a program. Even then i got two bits in seperate bytes wrong and had to step through the entire program to find where the error was.
The ability to write functions on the device will really come in handy.
Once I have the code finished and polished up I will post on my github. And once I know the device hardware doesn't need anymore modifications i will post full schematic and parts list in case anyone wants to build their own. As well as a pcb design which would make assembly 10x easier.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.