Week 11 - Inputs
TOF sensor - VL53L1X
To start off this week, Stuart and I worked on the VL53L1X time of flight sensor together, since we didn't have a lot of them in the lab. We used code from last week that Adam had designed for my group project. Stuart pared some of the code that was unnesecary, and tried it first on an arduino.
It worked on the arduino, and so It was now my job to make it work on the Pico. All I had to do was plug in the SCL and SDA pins into SDL and SCA 0 and the code worked exactly the same. The difference was that there were many more SCL and SDA pins to choose from, so I just opted for pins 6 and 7, since they were both IIC0, and I figured both of them would need to be the same IIC register.
Accelerometer - MPU-6050
To begin using this sensor I followed this tutorial that Dylan found. I wanted to use the seeed initially because I wanted to be able to use a setup similar to this in my final project. I decided this because Mr. Dubick said that there was some trouble when using this sensor in C, so I figured if I isolated this board onto its own board I could have it communicate back and forth with the rest of my project that was running in C while this was running in micropython.
Later after testing with different libraries, I decided it would be better if both my boards were in micropython, to make communication between each easier. I designed a new board in fusion, which I used for this week and networking week. This board had the accelerometer hooked up to the Xiao seeed rp2040, and was used to read the speed that the machine was moving so that the servos would move at the right time to percisely drop the seeds when the time of flight detects a hole.
I decided that most of the code within this program was pointless to me, because I only cared about the movement speed in 1 axis, which I would make the x axis. I deleted the rest of the code that dealt with the other axes of movement, because it was simply clutter which would slow down my code. This is what I received.
Understanding of the sensor
To understand exactly what I just did, I found a sheet that explained how this accelerometer worked. I was initially confused by how this worked, and why all the values were so small. Essentially, this takes plates, and measures them to see how many g's are enforced, which was why I was getting such small readouts on the code. For my final project, I want to convert this value to something more readable, so that I can easily send it to my other board for networking. Upon further research, 1 g translates to the acceleration value of 22 mph/second. This means that the value only increases largely when the machine starts moving. This means I have to calculate the approximate speed of the wagon, which may be a more difficult taks in the future.
Group page
Group page can be found here
file download
You can download the files for this week here