Text
Assignment 3 Demo
Sorry for the shaky cam, Mum was inspired by all the action movies that overuse it.
0 notes
Text
Assignment 3 Soldering
Soldering the circuit board for my physical computing assignment 3 took place over two whole days. Unfortunately this process was pretty difficult due to some unknown variables, the first being a faulty LCD screen from Jaycar. The way the I2C port extender is made, you basically have to solder it the LCD screen to test whether it works or not. You can hold the connections together but this usually results in poor connections and not very accurate results. Thus, after soldering the two components together and ripping apart the circuit board for three hours trying to find the issue, I finally realised the LCD screen was faulty. Thanks Jaycar. After getting a new one the LCD screen worked perfectly as intended but I still had another issue. Backlight control. Previously I looked at using a library to control the contrast and backlight of the LCD. Unfortunately, I could not get this library to work as intended and opted to finding out how to do it with potentiometers and the I2C. The I2C has the built in contrast potentiometer which works well enough so that was fine, but the issue was the backlight. Now i found one crappy video on how to do this which basically connects a potentiometer between the 2 LED pins on the I2C port extender. The issue was that manufacturers likely got cheap and took off the pins and just left the LED holes there soldered. Technically that's fine as you just have to unsolder them and re solder some wire and a potentiometer between the two. However, what is not shown in any diagram is that there is a tiny strip of copper between the two LED pins, shorting them and since the circuit board is black, you cannot see it at all. Eventually I found it and scraped it off to allow for the backlight control. For the rest is was somewhat smooth sailing, but yeah, just felt like ranting.
0 notes
Text
Assignment 3 Potential Iteration
So this is not an implemented iteration but something that I wanted to add that unfortunately I could not get the parts in time. Basically, instead of having a mode where the player has to manually move the board until it is level to set the current position of the stepper motors to 0, I would instead make use of two potentiometers. These potentiometers would replace the screws that mirror the motors on the board. What this would allow is first, a limit to how far the board can physically move as well as allowing me to track the position of the motors through multiple runs, something I found the stepper motors could not do easily if at all. Perhaps I’m wrong on that front but either way I just did not have time. Thus, we can connect the potentiometers to the board and track their position. A certain position, lets say about 512 on the potentiometer would be considering balanced. Thus, upon start up we would just have to move the motors until the potentiometers give the value of 512 to automatically balance the board. Of course there would likely be the problem of mounting the potentiometers and how the values they give not always being stable but I would much rather have an auto balancing feature than a manual one. Food for thought.
0 notes
Text
Assignment 3 Final Iteration
This is the final iteration of my code, that has all of the different functions / modes that I wanted it to have.
In terms of differences with the previous iteration, I changed some of the variable names along with adding additional comments where needed. My electromagnet actually arrived on time so I was able to implement that quickly into my code. I also added a time limit of 9:59 to the code to stop games from going on forever, this has its own function. I also had to add some resets of variables and clearing the LCD in places to allow for multiple playthroughs of the game. All that I have to do not is solder the circuit board together, take pictures and film it all and submit.
0 notes
Text
Assignment 3 Iteration 15
In this iteration I’ve mostly cleaned up the code while fixing a few errors that I was dealing with. This mostly came in the case of variable names and general formatting. I also tinkered a bit with the motors to get them working how I wanted them. As well as this I also worked on the timings of the text displayed on the LCD for the different functions / modes that utilized it.
0 notes
Text
Assignment 3 Iteration 14
In this iteration I’ve added the state that I have called Check. This state is run at the game is started or whenever the player goes back to the home page. What check does is send bytes to processing to check whether processing is connected. If processing is running and connected then it will respond to these certain bytes by sending back the same certain byte. If Arduino ever receives this byte that means we can confirm that processing is connected and thus, allow the player to be able to submit their time and name to the leaderboard.
Along with this I have made the entire leaderboard on processing and its different features. This is done by using the loadStrings function and a text file to store the different times. The text file is opened and the scores within the file are then loaded to a string array. This array is this printed onto the leaderboard. I have also used a custom arcade font, just cause its cool ;). Upon receiving a new time and name from Arduino, along with the respective identifier bytes, processing passes these through a couple sanity checks to check whether the new time makes sense or not. If it passes through the new time and the old times on the leaderboard are then appended to a new string array which is then sorted. In the case of there being more than 10 times, the string array is then shortened to keep it at 10 scores. The file is then updated and the file is reloaded to update the leaderboard graphic.
Along with this the player can also press R to reset the leaderboard. Upon pressing the R key the player will be asked to confirm their decision and if so the file is cleared. The next part I’ll be working on cleaning up the code again for the last iteration, being the final version.
0 notes
Text
Assignment 3 Iteration 13
In this iteration I’ve done some cleaning of the code and reorganising different components within it. I fixed the start state with the blinking LCD which was not working exactly as I wanted it to before. I’ve added the feature that you can go back from finalisation of your name to entering it, as well as being able to go back from the balance stage to the starting stage. I’ve also began to lay out the foundations for the connectivity with processing, testing how to write the name and the time of the player to the Serial Monitor. I’ve also thought of adding a feature that only allows you to enter your name to submit your time to the leaderboard if processing is connected, as there is no point entering your name if you cannot submit it to the leaderboard. This will be done by sending a certain byte that when received by processing, it will respond by sending a certain byte as well. If Arduino ever receives this byte that means that Arduino is connected and thus, we can allow the player to enter their name.
0 notes
Text
Assignment 3 Iteration 12
In this iteration I’ve add both the timer and the name input into the game. When actually starting the game to play it, the LCD will now display a timer. Again, since I cannot use delay as that will stop inputs from going through, I have instead opted to make use of millis again. Basically, every 1000 milliseconds or 1 second the seconds signed short will increase by 1. Once seconds get to 60, 1 will be added to the minutes. To be able to display the seconds and minutes variables on the LCD screen, I’ve had to use sprintf(). Basically how sprintf works is that it allows you to print out variables into your string. This can be seen down below.
Upon finishing and pressing the button to stop your time, the LCD will display your final time. Pressing the button at this point will allow you to input your name. This is down with one of the potentiometers being mapped to a value between 65 to 90, corresponding with A to Z. This value is then displayed on the LCD and upon pressing the button will confirm that character selection. However, what if you accidentally confirm the wrong letter. Well do not worry because you can undo your selection with the other button. You can enter a 3 character name and upon selecting the final character you will be asked if you want to finalise this as your name for the leaderboard. The next thing I need to work on is how to send this to processing and make a leaderboard.
0 notes
Text
Assignment 3 Iteration 11
In this iteration I’ve changed multiple things. In terms of the home page with the flashing title screen, I initially was making use of delay to blink the LCD text on and off. The problem with this is that within the delay time frame, if either of the buttons are pressed they just do not register. To combat this, I’ve opted to use millis instead which is fairly easy. This is in contrast to my begin state where the player will wait 3 seconds before their game begins. Within this time frame the LCD screen will display the classic on your marks, get set, go. I can just use delay to get the timings for this sequence as there is no reason for the player to be pressing either of the buttons at that point of time. In this sequence as well, instead of just having go as two singular characters on the LCD, I have instead made two custom characters for both the G and O. Both the G and O have 4 custom characters each, increasing the size of them from a singular character each to four each. This works by controlling each of the pixels on and off to make your own character.
Along with this I have also attempted to make some form of contrast control for the LCD screen. The problem with the I2C port extender module on the LCD is that it has its own built in potentiometer for the contrast control. This would mean that the player would have to flip over the whole circuit board and use a screwdriver to change the contrast of the LCD. Since this is not exactly easy to access, I have attempted to use the Kicad custom library to handle the contrast and backlight control programmatically. This would allow me to use the already present potentiometers to control both the contrast and the backlight. I have not had much success with it yet and have only created a game state for the settings of the LCD screen, but I will continue to look into this in the future. My next step is to implement the timer when the game is running and being able to enter in your name to store your time on the leaderboard.
0 notes
Text
Assignment 3 Iteration 10
In this iteration I’ve added the LCD screen functionality to the home screen of the game. Due to not having enough output pins for the LCD screen due to the stepper motors, buttons, LEDs and magnet using the majority of the output pins I’ve had to opt to use the I2C port extender module. This basically allows me to use 2 analog pins (A5 and A4) to display text on the LCD screen rather than using multiple output pins. There means I do not have to lose any other features or parts that I wanted in my game. To do this I had to implement the LiquidCrystal_I2C and the Wire libraries. These libraries are basically what allow mean to make contact with the I2C module and display text of the LCD screen. To do this I need to initialise the LCD screen, which automatically finds which analog pins the I2C is connected to.
From there it is pretty simple and just a case of initiating the LCD and using the setCursor, print, display and noDisplay commands to operate the LCD. In this version I just have a blinking home page saying “Welcome to The Labyrinth”. However, in future iterations I will be fully utilising the LCD screen. In my next iterations I will start fully fleshing out the use of LCD screen.
0 notes
Text
Assignment 3 Iteration 9
In this iteration I’ve added to the sequence of the game. The LCD screen is displays more text depending on what stage in the game the player is in. Along with this, it has a ready, set, go section that also links up with LED lights. This is not shown in the video due to the lack of breadboard space, but a red, yellow and green LED will light up in sequence the same race lights work. I’ve also fixed the motors. Before I had an issue that the motors would work for a couple seconds then stop completely. This was due to the 9V battery that I was using potentially did not supply enough current. By hooking up the motors to the Arduino power supply instead the motors work well but there is a problem with them being quite slow. Another problem with hooking up the motors with the Arduino is that if they take too much current they can burn out the Arduino. Thus, in the final version I’ll likely power the motors from an external power source if possible. The next step I’ll be working on is fine tuning the motors and LCD display.
0 notes
Text
Assignment 3 Iteration Eight
In this iteration, I’ve added a LCD display to the start of the game. Typically to set up an LCD display you need to use six output pins. The problem with this is that I only have 14 output pins. 8 of these are needed for the stepper motors, 3 for the LEDs, 2 for the buttons and 1 for the magnet. So I’m already using all of the output pins. To solve this instead of using the typical method of wiring up the LCD display to the Arduino I instead use a I2C. An I2C port expander allows me to solder this to the back of the LCD display and then wire the LCD display to the Arduino with two analog pins. This is done by using the LiquidCrystal_I2C library. At the moment I’ve just got the I2C aligned with my LCD on the breadboard, but near the end I will solder the two together. The next part I’ll be working on is the contrast and backlight control.
1 note
·
View note
Text
Assignment 3 Cardboard Maze
This is the current design of the maze that I will be using for my physical computing final project. There are a couple issues with it at the moment however. For some reason while the stepper motors work completely fine when not connected to the maze, when connected they move for a few seconds and then stop working. Not sure whether this is an issue with my code, the motors torque or the driver. I’ll have to do some testing of this to figure out the problem.
0 notes
Text
Assignment Three Iteration Seven
In this iteration, the play mode has been added. It starts off until he start mode which currently just has the green LED on. On pressing the first button this changes the game mode to balance, which allows you to set the balance of the stepper motors and had the orange LED on. Once you have balanced the board, you then press the button to start the play mode. This gives you control of the stepper motors without a dead zone so the game completely depends on your balance of the board. It also has the red LED on. The next aspect I’ll begin working on is the LCD screen for the start of the game.
0 notes
Text
Assignment 3 Iteration Six
In this iteration, I have begun working on the different sections of the game. The starting section basically just disables the stepper motors so they cannot be used, and the LED screen will have some form of text on it. I cannot work the LED screen just yet as I am getting the port expander module for it later today. However, on pressing the start button, the more will change from start to balance. Since stepper motors cannot remember what level is, in this mode the player will move the board until it is level and then press the button to play. With the potentiometer you are able to turn the stepper motor towards and backwards. There is a dead zone between the values of 461 and 561, that you can turn the potentiometer to so the motor doesn’t move. A possible way of doing this automatically in the future would be to save the steps from 0 that each motor made to EEPROM. Then when the game starts up, based off these values the stepper motors move the reverse amount to end up level. The problem with this is that EEPROM has a limited amount of uses, and I was already thinking of using this to store leaderboard values. I may still look into this in the future. The next part I’ll start working is the actual game.
0 notes