Week 6: Connecting The Dots

Welcome to the week 6 update, where I started to connect the software and hardware components. While I much have rather been at the stage of calibrating how much the motor should turn given a specific unit measurement, much progress was still made. This week I started by creating a Python file that would allow me to test that the Raspberry Pi and stepper motor would communicate with each other effectively. I was able to get a file that asks for a number of steps so that the stepper motor would rotate. This was a success and did not take long to function. I also developed my Python file that deals with speech recognition. The code now asks the user for a command. I also had to brainstorm possible situations where the user might be missing information. Handling these situations is important because we want all the necessary information to be able to get a valid measurement. This was all possible because of my knowledge from developing the Alexa Skill earlier on in my project. During the progress of my Alexa skill, I was able to pick up on dealing with missing information and valid commands. One aspect I did implement was making sure that the user’s command has a valid wake phrase, so the speech recognition program knows to take action. Also implementing follow-up questions for the missing information. Even though I did not use the Alexa skill, I was still able to make the most of that learning.

During this software development, I did face some trouble with handling if the user command read the quantity number as a word or an actual number (Ex. one or 1). This was something I, later on, notice while testing. Luckily Python has so many libraries to access that I was able to find one called word2number that takes in a string and picks up on any number word to convert it into a number unit. Sometimes the speech recognition would pick up on the actual number unit, other times it needed the support of the word2number library.

The last thing I worked on for the software was implementing the text-to-speech attribute. Text-to-speech is the component that allows whatever text is written on the computer to be said out loud. This is a very common tool used among the visually impaired community, in order to get an assistant to read out loud what is on the screen. This is important to implement so that the user can get the voice assistant to have an almost natural conversation when there is missing information. I was able to find Google’s text-to-speech, however, I later found out that it is not available for use on Raspberry Pi. I spent many hours trying to find another replacement, but none were successful. I ended up taking a break from it and it will be one of the tasks to come back to over the weekend.

On the hardware side, more 3D printing occurred. After testing the stepper motor with random step values to turn the hardware components, I found that I had to reprint the spiral piece again but with the resin 3D printer. I had to reprint the spiral because it was rubbing a lot with the case inside. Also, the PLA 3D printer made extra material hang from one of the sides which makes substances like the rice more prone to get jammed. Below is an image of the PLA spirals vs the resin spirals. As you can see the resin spirals came out much smoother.

On the note of 3D printing, I also began to print other components to the hardware to clean up. I printed out a substitute to replace the plastic water bottle I was using as the hooper. I will let the following picture show you what I walked into the next day… you can imagine my reaction.

For now, I will continue to use the plastic water bottle as the hooper because I tried several times to print this part and every time, it had a malfunction. Additionally, I printed casing and supports for the electric components this weekend. I took time to measure the electric components and brainstormed ways to neatly compact them in a box where there would be no wires in sight in my final presentation. I also had to find a way for the support that would elevate the spiral case, which could nicely line up with the stepper motor, because the metal rod goes through the spiral and attaches to the stepper motor. For now, the grey elevating support in the picture is perfect, however, the black casing box is currently being reprinted because the stepper motor is too tight and does not fully fit in width. Other than that, the casing and support should be perfect in no time.

Also, I have to wait on a piece for the Raspberry Pi because it needs a dependent to take control of the pulse time. After testing the stepper motor over a long period of time, we noticed that the motor was sounding funky toward the end of the given number of steps. So if we told it to move 200 steps which is a rotation of 180 degrees clockwise, it would make a weird sound at the end of its cycle. This has to do with not having time to keep a constant pulse so that the stepper motor can be under control and in sync with the give commands.

Next week I will be focusing on calibrating as I mentioned at the beginning of my post. I hope to create a Python library, meaning a conversion table to cross between motor rotation and unit measurement. If the user asks for 2 cups of rice, I would be able to access the library and easily get the number of steps the stepper motor should make. This will be more testing to see how much one spiral can hold in each section and its average weight. This will be the last component of my project to finally be able to have a minimum working voice-controlled dispenser. Hope to see you next week!

Leave a Reply

Your email address will not be published. Required fields are marked *