Intput devices



For this week's assignment we are supposed to use a micro-controlled board that we designed to read an input device.


To fulfill the assignment I decided to use a modified Satsha Kit originally made by Daniele Ingrassia and modified by me, Everything about this board is already documented in the Output devices' assignment.


The modified Satsha Kit


I have already developped a modified Satsha kit that I used before for output devices and I decided to use it again for Input devices as it perfectly serves the purpose.

Mountain View

-Here are the final images for milling. As mentioned before detailed steps are mentioned in previous documentation.


Mountain View
Mountain View


I used MDX-40A machine along with Fab Modules​ to control it
Here are the Milling settings:

Machine: MDX-40

Speed: 4

Send Command: mod_lp.py/dev/usb/lp0

Server: Localhost:12345 In my case Local host was 127.0.0.1

Cut depth: 0

Tool diameter: 0.2mm

Number of offsets: 4

Offsets Overlap: 55

Mountain View



Sensors


I decided to use 2 sensors as input devices LM35 temperature sensor and Ultrasonic Ranging Module.



Mountain View
Mountain View
Mountain View
Mountain View


-I connected the 2 sensors to my board based on the info I got from their datasheet and the datasheet of the microcontroller. I used digital pins for the sonar ranging module and an analogue one for the LM35. I read the 2 sensors in the same sketch



Mountain View

Mountain View

Programming



-I connected the board to the computer using an FTDI cable and used the Arduino IDE to program it.

Mountain View

 #include  <NewPing.h> 
 
#define TRIGGER_PIN  12
#define ECHO_PIN     11
#define MAX_DISTANCE 200
#define Led 13
#define Temp 0 
int distance=0;
int values[10];
int i,k=0;
float average,temp=0;  
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
 
void setup() {
  Serial.begin(115200);
    pinMode(13, OUTPUT);
 
}
 
void loop() {
  delay(50);
  Serial.print("Ping: ");
  distance=sonar.ping_cm();
  Serial.print(distance);
  values[i]=distance;
  i++;
  Serial.println(" cm");
  if(distance>=10) {
  temp=(analogRead(Temp)*0.05);   
  digitalWrite(13, HIGH);
  Serial.print("Temp: ");
  Serial.println(temp);  
}
  delay(500);
    if(i==10) {
      for(k=0;k<10;k++){average=average+values[k];}
  Serial.print("Average: ");
  Serial.println(average/10);
  i=0;
}
  digitalWrite(13, LOW);  

} 

Final product


Mountain View
Mountain View
Mountain View

-I measured the analogue output of the LM35 using the multimeter just to make sure that It made senese compared to the range of the sensor and the temperature I get from the code.

Mountain View



Downloads

-Schematic
-Board
-Arduino code






Source code is licensed under the terms of the GNU Lesser General Public License v2.1 (LGPL).

Projects, drawings, images and videos are licensed under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).

Ahmed Abdellatif 2017