11/8
Today, I made a sketch of my project and programmed the basis for the software component of my project. First, I used notability to draw a rough sketch of my project in order to clarify my goals. Below is a picture of that sketch. Also, I used Python to program a flask-application that hosts a website on the local server. This website will allow users to change the timezone on the clock and schedule certain tasks to happen at different times. Below is a snapshot of some of the code.
11/9
Today, I finished programming the website-based system for the clock. Now, HTTP-requests can be used to send signals to the RaspberryPi either from a website hosted locally or HTTP-requests on the local network. Once the hardware is complete, I will implement turning the clock hands to correspond to the requests/settings.
11/11
Today, I began to configure the RaspberryPi. I connected it to WiFi and allowed SSH communication. SSH communication allows the RaspberryPi to be controlled remotely from a different computer. Now, I can upload Python programs to the RaspberryPi and run them.
11/12
Today, my computer was updating all class. I was unable to work on programming or design, but I planned out my project in more detail on notability. A picture of my work is below.
11/15
Today, I completed my design for the laser-cut portion of the clock and engraved/cut it on clear acrylic. First, I designed the clock using a software known as "CorelDRAW." I first imported a picture of the roman numerals of a clock and traced a bitmap. Bitmap tracing converts raster (pixelated) images to vector images. This, I drew the other circles. In order to have some lines vector cut and others raster engrave, I set the two red lines to hairline thickness. I only colored them red to clarity. Then, I laser cut it on cardboard as a test. Because I did not set all of the lines to hairline the first time, some of the lines did not cut (picture on the left). Then, I tried again and it worked extremely well (cardboard on the right). Finally, I changed the settings to work for acrylic and it turned out very well (acrylic on the right).
11/16
Today, I worked on designing a case for my clock that holds the electronics. First, I looked at the dimensions of my clock in CorelDRAW, converted it from inches into millimeters, and created a circle with the same dimensions. I sketched the holes and extruded them though, as well. Then, I changed the material to "glass" so that I can grasp an idea of what the final design will look like. Next, I designed a case around the clock, made a lip for the clock to sit in, and designed a place for the RaspberryPi. I used the "shell" tool to create the hollowed-out box shape for the RaspberryPi holder. After I finish this design, I will 3D print it.
11/17
Today, I both finished the design for my clock case and attempted to 3D print it. I added a place for the RasberryPi which has a wholes so that wires can connect to other components. Because the design was too large to fit onto the printing bed, I split it into two pieces and added connectors on the bottom. Then I decided to print it, but first, I needed to convert it to gcode (instructions that the 3D printer can understand). I printind the left half of the design first, and it barely fit on the printer. When I sliced the file, though, it said that it was too large. This was because it added a "skirt/brim" to the outside of the design. This is when the 3D printer draws a circle around the design before printing to eliminate any filament that is stuck on the nozzle. I turned of this setting in PrusaSlicer, and I was able to export the gcode. Seven hours through the eight hour print, the 3D printer ran out of filament. Tomorrow, I will try again with a printer that has more filament.
11/18
Today, I tried to 3D print my clock's case again. This time, I chose a printer (#13) that was almost full with filament so that the print would complete successfully. It was a success, and the clock case fits perfectly around the clock. Next class, I will 3D print the second half of the case and the connectors.
11/29
Over the break, I accomplished a lot of work surrounding the electronics of the project as well as the 3D printing.
First, I 3D printed the second half of the case for my clock. The problem is that the two halves are slightly different sizes. The lips don't meet exactly together. This might be a result of adding too much tolerance to the design, but when I try to lock the pieces together, the connectors do not fit in. It was extremely difficult to push one of the connectors into place, and the second connector was offset and would not reach. I will examining the design more closely during a future class period to find out what is causing the problems. Probably, there was an error in terms of units. I believe this is true because the Raspberry Pi does not fit into its holder, although it does in the CAD design.
Second, I configured a Raspberry Pi 0 to cut off all processes on port 80 on startup, host a website and the local server, and allow me to easily connect via SSH to work more efficiently from a different computer. Originally, I was planning on using a Raspberry Pi 3, but the built-in Wi-Fi features were not working correctly. Instead, I am using a Raspberry Pi 0 which is smaller and has built-in Wi-Fi modules. I plugged the Raspberry Pi into a monitor, mouse, outlet, and screen. Then, I connected it to a hotspot on my phone and enabled SSH. Because I had also used this Raspberry Pi for another project which automatically started running a program that connects to port 80, I wrote another startup script that kills all processes on that port. I used the crontab feature on the Raspberry Pi to schedule a command to be run whenever the Pi is turned on. Then, I runs a shell script, but to make it executable I needed to run the "sudo chmod 777 *filename*" command so that the shell script could be run like an executable. The shell script uses the "fuser -k 80/tcp" command to kill all processes on port 80 and runs several python scripts as the root user. The first of these scripts sends me an email with the Raspberry Pi's public IP address so that I can SSH into the computer and control its command line. The second script hosts a website on the local server that runs the clock with its full functionality. When, I brought the Raspberry Pi, I turned on my hotspot on my phone and plugged the Raspberry Pi into the wall. It automatically connected to my hotspot, sent me an email with its IP address, killed all processes on port 80, and ran the website/clock code. Then, I used a program called "PuTTy" on my computer to SSH into the Raspberry Pi after connecting to my hotspot. I entered the IP address I was emailed and logged into the Pi. Everything was working as planned. Almost every step in this part of the project, from turning on the Raspberry Pi to killing processes on a port to creating an executable startup script with root capabilities took many trials and errors until, eventually, everything worked successfully.
11/30
Today, I fixed the CAD files for the case of my clock. First, the Raspberry Pi holder was too small. I used calipers to measure the Raspberry Pi, and input those dimensions plus 5mm for tolerance. After printing it, the Raspberry Pi should fit perfectly. Also, I re-sliced the gcode files so that, when I 3D print it, the new files will be understood by the 3D printer.
12/1
Today, I printed the new case for my clock. I adjusted the dimensions and the holder for the Raspberry Pi. Now, it works extremely well. I also used a bigger 3D printer so that it could all be print in one piece (with no connectors).
12/2
Today, I spent all of the class attempting to get the Raspberry Pi to control continuous servo motor. It did not function, and I will try again tomorrow. I am using Python 3 with the RPi.GPIO library so I can control the Raspberry Pi's GPIO pins. I connected the positive and negative of the servo motors to a battery pack, and plugged a third "control" wire into a GPIO port. I will keep trying to get this to work.
12/3
Today, I attempted to get the servo motor to work again, and I determined the cause of the issues I have been experiencing. When I plugged the servo motor into one of the GPIO ports, it did not turn. I then used a multimeter to measure the voltage. I connected the black wire to the ground GPIO pin on the Raspberry Pi and the positive wire to the port I was connecting to the servo motor. It appeared that the wiring was working, but for some reason the servo was not turning. I realized that the power source I was plugging the Raspberry Pi into only output 3V, but the servo motor requires 4-6V. I am going to try to get the servo motor to use the Raspberry Pi both for controlling and as a power source.
12/6
Today, I finally got the servo motors to work. I first watched a video about transformers and power sources which explained to me that a certain power block would supply both 5V and 5 amps when attached to a transformer. Because every servo motor draws 1 amp, it should power them both sufficiently. I connected the negative from the transformer to the ground of the Raspberry Pi, and I also attached the negatives of each of the servo motors to grounds of the Raspberry Pi. The positive of the transformer was split in parallel to the two servo motors, and the control input of the servo motors were attached to different GPIO pins of the Raspberry Pi.
12/7
Today, I re-laser cut part of my acrylic clock to better fit around a servo motor. At first, only to top-most circle of the servo motor fit through the hole in the acrylic. Then, I laser cut the clock again in cardboard, took the clock out, and put the acrylic clock back exactly in the same position. I redesigned the holes and only re-did the vectoring of those parts. I did not add enough tolerance, so the servo motor still did not fit. Next, I used the big laser cutter to align the new file exactly where I needed it on the clock, and it worked extremely well.
12/8
Today, I continued to work on the design for the case for my clock. The servo motor was too tall, and I needed a mount for the servo motor. I was having trouble adjusting the height of the case, but I will continue to work on it in the coming days. I will also print the amount separately so that a small error does not ruin an 8-hour print.
12/9
Today, I continued to repair the design for my clock case. First, I created a model of the continuous servo motor I am using in Fusion 360. I then drew a vertical construction line that started at the bottom of the box case an went straight up. Its length was the servo motor's height plus the thickness of the bottom of the case plus the thickness of the acrylic and the height of the lip holding the acrylic in place. I cut the clock case right before the acrylic, moved the top piece up until it touched the top of the construction line, and then extruded the bottom piece so that they were connected.
12/13
Over the weekend, I 3D printed the clock hands, re-printed the clock case, set up all of the wiring and soldering, mounted everything in the case, and created ports for external power sources to connect. First, I designed two clock hands for my project. Because the hour hand would overlap the minute hand, I had to ensure that the design for the hour hand protruded farther from the clock than the thickness of the minute hand. I found a CAD model of a Servo-arm on Thingiverse and modified it to create the clock hands. After three failed attempts and one broken print, I had successfully created clock hands. Next, using the design I made last week, I reprinted the clock case. Afterwards, I stripped the wires on the servo motor and used a heat shrink/soldering iron to attach the ends to female connectors that hooked up to the Raspberry Pi's GPIO pins. I did the same for wires connecting to the power supply/transformer. Then, I reconnected all of the wires. Next, I 3D designed and printed servo motor holders. I glued them to the base of the clock, and put the servo motors in them. This prevents the servos from shaking when the clock hands turn. Next, I drilled two holes in the side of the case. One for the micro-usb that powers the Raspberry Pi and one for the external power source that connects to the servo motors. Then, I put the Raspberry Pi in the case, positioned everything nicely, and put the acrylic in place. The acrylic is held in place by tension.
12/14
Today, I finished the programming for the clock. The Raspberry Pi runs a Python3 Flask program that hosts a website on the local server. On the website, users can use a mini-controller to manually control the hands of the clock. You can also toggle whether the the small hand acts as a minute or second hand. Also, once the hands are calibrated, the clock can be started. Also, a "crazy" button can be pushed that moves the hands randomly. The html elements call functions from the JavaScript code that make GET/POST requests to the Python3 website host, sending and receiving information so that the user's requests are carried out in the servo motors.
12/15
Today, I vinyl cut my name on the back of my clock and tested my project to ensure that everything works. Below is a picture of my vinyl-cutting.
Overall
Overall, the project went according to plan. The scheduling was changed several times due to new problems arising. For example, I could not work on most of the programming until I had built and mounted the clock. The final design of my clock was almost identical to my original design, and the outline for my programming was followed almost exactly. I learned very much about programming servo motors, prototyping and 3D printing different iterations of a design, and carefully planning how different types of parts will fit together.