Progress of project for week 1, June 14
This is our first week back in the MnT lab, looking forward to creating the Domino car.
This is a 3D model of our car. There are columns for 2 colours. It will be controlled by an Arduino Mega. We are using 4 steppers motors to move and control the car while using DC motors to push and deposit the dominos.
This is a top view of the design excluding the central moving arm.
We are incorporating this linear motion into the design to push the dominos out.
We did not consider the precision needed and the difficulty involved to ensure the car moves straight.
We also ordered our stepper motors, rack, and mecanum wheels which would take roughly two weeks to arrive.
We plan to 3D print most of our car body.
Progress of project for week 2, June 21
After discussion with our mentor Kelvin, we have changed our design to one that uses gears. This allows us to incorporate more colours than the original design.
This is the updated design as suggested by Kelvin. This would mean that we need to use 5 stepper motors. This week we will be working more on the coding of the Ardunio and Python.
For Arduino, we realised that the default stepper library in Arduino cannot control 5 stepper motors concurrently. So we will be using the AccelStepper library instead to control the motors.
This week we also started on the Python image processing development, where the Python script will detect the colours of the pixels in the user picture and assign to one of the available colours of dominos to recreate the user picture. We will be working with the RGB channel. We will first be creating some custom functions which are to be called later on in the programme so the main body is more concise. The script workflow is: 1. resize to desired dimensions (which can be chosen by the user); 2. convert to the correct channel ie RGB; 3. read the RGB value (3 values, each for R, G and B); 4. map each of these values to one of the available colours (say Black, White, Yellow); 5. return these values as a string and clean up to send to Arduino.
Lastly, we bought more parts that are necessary for the car. We bought capacitors and a 12V battery carrier to power the car.
Actually, we realised that the Ender 3 3D printer in the lab is too small for the column. Since each domino is 0.8cm thick, suppose we have 100 dominos in each column, the column would need to be 80cm tall o.O.
Also, the car body is too big for the printer. We will cut the sketch into 2 to print separately.
Progress of project for week 3, June 28
This week was the first informal update. The components we bought has arrived and we are slowly solving the compatibility issues before combining the parts together.
This week we are focusing on the adaptors to attach the D shaft on the stepper motor to the wheels.
After iterating a few times, the adaptor was still not satisfactory. The part that extends into the wheel was not able to bear the load and broke easily. Also, the connection was not snug and quite loose.
We have decided to forgo AccelStepper and control the stepper motors directly by controlling the pins. This approach made it easier to control the 5 stepper motors and to move them in the desired order.
The two halves of the car body were printed and they fit together well. But we need to attach the motor to check if the body will flex with load and such.
We also started on the Bluetooth part of the project. We are using an HC-05 Bluetooth module. We manage to solve many issues that were not apparent at the start regarding the Bluetooth module. Somehow our set-up worked fine with an Arduino Uno but did not work with a Mega. It turns out the labelling on our Mega was flipped. Also, our Arduino initially received some gibberish within the string. After much troubleshooting, a solution was found.
For Python, all functions were created relatively smoothly, with the exception of the mapping of the pixel colour values. This week, we try taking a simple average, and map to the colour closest to this average. For example, a pixel has a value of (0, 100, 100), and the colours to be mapped to are (0, 0, 0) with an average of 0, (255, 255, 255) with an average of 255, and (150, 150, 150) with an average of 150. The pixel then has an average of (0+0+100)/3 = 33. This was the most straightforward method we thought of. However, this does not work very well. For example, both (0, 0, 100) and (0, 100, 0) will be mapped to (0, 0, 0), but they are very different colours to the human eye. Instead, the deciding criterion is changed from the average to the colour distance, which is something we learned in a previous module. The colour distance is the Euclidean distance, but instead of coordinates, we use the colour values. Still, we face the same issue with the script being unable to cleanly map to the 3 colours.
Progress of project for week 4, July 5
Unfortunately, we broke one of the mecanum wheels. When we tested the wheel adaptor, a piece lodged inside and in the attempt to remove it, we broke a portion of the wheel. So we had to order a new set.
We have continued our iteration on the wheel adaptor. And we have settled on a design where the screw screws into the wheel and has a separate screw and nut to press onto the shaft of the stepper motor. This new design is secure and works well.
Also, we slightly changed the design of the car body and we had to reprint the body. But this time the body was cut into 4 pieces instead of 2.
This week we have more or less finalized the Ardunio coding. The existing libraries for stepper motors don’t provide the functionality we desire. For example, we want to let our wheels rotate at the same time but not with the color-deciding disk. Moreover, those libraries don’t provide functions to control dc motor. Therefore, we decide to create our own functions for both dc motors and stepper motors. After making the decision, we started to learn how dc motors and stepper motors work and how to write the corresponding code. Micro-stepping is an interesting setting. One and increase the precision of stepper motors by changing the micro-step. The lower the micro-step (more steps per round), the more precise stepper motors are, yet, it is much harder to rotate and move the car forward. For wheels, we set the micro-step to 1/8-step in order to be precise and powerful at the same time. For the color-deciding disk, we choose 1/16-step for the micro-stepping setting since the mechanism doesn’t require too much power. By coding the function for moving, including moving forward, backward, left, and right, disk rotating, including choosing different colors, and dc motors, we are able to control them in the sequence that we desire.
We have also printed the bottom of the domino depositing mechanism. We actually had to reprint it since we realised the dimensions of the domino varies quite drastically. The bottom also has a rack attached to the pusher on which a large gear will be. Hopefully, by next week we can print the gear as well.
For Python, we are trying to find a more optimal way to map to the 3 different colours. Went back to the drawing board. What we wanted was a way to find the 3 most dominant colours in the picture. We then thought of a mathematical concept we previously learned in our vector calculus module, which was Principal Component Analysis (PCA). PCA is a dimensionality reduction technique that will screen out the most important bases or most important axes in a dataset. This was very close to what we wanted, but instead of reducing into 3 vector bases, we want 3 important points or clustered. Atter much research, this thought process led us into discovering K-Means clustering, a data reduction technique used often in Machine Learning to cluster data into K points with minimised within-cluster variances. With this method, our entire dataset can be reduced into just 3 data points! This worked much better than our previous criteria.
Progress of project for week 5, July 12
We managed to print the 4 parts of the vehicle body. Each part took around 15 hours to print. We used 4 different printers so ended up with a multi-coloured car.
Since we could not use the big printer to print the whole car, we had to think of ways to attach the 4 parts together. So we used M3 screws between the parts and used extra support plates to add rigidity. But there was still significant amounts of flex.
We also printed and attached motor brackets to the body. And with that, we plugged in the electronics and tested the car.
We finally managed to make it move. For now we managed to move it forward and backward. But there are still issues for lateral motion. The mecanum wheels does not seem to work?
We also realised that the traditional 1.5V AA batteries do not work well. So we ordered new Li-ion batteries instead.
For Python, we tried establishing the serial connection with Arduino. We utilised the library serial which could be used by pip installation. There was some difficulty in sending the string of outputs, but we managed.
Progress of project for week 6, July 19
We have more or less finished with the coding in this project. The python image processing was updated with K means clustering to improve the colour recognition algorithm. Now we have an executable programme that takes in any pictures uploaded by the user and translates them into a picture of 3 colours in any square array size and transmits it to the Arduino which then moves the car and deposits the domino <picture needed>.
Also, we realised that the issues with lateral motion were due to the mecanum wheel being in the wrong orientation. We were given mismatched wheels. Once we replaced them, the car worked well.
Since we are using just 3 colours, we had to paint all the dominos that were of the wrong colour. Turns out, spray paint does not work well. Next week we will be trying out wood paint instead.
For Python, we designed a simple Graphical User Interface (GUI) so that the user can conveniently input an image to the car. We use Tkinter, and created the standalone executable file, domino.exe, using pyinstaller. This allows the user to just run the app without opening Python to execute the commands. The design of the GUI was improved on over several weeks, to be able to catch some simple exceptions or errors.
Progress of project for week 7, July 26
For this week we were focused on the 3D printed parts of the car. We printed the upper gear, slider and columns. And put them together.
Progress of project for week 8, August 2
This week, we have more or less finalised the design of our car. So we are going to reprint most of the components as one complete piece. We asked Tony to let us use the big printer to print our car body as one piece. We will be using the Ender 3 to print the upper gear and columns as one complete package to make it more durable.
We also realised that some of the dominos do not exit the gear smoothly. Instead, it will tumble before hitting the wall. We had to get creative and we each tried our own ideas until a combination of two worked. We added two “teeth” to the wall to prevent the domino from toppling. Another big issue was the fact that the dominos are dropping from a significant height. We added a guiding slide under the base of the car to gradually reduce the height of the domino.
We have also received our 18650 batteries and 3S 4P battery carrier. It turns out the battery carrier we bought was incomplete and cannot be used.
This battery carrier turned out to be dangerous even. So we had to borrow a battery carrier from Tony.
Progress of project for week 9, August 9
This will be our final week of Making and Tinkering. Our goal for this week will be to improve the mechanism and also to tidy up our car. Lastly, we will also paint the remaining dominos with the wood paint that we bought.
We realised that after painting the dominos, The paint layer is inconsistent and different from the other dominos and from each other. More importantly, the thickness of the dominos was changed significantly. Therefore, we had to abandon the idea of painting the dominos.
We also came up with the idea of increasing the height of the slider to further reduce the chances of the domino tumbling.
Lastly, we improved the wire management of the car. And this is the final product of our MnT journey.