Question

Problem 10.6 A conveyor belt is used for transporting two different products (item A and item B) of different physical sizes
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since no information is given about the platform, I would be writing an ardunio code for the given problem. Property of photocell(or Light Dependent Resistor(LDR)) is that it changes its resistance depending upon the intensity of light falling on it. If the intensity of light falling on the device increases, its resistance decreases resistance and if the intensity of light falling on the device decreases, its resistance increases. Hence, we can say that intensity of light and value of resistance of photocell are inversly proportional. We will use this fact to our advantage.

Hardware description :-

OUTPUT SIGNAL VCC vec REGENDE LIGHT DEPENDENT RESISTOR RESISTOR GND

As you can see, we have created a voltage divider circuit using a resistor and a light dependent resistor(photocell). The value of output signal, Vo will be :-

Vo = \frac{Ro}{Ro + Rldr} Vcc

where

Vcc : constant supply voltage

Ro : Value of constant resistance

Rldr : Value of resistance of photocell

From the formula we can see that as the Value of Vo is inversly proportional to the value of Rldr, and Rldr is inversly proportional to the intensity of light. Hence, value of Vo is directly proportional to the intensity of light. This means that the value of Vo will increase as the intensity of light increases and value of Vo will decrease as the intensity of light decreases. We will use this fact while writing the code. All the functions in the code are self explainatory. Comments have been added for the better understanding of the concepts. Still if you nees any help, feel free to ask in the comment section. Hope it helps :)

Code :-

// variables c and p define the state of the photocell, c = state of photo cell in current iteration
  // p = state of photocell in previous iteration. state = 1 means device is illuminated
  // state = 0 means device is not illuminated.
  int c = 0;
  int p = 0;
  void setup() {
    // put your setup code here, to run once:
    Serial.begin(9600);
    pinMode(A3, INPUT); // defining input pin as A3
  }
  
  // In an arduino we have a 10 bit ADC which convert analog values to the digital values
// from 10 bits we get a range of 0 to 1023. This means it maps 0V to 5V to 0 to 1023.
// Hence, when we say Vo = 250, we mean Vo = 250 * (5/1024) V.
  void loop() { // we repeatedly check the status of the photocell.
    // put your main code here, to run repeatedly:
    int Vo = analogRead(A3); // read value at pin A3
    if(Vo < 250) { // 250 is an experimental value and can change depending upon the hardware setup.
      c = 0; // if value of Vo < 250 it means device is not illuminated.
    } else {
      c = 1; // if value of Vo < 250 it means device is not illuminated.
    }

// if p == 0 and c == 1, this means that in last iteration light was not falling on the the device(p=0)
// and in this iteration light is falling on the device(c=1). This means we need to start the timer.
    if(p == 0 && c == 1) { // this means that light has just started to fall on the device
      // we store the timer starting time in s.
s = millis(); // millis() function returns the time that has been passed since the device is on in miliseconds.
    } else if(p == 1 && c == 0) {
// if p == 1 and c == 0, this means that in last iteration light was falling on the the device(p=1)
// and in this iteration light is not falling on the device(c=0). This means we need to stop the timer.
      // we store the timer stoping time in e.
e = millis();
      unsigned long total_time = e - s;
      decoder(total_time); // decoder functions decodes whether the item was A or B.
      s = 0; // reset the values of s and e
      e = 0;
    }
    p = c; // previous states takes the value of current state before the next iteration.
  }

void decoder(unsigned long total_time) {

// these are just random values, they may change depending upon the system setup
unsigned long time_for_A = 1000;
unsigned long time_for_B = 2000;
if(total_time == time_for_A) {
Serial.println("It was item A");
}

if(total_time == time_for_B) {
Serial.println("It was item B");
}
}

For Indentation :-

// variables c and pdefine the state of the photocell, c = state of photo cell in current iteration // p = state of photocellvoid loop() { // we repeatedly check the status of the photocell. // put your main code here, to run repeatedly: int Vo = anavoid decoder (unsigned long total_time) { // these are just random values, they may change depending upon the system setup un

Add a comment
Know the answer?
Add Answer to:
Problem 10.6 A conveyor belt is used for transporting two different products (item A and item...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Have you ever wondered how many different ways there are to run a small restaurant? Delivering...

    Have you ever wondered how many different ways there are to run a small restaurant? Delivering a sit down eating experience is a common process after all. In Japan it is fairly common to have a sushi restaurant that serves sushi on a conveyor belt! Interestingly, these sushi restaurants are typically very inexpensive. In Boston, there is usually at least one of these restaurants. For example, you could try Enso Sushi, but the sushi there is at least $2 per...

  • Hi i will give you a thumbs up if you do this problem correctly. Sorting Analysis Code and Essay ...

    Hi i will give you a thumbs up if you do this problem correctly. Sorting Analysis Code and Essay Due: 4/22/2019(Monday) Introduction And now for something completely different.   Different sorting algorithms are better for different size data sets.   Other sorting algorithms are better for data sets of a specific type – for instance, data that is already ordered. In this assignment you will implement four different sorting algorithms and collect statistics for each of those algorithms while sorting multiple different...

  • Item 1 In the case below, the original source material is given along with a sample...

    Item 1 In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism by clicking the appropriate radio button. Original Source Material Student Version Suppose you study a group of successful companies and you find that they emphasize customer focus, or quality improvement, or empowerment; how do you know that you haven't merely discovered the management practice equivalent of having buildings? How do you know that you've discovered something...

  • Multiple-Choice Questions (worth two points each) 1. Which of the following describes the process in which...

    Multiple-Choice Questions (worth two points each) 1. Which of the following describes the process in which one adopts patterns of behavior that lead to greater life satisfaction? A. wellness B. health C. social determination D. self-efficacy 2. The Stages of Change Model of health behavior change emphasizes that A. change happens as a process. B. people change only when faced with an illness. C. change occurs only when the environment supports it. D. changes are more effective when based on...

  • Match the following: Adam Smith David Ricardo John Maynard Keynes Choices: (2 are not used.) a....

    Match the following: Adam Smith David Ricardo John Maynard Keynes Choices: (2 are not used.) a. founder of modern market economics comparative advantage-argument for mutual benefits of international trade comparative advantage-emphasized job displacements of international trade founder of modern macroeconomics invented capitalism duo If a firm has trouble selling its good, it can lower price. increase demand. decrease supply. both a) and b) are correct. 6. People often pay too much for goods because they are not aware of which...

  • TRUE/FALSE QUESTIONS:  Foundations of Information Security and Assurance 1. There is a problem anticipating and testing for...

    TRUE/FALSE QUESTIONS:  Foundations of Information Security and Assurance 1. There is a problem anticipating and testing for all potential types of non-standard inputs that might be exploited by an attacker to subvert a program. 2. Without suitable synchronization of accesses it is possible that values may be corrupted, or changes lost, due to over-lapping access, use, and replacement of shared values. 3. The biggest change of the nature in Windows XP SP2 was to change all anonymous remote procedure call (RPC)...

  • i will give a thumb up for sure if it helps me :) Please Summarize this...

    i will give a thumb up for sure if it helps me :) Please Summarize this article about Communicating competitive information,and Applying Game Theory To Managing Price Competition. Pricing Strategies Course -No longer than 400 words. Like any other type of market research, information about competitors will be most valuable if it is collected and stored in a systematic way. Activities such as shopping the competition should be done thoroughly and periodically. Information from different sources should be merged into...

  • 69. THE ENDOSPORE itself is might to stain_?_ color in an ACID FAST stain. (a) HOT...

    69. THE ENDOSPORE itself is might to stain_?_ color in an ACID FAST stain. (a) HOT pink (c) purple (d) green (e) baby-blue 70. All STAINS begin with a properly prepared _?_ . (a) dye (b) slide (c) smear (d) dog (e) cat 71. Which of the following is an ENDOTOXIN found in some microbes? This is results in fever, blood vessel dilation and possibly SHOCK when it is released into the human blood stream? (a) the plasma membrane (b)...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT