6th January 2019 at 6:52 pm #6294
1) intro music when you start it up (plays one time)
2) 2 button action controller
3) sleek breadboard and wire nest design
4) gigantic pontentiometer for screen brightness
5) HD™ display*
6) 2kb!! of SRAM
7) 32kb!! of flash memory
8) NO solder! Only friction or tape!
*HD = hardly defined
It’s “5” cause I have easily made 4 pieces of shit before this. I know you are excited. I’ll keep you updated.
10th January 2019 at 11:22 pm #6304
I finally got some better wires and was able to clean up the circuitry a bit. I know, you are probably looking at that and thinking “Gypsy, is on crack. There are wires all over the place.” Well, the only wire mess are all the wires going to the arduino. I can’t use flat wires to make those connections, and I want lots of slack so I can move things around without pulling anything. All connections that are on the same board have been replaced with the better bridge style wires. 17 wires in total have been replaced.
Honestly, I have to give it to arduino. I probably should have blown this board up like 100 times over and I amazingly haven’t. When I did the rewire job I realized that I had some huge issues regarding the volume knob and piezo speaker. I have no idea how I didn’t fry this board and even more so the LCD display, long ago. I’m going to blame a confusing wire mess on my shitty circuit job but, in reality it’s probably more the fault of being a noob. However, I know it’s correct now.
I also started to rewrite the entire code. I found all functions that do just one thing (and always will … like temperature()), cut them from my script and pasted them in a new script. I then started writing the code from a different mentality. Much of the code was written to supply a need but, as things are progressing those needs are being repeated. The new mentality is very simple:
1) I need a dynamic function that can handle ALL vertical scrolling menus (done)
2) I need a dynamic function that can handle ALL horizontal scrolling menus
3) I need a dynamic function that can handle ALL matrix menus
4) I need a menu system where I can dump in a “menu descriptor” and the rest is taken care of
Once I get all of that out of the way this will all go much faster. I’m working on every end of the spectrum for this project (electronics and code) and from an arduino aspect I am new to both of those things. Just the LCD display alone has a datasheet that is a whole fucking lot to take in. Add in the arduino, arduino’s version of C and my “seat of my pants” version of creating things, and I basically have no fucking clue what’s going on. It’s just true. That’s where today came in. Instead of just making things to death the wrong way, realizing it and then trying to fix the one realized part … I sat down and actually took some time thinking about: “what is this, and what does it need on the most basic level?” The four points above are the answer to the second part of that question. Regarding the first part of the question: It’s a currently useless thing that is helping me learn a lot of useful things about how to work with all of this stuff. It won’t be a useless thing for much longer though. While I was asking myself questions and answering them I really thought about “What useful things could a small device with an lcd screen do?” and “What other parts do I need to make it do those things?” I have a very large list of ideas and I intend to prune it down to 5 or so.
You have to start somewhere. Ya know? I believe that even if that somewhere is essentially nowhere, once you get some decent groundwork laid you can take whatever you have and modify it to have a more definitive and useful purpose. Regarding this project, in regards to my more recent considerations I haven’t done anything wrong. Everything I have learned, thought about and/or tried has brought me to the point I am at now. What started as something that would tell you the day, time and atmosphere as-well-as have a few very shitty games has laid the groundwork for a whole series of small devices that require a simple display, menu system and database. You have to start somewhere.9th January 2019 at 10:50 pm #6302
Today was a code clean-up and research day. I did work on some new features but, mostly I just went over and over the code ~ getting variable types as small as possible, making functions more dynamic, reconsidering which variables could be reused, adding some comments, reorganizing the code into sections … etc, etc.
I worked on the display a bit and changed some things about how you input your name. I didn’t like the AaBbCc… way. I have plenty of buttons to spare so I rewrote the code differently. The 4 icons on the bottom row correspond to the 4 buttons on the controller. From left to right ~ Undo, Save, Character Case and Select. Pressing the character case button turns all the characters to the opposite case that they were and changes the icon to reflect the case it will be if you press the character case button. I intend to keep reusing that icon correspondence system, and arrows will always mean analog stick directions. I know my icons suck but, I have a 5×8 grid to work with and the icons are all 5×5. Pressing save will automatically pop you back out to the main display and save your name if it’s different than what you already saved. Speaking of that, it is a hard save. Apparently, even uploading new code to the atmega328 chip does not overwrite the EEPROM. That’s awesome! The less it gets written to, the better.
I learned a bunch in my research. One thing I learned that impressed me is: INPUT_PULLUP for a pinMode means I don’t have to add resistors to whatever is in the pin. Using that constant tells the arduino to use it’s built-in resistors. I’ve been using INPUT_PULLUP this whole time and thought it was a more specific state than just INPUT, OUTPUT. I also learned how to properly work with the EEPROM. I was using simple read/write and doing my own checks if what was being written is different than what was already there so I don’t just burn up all the writes. You are only guaranteed 100,000 writes on an atmega328 but, if you don’t turn the device off and on a lot you can get about 3 million writes. I learned a bunch of other stuff but none of it applies to this project yet so, no use to really write about it.
This sketch is getting big. I fold all the code in the editor so it isn’t too bad. Actually, that is the only reason I am using enums instead of #define ~ so I can fold more code. Once I am positive I am finished making icons I am going to write them all to the EEPROM and I will be able to delete that entire array from my code. Then I can simply change the values in the Icons enum to EEPROM addresses and point the printIcons function to the EEPROM.8th January 2019 at 11:46 pm #6300
I did a bunch today. I added a volume control for the speaker. I added a sensor for humidity but it ran like total shit so I removed it. I decided that 4 buttons isn’t enough so I added an analog joystick (a really really nice one). I rewired some of the board because some of the GPIO pins could be used better by rearranging what was using it. I worked on the name save feature. By nailing down that feature making other features like setting the clock, alarm, date, etc will fall into place at their core,
Speaking of that (name save feature) I wrote an incredibly confusing function like 20 times before I finally got it right. It all started with selecting letters from an inline letter list. My initial idea was to just write all the letters in an array but, I knew that was a bullshit way. I made it that way anyway at first so I could at least flesh out the display. Once I got the display fleshed out I looked up the character map for the display. Uppercase letters start at byte 65. OK, no problem there. I rewrote the code to figure out which of the 26 characters are selected and simply add 65 to it. Simple. Then I decided that I wanted to have lowercase letters too. Lowercase letters start at byte 96. Now we have a problem.
I wanted the display to show 14 characters at a time and moving the analog stick left or right would scroll the character list accordingly. I also wanted the character list to alternate between upper and lower. Like:
AaBbCcDdEeFf … etc
This was a fucking nightmare. I had a lot of really bad ideas on how to correctly populate and grab from that list. Upper and lower start at very different points (65 and 96). I finally figured out a method that doesn’t suck.
c = !((lo+i)%2); b = (lo+i)%52; b = ((!(b%2))?b/2:b-ceil(b/2)); lcd.write(byte(b+((c)?65:96)));
I know there is no way to easily figure out what that says so I will quickly explain it.
c is a boolean to determine if the current character is even(uppercase/true) or odd(lowercase/false)
b firstly is set to the current letter offset and forced to a range of 0 to 51 (cause 26 letters * 2 (upper/lower))
the next line is where it gets really confusing. If b is even cut it in half else subtract the ceiling of half from it. Why you may ask? Consider this:
We have 26 possible letters but 52 possible characters. Lets say that the current character is 6 BUT we are going AaBbCc so 6 needs to be 3 and 7 needs to be 3 too! In other words, b is trying to determine where it is in the actual alphabet … not the character list.
Uppercase -> 6/2 = 3
Lowercase -> 7-ceil(7/2) = 3
Once we have that out the way it gets real simple. If c is true (uppercase) add 65 to b else (lowercase) add 96 to b, and we end up with all the proper letter display. I guess I could have just (b-1)/2 for lowercase but, that is far too simple for me to figure out. I created a whole table of how all these numbers would fall (up to 9) and simply subtracting 1 never crossed my mind til I started typing here. I had all this..
0 | 0 1 | 0 1
1 | 2 3 | 1 2
2 | 4 5 | 2 3
3 | 6 7 | 3 4
4 | 8 9 | 4 5
where the left are the numbers I need, the center are the numbers I am going to get and the right are how much I need to get rid of, respectively. If we read the center-left and right-left it’s obvious that everything is half. Looking at the center-right and right-right we have problems (lol). Problems that apparently could have been easily solved with (num-1)/2 but, I definitely wasn’t seeing that. I saw that dividing all those numbers in half would give me a decimal below the number I need to subtract so throw a ceil on it and call it done.8th January 2019 at 12:09 am #6298
I did a decent amount today. I wish I would have done more though. My code was a total mess and I spent quite a while cleaning it up. I also made some functions more dynamic so they could do what they already do but, to more than one thing.
I made a menu system. Pressing A or B scrolls the menu up/down. Right now there is only name, clock, alarm and date. None of that actually does anything yet, though. I used the up and down cycling of the menu to make sure there is no button bouncing. It took a bit to make a system that could handle any button. My logic is very different than the debouncing code found in various arduino tutorials. I fixed bouncing with 2 lines of code. However, I had to write like 20 lines of code and do a bunch of tests with Serial output to get it down to those 2 lines.
The main screen looks like the below image. Imma dump the “logo” altogether. It can be printed on the case. Under the temp will be time. On the left upper side will be a compass coordinate for whatever direction the Piezo-S41T is facing and the bottom left will have the date.
Aside from all of that, I took a hardcover art book and screwed the arduino to it, as-well-as used thumbtacks and heavy-duty safety pins to prop up the display board. The controller board is just sitting on the book. I got sick of the super thick usb cable pushing the arduino all over the place and the old way I was propping up the display was always pushing itself apart. All the development at this point (til some parts come) is code related. How I have it currently set up makes it very easy to test new code.
I tried to write a C library so I could move some code out of my sketch. I should probably go read a book on C cause it was an epic fail. Arduino C supports some stuff that regular C does not and I’m not sure what the alternatives are for the C way. I’m not sweating it. A good day or two doing some research and I’ll know everything I need to know. I wrote my .h and .c files properly. No problem there. The only errors were an unknown type. Apparently arduino is defining that type somewhere. If I figure out where, I can probably just include their file and fix my code.6th January 2019 at 10:53 pm #6295
I’ve done a lot more to this in just a few hours
I found a library that allows me to turn any pin into an interrupt so, I was able to add 2 more buttons (select and start … basically). I added a thermistor and created a function for temperature (farenheit). I tested it with a real thermometer. It is very accurate. I can easily add a clock but, I need to spend some time writing a few functions so you can set it. I changed the name to Piezo-S41T (Piezo S Forty-One T or PS-41-T for short), which is still “piece of shit” just more “cleverly” disguised. I upgraded some of the electronics to be a little better (like adding resistors to buttons and a few other minor things). The potentiometer is a 10k resistor and it seems like about half way gives the perfect brightness/contrast so, when I get a 5k resistor I am going to place it inline on the backlight positive lead and see if I can dump the potentiometer.
I ordered a Teensy which is way more powerful than an uno and much smaller. I also ordered a 4×16 lcd display (cause I want to keep this retro). I also ordered more passive piezo buzzers. I only have one but, I have some pins left and I want 2 independent channels.
I know this thread seemed like a joke but, It’s not a joke, aside from the fact I will obviously not leave all this on breadboards. I don’t have a 3D printer yet and I will probably wait til I have this prototype complete before I get one. I can see what this will look like in my head. It actually won’t be a piece of shit, at all. I have some more ideas for features that require parts I either do not have yet or I have a version that is too big. For now I can work on the operating system. There is a lot to do.
I fully intend to complete this device and attempt to sell it. True members of this site (ie members that actually participate) will get one for free. You will have your very own Piezo-S41T to wow your friends with. Maybe I can even make a limited edition “quake” case for y’all but, that is way down the line.
You must be logged in to reply to this topic.