User:Fnarmouq2655/ENES100/Project 2

Project Preference

 * Smart shoe
 * BioVest
 * Autonomous Power Wheel

Problem Statement
''In one or two sentences, describe the project that your group will be working on. Identify what CDIO phase (Conceive, Design, Implement, or Operate) your group will complete in this project cycle.''

Project Plan
Briefly describe your group's plan for the next 4 weeks, including major tasks that will be completed each week.

Week 1 Narrative
For the first week, we were assigned our new groups. So, I was assigned to continue on the Smart shoe project that I worked on previously. After discussing with my new group on what the project is about and identifying the things that should be done in order to lead the project to success, we assigned different tasks to each one of us in the group. Generally speaking, we have to accomplish these main tasks: My task for this week was to do the re-soldering of the connections/wires between the arduino micro, the 9V battery, the switch, the accelerometer and the transmitter. However, the reason behind having to re-solder is to minimize the volume of the device and make it fit in as small case as we possibly can. But, I figured out that it would be better if I postponed the re-soldering until our group come up with the final design of the case; to have a sense on everything, from the dimensions of the case, to how it would look like and how the different parts would be organized together; because I don't want to re-solder now, and then to figure out after designing the case that we need to do it again and re-solder again, as repeating the soldering/re-soldering could affect the arduino and the parts and damage them. Instead, as we began to learn about using the Autodesk Inventor Application to make 3D models, I started to learn more and more about the application, and to work on the design of the case. And I am still working on it. I believe that we, as a group, couldn't make a lot of progress this first week; because we couldn't meet more than once on Wednesday due to the weather conditions on Monday, and our different schedules after that. But, for next week, and as the new transmitter and receiver had finally arrived, I am sure we are going to achieve more of our goals.
 * Designing a case to be attached to the shoe
 * Re-soldering the connections/wires
 * Getting the transmitter and receiver to work with the accelerometer and the arduino micro

Week 2 Narrative
For this week, my task was to work on the wireless communication between the RF transmitter and receiver shown in the following links: https://www.sparkfun.com/products/10535 https://www.sparkfun.com/products/10533 The purpose of using these parts along with the Aduino Micro and Uno in the smart shoe project is as follow: In order to make the RF transmitter and receiver communicate, I firstly read through the data sheets of both parts, that could be found in the pages that I've pu their links previously. Then, I have built the following circuits: Arduino no.1       GND > GND Digital pin 13 -> Data 5V pin -> VCC And attached a wire as an antenna to the ANT pin on the transmitter. Arduino no.2    GND > GND Digital pin 13 -> Digital Out 5V pin -> VCC And attached a wire as an antenna to the ANT pin on the receiver. Then, I downloaded and uploaded the following Library to the Arduino software: -Virtual Library: http://www.airspayce.com/mikem/arduino/VirtualWire/
 * The accelerometer measures the acceleration of the jump
 * Then the Arduino Micro processes and utilizes the data that comes from the accelerometer to calculate the jump's height.
 * Then, comes the RF transmitter's role to send the final calculations from the Arduino Micro to the RF receiver.
 * The RF receiver, which is connected to an Arduino Uno to the computer, receives that data, to be finally displayed on the screen.
 * RF transmitter's circuit:
 * RF receiver's circuit:

After that, I plugged both Arduino no.1 and 2 to the computer and uploaded the following codes on them, respectively: // RF Link using VirtualWire to Transmit messages // simplex (one-way) receiver with a 315MHz RF Link Transmitter module // tx pin 3 on Duemilanova (arduino)
 * RF transmitter's code:

void setup {    // Initialise the IO and ISR vw_set_ptt_inverted(true); // Required for RF Link module vw_setup(2000);                // Bits per sec vw_set_tx_pin(3);               // pin 3 is used as the transmit data out into the TX Link module, change this to suit your needs. } void loop { const char *msg = "TEST MESSAGE";      // this is your message to send
 * 1) include  // you must download and install the VirtualWire.h to your hardware/libraries folder
 * 2) undef int
 * 3) undef abs
 * 4) undef double
 * 5) undef float
 * 6) undef round

vw_send((uint8_t *)msg, strlen(msg)); vw_wait_tx;                                         // Wait for message to finish delay(200); }

// RF Link using VirtualWire to receive messages // simplex (one-way) receiver with a 315MHz RF Link Receiver module // rx pin 23 on mega
 * RF receiver's code:

void setup {   Serial.begin(9600);
 * 1) include  // you must download and install the VirtualWire.h to your hardware/libraries folder
 * 2) undef int
 * 3) undef abs
 * 4) undef double
 * 5) undef float
 * 6) undef round

// Initialise the IO and ISR vw_set_ptt_inverted(true);   // Required for RX Link Module vw_setup(2000);                  // Bits per sec vw_set_rx_pin(23);          // We will be receiving on pin 23 (Mega) ie the RX pin from the module connects to this pin. vw_rx_start;                     // Start the receiver }

void loop {   uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // check to see if anything has been received {   int i;     // Message with a good checksum received. for (i = 0; i < buflen; i++) {       Serial.print(buf[i]);  // the received data is stored in buffer }   Serial.println(""); } }

Fortunately, I was able to get the RF transmitter and receiver to talk to each other. But unfortunately, the display screen kept printing funky numbers instead of the words. I tried to work on solving that problem, by changing things in the codes, but as a result of that, I started getting different numbers printed out. So, my task for the following week is to get that code little issue solved. Overall, I was successful to make them communicate.

Week 3 Narrative
This week, I was assigned to continues working on the wireless communication between the RF transmitter and receiver. So, I tried different codes, but at the beginning and unfortunately, no data was received by the receiver, then after many trials and code editing, I was able to send and receive data. But, the best I could do was to make the transmitter send letters, for example: 'hello', and the receiver to receive it as numbers instead of letters. However, with the assistance of Professor Edelen, now we have a code that can be used to send a number, and to receive that exact number. First, when I tried to upload and run the codes Prof. Edelen wrote, I had no results although I had all the connections and circuits in a good state. Then, when I read carefully through the codes, I noticed that there was something missing. I noticed that the digital pins on both arduinos, that are being used with the transmitter and the receiver respectively, have not been declared in the codes. So, I declared the pins, after I had rebuilt the circuits as follow:

And the modified codes I used are: Transmitter code: Receiver code: So the previous codes were used to sent a constant value of the height in inches as a test, (h=16). And in order to have the height shown in both inches and feet, I tried to edit on the receiver's code as follow: But, unfortunately, that wasn't successful. I had nothing printed on the screen. But, the printed result was: ( h=11 ) instead of the mathematically actual value of [ 16/12=(1.33) ]. After many unsuccessful trials, I believe I should work more on understanding how the value of [i] in the buffer is being seen by and dealt with by the arduino; to be able to have mathematically accepted results. Moreover this week, I attempted to combine the codes of all the accelerometer, the transmitter and the receiver. To send the measured and calculated jump height instead of just a constant number. So I came up with these combined codes:
 * First, I tried to divide the value of [i] in the buffer by 12 like this:
 * Then, I tried to slide the division inside the brackets like this:
 * Transmitter+height of jump calculation code:


 * Receiver code (with 'feet' units):

Week 4 Narrative
This week, I was assigned to continue working on the codes, both: for the communication and the jump's height calculation. So I connected the accelerometer to the arduino that has the transmitter. As shown: So, I have the total of three circuits. The previous one, and these two: So, when I tried to combine the codes together, I faced some problems.

This was my first attempt:

To solve that problem, I had to move the lines in which these variables are declared, I deleted them from the 'void setup' section and re-printed them at the very beginning of the code. To solve that, with the assistance of Prof. Edelen, I noticed that I am not getting any results because the sensitivity level was too high. So, I changed the sensitivity level from 250 to 100 at the beginning. But I noticed it became so sensitive. Therefore, I had to change it again to 175, which worked fine. Finally, I was left with this code (after editing):
 * First problem: I kept getting error messages from the arduino program when I tried to upload the previous code. The messages told me that each and every single variable that was used in the code of the 'height calculation' is not declared.
 * Second problem: Although the error messages' problem was solved, I was getting no results when I tried to move the accelerometer. I got nothing printed on the monitor of the the receiver.
 * Third problem: I noticed that there was something not right in the code. I noticed that when the previous group (the one who wrote the first code for the accelerometer) tried to convert milliseconds to seconds, they divided milliseconds by (1750) which is wrong mathematically. So, I changed it to (1000).

Unfortunately, when it comes to the results I was getting when I tried to move the arduino with the accelerometer pretending that it was like a jump, I kept getting some huge numbers. I mean numbers in the thousands place. Sometimes positive numbers, and sometimes negative. But I couldn't figure out what was also going on wrong also, causing that problem. Therefore, I believe the next group who is going to work on the code should know what is causing that problem. Moreover, they should modify height calculation code to calibrate accelerometer in setup function.