Freelancer is a free bootstrap theme created by Start Bootstrap. The download includes the complete source files including HTML, CSS, and JavaScript as well as optional SASS stylesheets for easy customization.
You can create your own custom avatar for the masthead, change the icon in the dividers, and add your email address to the contact form to make it fully functional!
The goal of this lab was to get aquainted with the Artemis nano, and using BLE to send data between the Artemis and our computer.
PART 1
The first step was to download the arduino IDE from this link. We then ran the example code "Blink it Up"
PART 2
The next step in this lab was to intall python, and the virtual environment. This allows for all libraries and scripts isolated from the other programs on the this computer
We installed the code base, where we would be writing our scripts
And finally setting up the jupyter server to write python code
Part 3
Tasks
ECHO
The first task was to send a ECHO command and recieve an augmented string on the computer
GET_TIME_MILLIS
The Nex task was to create a command GET_TIME_MILLIS to write a string with the current time
the code written is below tx_estring_value.clear();
tx_estring_value.append("T: ");
tx_estring_value.append((double)millis());
tx_characteristic_string.writeValue(tx_estring_value.c_str());
I struggled with this for hours until I realized that when adding a commnad you much also update the cmd_types document
Notification Handler
The third task was to set up a notification handler. This is usefull when you dont know exactly when the data will be sent
Notification Loop
Here I got multiple notifications then averaged them to find the data transfer rate. which is around .00578 seconds
Send Time Data
for this task we first got time stamped data, and storred them in an array "time_arr" in arduino
after collecting the data, it is then sent to our computer
the time divsion using this method what .01 seconds which is slower than the previous method which does not make sense. In retrospect the command the transfer the dat should be outside the foor loop
Send Temp Time Data
LAB 2
IMU
The purpose of this lab was to set up the IMU, and record data
PART 1
The first step of the lab was to just use the IMU example code and show that the IMU records data
The code doesn't run untill the AD0_VAL is set to 0. The AD0_Val is the last bit of I2C address is only zero when the ADR jumper is closed. This fucntionality supports multiple sensors.Since we are only using 1 sensor the AD0_VAL is zero
Accelerometer and Gyroscope
The sensor returns the Ax,Ay,Az and the d0x,d0y,d0z. Using these values and simple arthematic the pitch roll and yaw can be computed from either data set.
PART 2 - Accelerometer
the pitch and roll using accelerometer data can be computed using the following formulas.
These formulas where implemented on the Artemis as follows
As I knew we would be implementing other sensors. I decided to create a class Sensor.h. This allowed for reusable and easy implementation of other sensors
The data was very noisy as demonstrated by the videos below
Below are the outputs at -90 pitch and 90 roll from accelerometer data
The sensor was analyzed in the frequency domain, and for both pitch and roll there seemed be a very high gain but only at very low frequencies
A low pass filter was implemented based on equation from class
the next task was to implement the gyroscope. I added the gyroscope measurements to my sensor.h class
Below are the results
The results from the gyroscope even when still seemed to drift
The solution was to was implement sensor fusion between the accelerometer and gyroscope.
the results for were more stable with less drift
the result below are the frequency results for the gyroscope
PART 4 - Data Sampling rate
This task for testing how fast we could collect data from the IMU. This was accomplished by taking out print statements, and streamlining the code execution. Using time stamps I implements a python function to calcuate the speed of data collection
The sampling rate was found to around 63 measurements a second.
LAB 3
TOF
Circus Tent
The purpose of this lab was to set up the TOF establish connection with both of them and record data
PART 1
Using the provide wire I2C code this is the Artemis scanning for I2C, as demonstrated only one I2C device is shown this is the I2C adresses this is because they own the same address. The Port is the I2C bus.
The first step was to connect the both of the TOF to the Artemis and establish an I2C conection. Below is a diagram of the wiring
And the subsequent code to facilitate the connection. The issue Arises from the fact that both of the TOF have the same I2C addresses. In order the connect both of the TOF A must be shut off with the xshut pin the I2C adress of TOF B changed before both of the TOF can operate simultaneously
This allows both of the TOF to operate simultaneously
PART 2
the next part of the lab deals with sensor data
Above is the output of both of the TOF working simultaneously
Another issue arises with the difference in timing between the TOF and the main loop. The minimum period between TOF readings as on the data sheet is around 30ms. While the loop runs at about 5.7ms. This means that for every 5 times the loop runs the sensor returns once.
Below is the python function used to compute these time intervals
LAB 4
Open loop motor control
Controller
PART 1-Prelab
The first part of this lab is diagraming the setup.
PART 2
The goal of this lab is to demonstrate open loop motor control through the Artemis
First is the set up. Below is a demonstation of the of the PWM signal through the oscilloscope
In order the power the motors 5 volts were set on the powersupply. The data sheet explains that between 2.7 and 10 volts can power the motor so this was deemed as acceptable.
Above is a video of the the wheels spinning in both directions and belows is the code
PART 3
During testing both I found that both of the motors do not spin at the same speed for the same PWM input. The left motor has a calabration factor of 1.7 in order the spin at the same speed.
The calibration factor will be persistant issue as for different speed inputs the calibration factor will not be correct.
LAB 5
Linear PID control and Linear interpolation
Locked Safe
PART 1-Prelab
LAB 6
orientation PID control
Submarine
PART 1-Prelab
for this lab we were tasked with orientation control using the IMU. In order to implement this I set up a class called sensor.h and used the Digital motion processor this ended in very stable yaw values
The data transfer rate was around around 210 this leads me to believe this is upper limit for the PID control loop
PART 2
In order to get the approiate response from the PID. I chose a Kp value of .06. Although it took many adjustment I settled on this value. For the graphs the sharp change are due to me manually moving the car, but it returns to the set point.
These are the plots generated for theta vs time
These are the plots generated for control input
This was is the video for the sucessfull test run
I chose to stick with the just a proportional controller. This is what was required to gave the preformance necessary for the requirements