LIFETIMER counts down until I die. I think it's set a little long -- scratch that, way too long. Assuming 2.5 billion seconds in a human life you can then string it out to the correct number of digits to drop the last digit every 1/4 second and that's easy to do with a 32.768kHz crystal.
This project is pretty much a case study in bad engineering.
It's meant as a tool to enhance my efficiency, so I wanted it done FAST and CHEAP.
Readers will remember a common rule in engineering and the world in general:
FAST, CHEAP, HIGH QUALITY : choose any two.
You can have it done FAST and HIGH QUALITY, but it won't be CHEAP.
You can have it done CHEAP and HIGH QUALITY, but it won't be FAST.
You can have it done FAST and CHEAP, but it won't be HIGH QUALITY.
Because I wanted this device done quickly, I...
Didn't feel like waiting for a 3.3V LDO regulator to be shipped, so I just wired the screen directly to the Li-ion cells and neglected to include a voltage regulator at all. The screen wants 3.3V and claims an "absolute maximum rating" of 4V. The lithium cells go up to 4.2V. But the screen still works so it's fine, right?
Didn't feel like waiting for a Li-ion charge control IC to be shipped, so I just hacked together a charger out of discrete parts. Is it safe? Maybe. By which I mean "probably not." It didn't explode when left to charge the Li-ion cells overnight, that's enough of a safety test. *issues Soviet stamp of quality reactor engineering*
Didn't bother to remember that the ATMEGA328P has internal pull-up/pull-down resistors for its pins and included pull-down resistors externally.
Glued the device together before I remembered to take a picture of the internal point-to-point wiring (lucky for me it all works, eh?).
Hacked together the code for the RTC part without bothering to read the datasheet enough to learn what each bit set in the example code did. That is, I blindly copy-pasted example code from various sources and made it into a seething chimeric mass which implements the functions I require. Bugs / unintended operation? Maybe. Not that I've seen yet but it's like the sketchy Li-ion charge circuit, it could explode any time...
Bought an OLED breakout from Sparkfun thinking their existing library would make it easy to work with. Surprise, their library is for Arduino only and I'm writing this in straight AVR C! I had to reverse engineer their header file for the OLED (should've just gotten the breakout-less $4 one if I had to work on it like that anyway) -- designed for Arduino -- and transcribe the critical functions to turn the display on and send it data. After a mere 12 hours of debugging I was able to figure out the command sequence required to order the OLED screen to turn on...
Then I wrote a font from scratch. It turned out pretty well I think.
The catch with doing things the fast/easy/sloppy way is that it takes so much more work!
Step 1: Absolute Maximum Ratings? More Like "guidelines" Really...
4v screen supply voltage limit "absolute maximum", so I hacked together a sketchy USB charger which wouldn't charge the LiIon cells above 3.8V using two 1N4004 diodes in series with a 2.5 ohm current limiting resistor directly off the 5V usb supply. This also was an opportunity to produce a new charge connector with three pins aligned in an L shape such that it is nonreversible. However the generation of new standards in any engineering endeavor seems inevitable.
Step 2: Soldering Tiny Things
30 gauge enamel coated magnet wire and very precise soldering!
I forgot to take a picture and then irreversibly glued the device together, sorry Internet I was in a hurry at the time.
30 gauge enamel magnet wire
3x momentary pushbutton switches
2x 1N4004 diodes
4x 1/2W 10 ohm resistors
3x 6.8k 0402 resistors
Parts from sparkfun:
2x 110mAh LiIon cells, protected
Oled screen breakout board
Tiny SMD ATMEGA328
Step 3: Hours of Software Debugging
When I bought the OLED screen I did only cursory research, thinking that because the comments said it would be easy to use that I could write a little code and be done.
As I found out...
The comments said it was easy to use for Arduino.
I had thought that because the Arduino platform was built on the atmega328p, that it would be easy to port code intended for Arduino into AVR studio 6, the IDE I'm using for this project. This is not the case. Arduino code can be ported to be worked with in AVR Studio 6, but the process involves a lot of shenanigans with library settings and capturing files mid-way through internal compilation in the Arduino IDE (and you have to have the Arduino IDE installed). I didn't feel like installing another IDE in order to just use some libraries...
It seemed like less work to just reverse-engineer the sparkfun library and rewrite the pieces of it I needed -- the bare minimum. After about 12 hours I got the screen to turn on. A little later I was able to figure out the memory arrangement and writing methods. The resulting code is on the github repository for this project here.
Step 4: The Purpose of LIFETIMER
The reason I am constructing the lifetimer is that I need a general mental loop breaker, and being reminded of the finite nature of a human life is a highly effective -- though harsh, from most people's perspectives -- way of forcing me to be in the moment, to appreciate my time in existence, and to work more efficiently.
It has come to my attention that we are as people in western society subject to a large number of external control mechanisms. Fear is the one most people have a name for. I have identified a more pervasive class of control systems which I would call "covet memes" -- by influencing others to desire (covet) various shiny and/or blinky things it becomes possible to control them, and the desire for things can be made to transmit among those who are in contact with each other (mimetic transmission), even though the available empirical evidence appears to suggest that humans' happiness is most strongly influenced by their surrounding SOCIAL ENVIRONMENT and not their economic status (except to the extent that they see others having more which makes them unhappy, the basis of transmission of the [covet meme] as a tool of social control).
Advertising companies are using a variety of methods to control us, and the US air force has released a paper describing how to control humans using social media. Or we could use galvanic vestibular stimulation to "painlessly" directly control humans. This and the constant advertising encroaching into every surface within our visual field make it so that it is virtually impossible to avoid being controlled by exerting individual agency from within yourself. For this reason I have decided to intentionally build an external control system for myself, if I'm going to be subject to a control system I want to be the one designing it!
My control system will comprise three main inputs. Collectivism. Sense of moral duty. Chaos.
Collectivism will be achieved by allowing others to issue orders to me directly (see picture). I have codified my sense of moral duty in the program UtilCalc V1.0 which may be used to calculate the relative ethical yields of various activities. Chaos will be used to control me because some % of it mixed in prevents external predictability which is a prerequisite for external control by others -- you need to accurately predict something's behavior to control it!
The code gives me orders based on switch bounce which are extracted from chaos itself.
In any case, at least in my own mind, watching a timer of my life decreasing immediately snaps me right out of the desire for more shiny and/or blinky things by forcing my perspective to one which perceives their transient nature and the way desire for more objects beyond those required to aviod discomfort detracts from introspection and self-understanding (which can be used to generate actual PERMANENT happiness in onesself).
The second component of the project was to have a hardware random number generator in the device which gives me instructions at random. This injection of chaos will help protect me from external control.