This semester we worked on a board we made for our LEDs so we incorporated that into our final with an electromagnetic field detector. The whole detector was not very hard to get to work the hardest thing was getting the LED's to go the way we wanted with the right values being read from the probe. We went through many problems, like 3 weeks without Dylan but i feel like we tried and we got it to work alright. It will read values but we did not successfully get our LED's to light the way we wanted them to. We switched the constrain command, to that of map, which did ecactly what we wanted it to. Also, in the if command we start at 1 instead of 0, because 0 was for the else which turn off all the LEDs, and the repeatitive idea confused our arduino and made the reading inconsistant. this caused our LED graph to randomly light up and off. After making these simply fixes, out LED graph is much smoother and marketable. 

If we had more time and money, we would refine the quality of an antenna made just for detecting magnetic fields. Also, we would probably limit the number of LEDs to maybe ten, so that the range looked clearer, and it could be more easily marketed at hardware stores. It would also be nice if we could put all of the hardware into one single hand held device, so that it looked profesional. It would look something like a stud finder or the volt meter.

 Here is the program we ended with-
int Plus [] =  {8, 13, 12, 9, 8, 12, 13, 8, 9, 11, 13, 9, 10, 11, 11, 10, 10, 8, 12, 13, 9, 10, 10, 11, 12, 13, 12, 11, 9, 8};       //this the arrays, the positive on each LED is sync with corresponding negative
int Minus [] = {12, 8, 8, 12, 13, 9, 9, 11, 13, 8, 10, 11, 13, 9, 13, 12, 8, 10, 10, 11, 8, 9, 11, 12, 13, 12, 11, 10, 10, 9};
int inPin = 1; // this is the probe where we receive our reading
int val = 0; // this is the value that the probe reads
int aveval; // this is avg. being declared

void setup() {
  Serial.begin(9600);    //this sets the rate that the computer sends and recieves info
for(int pin = 8; pin < 13; pin++)  // sets all pins as an output

void loop() {
aveval=0;    // takes 10 readings and avg. them out to get a smoother reading
for (int x=0;x<10;x++)
  val = analogRead(inPin);

val=aveval/10;    //assigns them to val
  if(val >= 1){ // if its greater than 1 follow the if command
    val = map(val,0,1023, 1, 30);    // take the average readings between 1 and 1023 and map it so its between 1 and 30                                     

for(int x=0; x<val; x++) // run this command the # of times that the value says which is the number of LED's being lit up
   pinMode(Plus[x], OUTPUT); // makes the positive output
   pinMode(Minus[x],OUTPUT); // make negative output
 digitalWrite(Plus[x],HIGH); // turns on
 digitalWrite(Minus[x], LOW);// turns off
        delayMicroseconds(100); // delay lights 100 microsecnds
   pinMode(Plus[x], INPUT); // turns leds off
   pinMode(Minus[x],INPUT); // turns leds off

  }else{            // if there is no reading turns LEd's off

  for(int pin = 8; pin < 13; pin++)
 Serial.println(val); // allows us to see the readings on the arduino program                              


Here is the sketch of our LEDs.

This is the where our light board gets plugged in these are pins; 8,9,10,11,12,13


This is the LED bargraph we used for the amount of electromagnetic energy being read from our probe attatched to analog pin1.

You must be logged in to add gadgets that are only visible to you