aleksandra

Input Devices

The Input Device week is based on my Fabkit board in made in Output Devices week Learning in Output devices how to trigger a motor with my fabkitaleks board, we have to read incoming signals with our fabkit board in Input Devices. Preparing for my final project I thought about sending light through an acrylic pipe and start a servo motor through a light detector.

For my first trial I´ve used a photoresistor from a funduino box. But I couldn´t find any Datasheet about it. So I started to do research about photoresistor and phototransistor photoresistor, Fotowiderstand, photodiode, Fototransistor. In Elektronik Kompendium there are nice descriptions of components, too.

plane plane plane

Above you can see on the left side a picture of a photoresistor, in the middle wavelength and symbol for photoresistor and on the right side the symbol for a photo capacitor.



First Step

Like in output devices I started with Arduino simpel programs. First with an example program for light detector and LED and then I´ve tried to combine it with a servo motor program. This came out:

plane plane

On the left picture you can see sensor and light, the right picture shows light, sensor and motor, but the light detector didn´t detect the light of the LED. Instead it detected the daylight. Also, Motor, LED were reacting on the sensor equally. I put the LED next to the sensor and bend the sensor towards the LED. Then I thought about the sequence I needed and decided to put the LED at the end of moving servo and entrance the if-loop with 5 seconds waiting befor starting motor. In the same way the sensor was detecting light several times per second and read the value at the moment the LED turns on. The LED has to be on in a period of time the sensor will definitly measure the light and starts procedure.


plane plane

LEDimpulse

Code for copying:
                    
                            #include <Servo.h>
Servo servoblue; int entrance = A0; int LED = 10; int sensorValue = 0; void setup() { Serial.begin(9600); pinMode (LED, OUTPUT); servoblue.attach(8); } void loop() { sensorValue = analogRead(entrance); Serial.print("Value at sensor = " ); Serial.println(sensorValue);/ if (sensorValue >500) { delay(5000); servoblue.write(0); delay(1000); servoblue.write(60); delay(1000); digitalWrite(LED,HIGH); delay(100); digitalWrite(LED,LOW); } }


It worked out and after some sequences I put a finger between the sensor and LED. The light sensor couldn´t measure the brightness of over 500 anymore and did nothing, stopped until I removed my finger and the sensor got the full brightness of the LED again.
Please see below a very short video, just to get an impression:





Now, I changed the distance of Sensor and LED and put an acrylic zylinder between them. The idea was to send a light through a curved plexiglas. The characteristic of acrylic material is that it transmits directional the incoming light.

plane plane

Only at the ends the light is coming out. The value of the brightness has to be measured before deciding the threshold in the code.

plane plane

The bottom picture on the right sight shows my right hand darkening the lightsensor and holding one illuminated end of the pole towards the sensor. My left hand is holding the other end of the acrylic loop facing the flashing LED.

Changing to Fabkit Aleksboard

As I knew, that my connection to serial monitor of Arduino will not work out. I read the sensor value before based on the above setting with an Arduino Uno. As you can see below, the transmitted light is about 800. I didn´t cover the sensor completely. The normal lighting conditions under my hand were under 500.

plane



plane plane

I always have to look up the settings for ISP header to get the head connected to the right pins of my fabkit. I feel a bit unconfortable with this, so I plan to change the design of my fabkit board a bit. The right picture shows my way of solving the VCC and GND problem for four components: my fabkit board, LED, light sensor, servo motor. In this drawing you can see that I´ve used 10kΩ resistor for my sensor and 200Ω for the LED.

For preparing the pin connections on my board I looked up at Arduinos pin definition for Atmega 328

plane

It worked out:

plane





Download Arduino file: Lightsensomotor
Download FabkitAleks schematics2
Download FabkitAleks board2