Need help on a senior design project and my partner is not doing his part...

Hey everyone, I'm a senior electrical engineering student and for my senior design project I'm supposed to design a machine. My role was to get the sensors and layout how everything is supposed to work, with equations, and the layout of the algorithms, and my partner was to write the code (since he is supposed to be a computer engineer), but he is not doing his part and looks as if he will not be graduating. So now his job depends on me.

I do not want anyone to write the code for me but to sort of point me in the right direction.

basically I'm going to use a potentiometer to simulate values (d1, d2, etc..). So I will be using the analogue inputs on the arduino. The voltages will range from 0-5 and each will represent a value.

There is a list where the d1's and d2's are assigned a certain value (S1, S2, etc...)

The system will take the first value (d1). The system will take the second value (d2).

The system will take the first and second value (d1 and d2) and put them into an equation that I develop to get a value (x1).

The system will take that value (x1) and compare it to the value (s2) of the last input (d2) (sorry if that is confusing)

If the x1 is greater than the s2 than it will do something, if not it will do something else.

Kind of vague, but I just need to be pointed in the right direction or something I can build upon.

I would ask the professor to assign a new partner for your project.

I have but everyone is taken. I dont think he will grade me as hard but he told me that it is my responsibility to do what I can to get it done. ABET reviews the projects every semester to make sure that we meet the requirements to keep our engineering accreditation and I will need to have something or they cannot just let me slide.

Let's do this in steps.

If I understand the first bit:

You are going to use a potentiometers to vary the voltage on an analogue input. From the analogue reading (d1) you are going to assign it a value from 1 to 5 (s1).

I assume you are connecting the potentiometer with one end to 5v and other to ground.

I presume you are breaking the analogue input into 5 bands of values.

But now I am confused as to what you actually want to do.

Maybe a few examples of what is supposed to happen.

Weedpharma

weedpharma:
Let’s do this in steps.

If I understand the first bit:

You are going to use a potentiometers to vary the voltage on an analogue input. From the analogue reading (d1) you are going to assign it a value from 1 to 5 (s1).

I assume you are connecting the potentiometer with one end to 5v and other to ground.

I presume you are breaking the analogue input into 5 bands of values.

But now I am confused as to what you actually want to do.

Maybe a few examples of what is supposed to happen.

Weedpharma

So let’s say I have a list that says

D1 : 7 (S1)
D2 : 5 (S2)

So lets say at .5V the value is “10” (D1), and at 1v, the value is “15” (D2).

I put the “10” and the “15” into an equation and I get the number “9” (X1)

Now “9” (X1) will be compared to “5” (S2) since it comes from D2 (as the last place where the sample was taken from).

Since 9 (X1) is bigger than 5(S2) than the micro controller will send a certain signal. if it were not then it would send a different signal.

This must be done continuously with the next inputs (d3, d4 etc…) But I can figure that out on my own.

A problem I see is how to know which reading from the ADC goes into which variable.

As well as the ADC I think you need a push button.

Then you could show a message on the serial monitor “Set potentiometer for value 1”
after which you would adjust the pot and press the button.
Then a new message would be displayed “Set potentiometer for value 2”
etc etc.

Have you looked at the Thread planning and implementing a program ?

…R

Your could also use real variable names that mean something.

Instead of meaningless d1, use analogReading1. This will help us understand what you are doing.

Weedpharma

Well you have the algorithm pretty clear in your head it seems.

What do you mean by "send a certain signal"? That could mean anything between turn on an led or send a radio signal to Mars.

In your years as a student, presumably you did some C? You need to work through some of the Arduino basic examples, but I would dearly like to assume you're past that particular hurdle.

But in anycase, imo you need to look at some specific Arduino functionality:

[editorial] Can't help thinking though, that unless the equation that assigns the x to the d is mind-blowingly complicated, and or the sending of the signal is particularly complex, this is no more than a trivial hobbyist project, not one worthy of graduating an electrical and a computer engineer. My daughter starts as an undergrad mechatronics student next year: if she gets a final year project like this in 4 years time, she's at the wrong school. [/editorial]

JimboZA: Well you have the algorithm pretty clear in your head it seems.

What do you mean by "send a certain signal"? That could mean anything between turn on an led or send a radio signal to Mars.

In your years as a student, presumably you did some C? You need to work through some of the Arduino basic examples, but I would dearly like to assume you're past that particular hurdle.

But in anycase, imo you need to look at some specific Arduino functionality:

[editorial] Can't help thinking though, that unless the equation that assigns the x to the d is mind-blowingly complicated, and or the sending of the signal is particularly complex, this is no more than a trivial hobbyist project, not one worthy of graduating an electrical and a computer engineer. My daughter starts as an undergrad mechatronics student next year: if she gets a final year project like this in 4 years time, she's at the wrong school. [/editorial]

Ok, thanks. And sorry, but I did not describe the entire project on here. This is a very small part of the project. There are many things involved that include fourier analyses, stress analyses with the program abaqus (not too much though since this is an electrical-computer engineering project), and I even have a code for fast fourier transformations (that works but still needs some work and is also more complicated than what I am asking for help on), and even some Digital Signal Processing. I'm just completely swamped because I knew my partner could not do much so he ended up having the smallest tasks. So now I have a little over a week to get everything done, and this was not something that I had planned to do.

Glad to hear there's more to it.

So have you had a look at the links I gave, which are the building blocks you'll need to get those outstanding parts done?

JimboZA:
Glad to hear there’s more to it.

So have you had a look at the links I gave, which are the building blocks you’ll need to get those outstanding parts done?

Yes, I’ve read over it, and I’ve been working on a code, that I will post when I have something to show.

I think you need to think through your user interface.

So far this is what I have. It’s kind of rough though but let me know what you think.

void setup() {

Serial.begin(9600);
}

void loop() {
// read the input on analog pin 0:
int d1=analogRead(A0)* 10; //Take voltage value and multiply it by 10. Assign that number to “d1”
delay(10); // wait a millisecond
int d2=analogRead(A0)* 10; // take the voltage value multiply it by 10. Assign it to “d2”
{
int v1=(d1-d2)/.01 // put d1 and d2 into this equation and use that value for “v1”
}
{
if (d2=50) // if d2 was X number than s1 is another number.
{s1= 1
}
else if d2=49
{s1= .98
}
else if d2=48
{s1= .96
}
else if d2=47
{s1= .94
}
else if d2=46
{s1= .92
}
else if d2=45
{s1= .90
}
else if d2=44
{s1= .88
}
else if d2=43
{s1=.86
}
else if d2=42
{s1= .84
}
else if d2=41
{s1= .82
}
else if d2=40
{s1= .80
}
else if d2=39
{s1= .78
}
else if d2=38
{s1= .76
}
else if d2=37
{s1= .74
}
else if d2=36
{s1= .72
}
else if d2=35
{s1= .70
}
else if d2=34
{s1= .68
}
else if d2=33
{s1= .66
}
else if d2=32
{s1= .64
}
else if d2=32
{s1= .62
}
else if d2=31
{s1= .60
}
else if d2=30
{s1= .58
}
else if d2=29
{s1= .56
}
else if d2=28
{s1= .54
}
else if d2=27
{s1= .52
}
else if d2=26
{s1= .50
}
else if d2=25
{s1= .48
}
else if d2=24
{s1= .46
}
else if d2=23
{s1= .44
}
else if d2=22
{s1= .42
}
else if d2=21
{s1= .40
}
else if d2=20
{s1= .38
}
else if d2=19
{s1= .36
}
else if d2=18
{s1= .34
}
else if d2=17
{s1= .32
}
else if d2=16
{s1= .30
}
else if d2=15
{s1= .28
}
else if d2=14
{s1= .26
}
else if d2=13
{s1= .24
}
else if d2=12
{s1= .22
}
else if d2=11
{s1= .20
}
else if d2=10
{s1= .18
}
else if d2=9
{s1= .16
}
else if d2=8
{s1= .14
}
else if d2=7
{s1= .12
}
else if d2=6
{s1= .10
}
else if d2=5
{s1= .08
}
else if d2=4
{s1= .06
}
else if d2=3
{s1= .04
}
else if d2=2
{s1= .02
}
else if d2=1
{s1= .01
}
else if d2=0
{s1= .00
}

if (v1 <= s1) //Compare v1 to s1. If v1 is equal to or less than s1…
{
// next phase of project
}
else if (v1 > s1) //Compare v1 to s1. If v1 greater than s1…
{
// next phase of project
}

}

Thanks in advance.

First of all

int v1=(d1-d2)/.01

Is just daft. Why not

  int v1=(d1-d2) * 100;

Secondly All of this rubbish (if you corrected the incorrect usage of '=' instead of '==')

if (d2=50)                                  // if d2 was X number than s1 is another number.
  {s1= 1
  }
else if d2=49
  {s1= .98
  }
else if d2=48
  {s1= .96
  }
else if d2=47
  {s1= .94
  }
else if d2=46
  {s1= .92
  }
else if d2=45
  {s1= .90
  }
else if d2=44
  {s1= .88
  }
else if d2=43
  {s1=.86
  }
else if d2=42
  {s1= .84
  }
else if d2=41
  {s1= .82
  }
else if d2=40
  {s1= .80
  }
else if d2=39
  {s1= .78
  }
else if d2=38
  {s1= .76
  }
else if d2=37
  {s1= .74
  }
else if d2=36
  {s1= .72
  } 
else if d2=35
  {s1= .70
  }
else if d2=34
  {s1= .68
  }
else if d2=33
  {s1= .66
  }
else if d2=32
  {s1= .64
  }
else if d2=32
  {s1= .62
  }
else if d2=31
  {s1= .60
  }
else if d2=30
  {s1= .58
  }
else if d2=29
  {s1= .56
  }
else if d2=28
  {s1= .54
  }
else if d2=27
  {s1= .52
  }
else if d2=26
  {s1= .50
  }
else if d2=25
  {s1= .48
  }
else if d2=24
  {s1= .46
  }
else if d2=23
  {s1= .44
  }
else if d2=22
  {s1= .42
  }
else if d2=21
  {s1= .40
  }
else if d2=20
  {s1= .38
  }
else if d2=19
  {s1= .36
  }
else if d2=18
  {s1= .34
  }
else if d2=17
  {s1= .32
  }
else if d2=16
  {s1= .30
  }
else if d2=15
  {s1= .28
  }
else if d2=14
  {s1= .26
  }
else if d2=13
  {s1= .24
  }
else if d2=12
  {s1= .22
  }
else if d2=11
  {s1= .20
  }
else if d2=10
  {s1= .18
  }
else if d2=9
  {s1= .16
  }
else if d2=8
  {s1= .14
  }
else if d2=7
  {s1= .12
  }
else if d2=6
  {s1= .10
  }
else if d2=5
  {s1= .08
  }
else if d2=4
  {s1= .06
  }
else if d2=3
  {s1= .04
  }
else if d2=2
  {s1= .02
  }
else if d2=1
  {s1= .01
  } 
else if d2=0
  {s1= .00
  }

Could be replaced with

s1= (d2 *2) /100;

if (d2=50) // if d2 was X number than s1 is another number. {s1= 1 } else if d2=49 {s1= .98 } . . . else if d2=1 {s1= .01 } else if d2=0 {s1= .00 }

No syntax is wrong and approach is wrong.

Do this instead. s1 = d2 / 50; OR... s1 = d2 * 0.02; // multiplication is faster.

Edit: Ken beat me to it. :confused: