Show Posts
Pages: 1 2 [3]
31  Using Arduino / Project Guidance / Re: [Newb] Automatic Fish Feeder // Needs Time on: March 15, 2013, 12:46:53 am
That simple eh?

BTW I would be a bit chary of that seeeduino stuff. It looks very expensive.

Agreed. I didn't want to wait on shipping though. To be honest I oblivious to the market when I bought it.

"Well this looks like it does things and stuff!" smiley-lol

"EDIT: Added a a function for the light so it turns off at night, and on in the morning."
32  Using Arduino / Project Guidance / Re: [Newb] Automatic Fish Feeder // Needs Time on: March 14, 2013, 11:43:28 pm
Can you provide a link to the sd card shield? D you know ifmit has a real time clock? That is what you want for time keeping.

I'm not fimiliar with ifmit. But I got the shield at RadioShack. Mine is black, I've seen blue. I don't know if there is a difference.

http://www.radioshack.com/product/index.jsp?productId=13297701



I guess you haven't got one already, so this is all you need. A real-time clock for $2.32.

http://www.ebay.com.au/itm/270985342203?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

will solve your problem, so rush out and get yours today. Use the SD card later for  recording events later.

That simple eh? smiley Awesome I'll order one tomorrow.
33  Using Arduino / Project Guidance / [Newb] Automatic Fish Feeder // Needs Time on: March 14, 2013, 10:42:24 pm
Greetings,
        First project, an automatic fish feeder for my Beta fish.

        Its pretty simple. It detects night & day via light reading from a photocell hanging out in my Window. It triggers the servo, which has a circular attachment (plastic piece that rotates). It has a whole it the circle that accepts 1-2 pellets from the food container that swings around to drop the pellets through a whole in the other side. I usually feed my beta about 4-5 pellets twice a day so it goes back and forth for food 3 times per feeding. It pauses for an hour after each cycle to allow the serial number to pass. I also hooked up a light as the fish bowl was pretty dark. I got it off of an LED flash light that had different modes so it can flash red when feeding then switch back to white. That's about it, simple works :].

       So I'm looking for some advice. I would like to incorporate a time system and get rid of the photocell for consistency. Being a newb, the only shield I have is the SD shield from seeedstudio and I really have looked into it much. I have checked out the tuts. and was going to look into data capture later to track the feedings. If I could use that to tell time, that would be great. But really open to opinions or code revisions.   

PICS/GALLERY: (The first pic with the cup, was first concept smiley-grin lol)
http://imgur.com/Wc2PCye,xziEpzz,0MEhtBs,VyZRudB,ItCemVJ

CODE:
PLEASE BE WARNED! I'm not very good at coding. I made it work though.

Code:
#include <Servo.h> //servo library import

Servo servo;

int photocellPin = 0;
int photocellReading;
int lightLvl = 0;
int pos = 0;
int bowlLight = 8;
int startLed = 13;

void setup() {
  pinMode(bowlLight, OUTPUT);
  pinMode(startLed, OUTPUT);

//Bowl Light initial setup // OFF-WHITE
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
 
  Serial.begin(9600);
  servo.attach(9);
}
 
void loop() {
  photocellReading = analogRead(photocellPin); 
 
  Serial.print("OFF = ");
  Serial.println(photocellReading);
 
  photocellReading = 1023 - photocellReading;
 
  lightLvl = map(photocellReading, 0, 1023, 0, 90);
  delay(15);
 

if (lightLvl == 30)
  {
  Serial.print("DAY FEED = ");
 
  //Change bowl light to alert(RED)
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
 
  //Shake food to loosin
  servo.write(140);
  delay(500);
  servo.write(50);
  delay(500);
  servo.write(140);
  delay(500);
  servo.write(50);
  delay(500);
 
 
  servo.write(160); //pickup pellet
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop pellet
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
           
    servo.write(160); //pickup
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
           
    servo.write(160); //pickup
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
 
     //Change bowl light back to WHITE
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(3600000);
  }

  else
  {
    servo.write(0);
  }
 
  if (lightLvl == 80)
  {
  Serial.print("NIGHT FEED = ");
     
     //Change bowl light to alert
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
 
    //Shake food to loosin
  servo.write(140);
  delay(500);
  servo.write(50);
  delay(500);
  servo.write(140);
  delay(500);
  servo.write(50);
  delay(500);
 
  servo.write(160); //pickup pellet
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop pellet
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
           
    servo.write(160); //pickup
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
           
    servo.write(160); //pickup
  delay(1000);
      servo.write(155);
      delay(500);
        servo.write(160);
        delay(500);
          servo.write(155);
          delay(500);
        servo.write(160);
        delay(500);
       
  servo.write(0); //drop
  delay(1000);
      servo.write(5);
      delay(100);
        servo.write(0);
        delay(100);
          servo.write(5);
          delay(100);
            servo.write(0);
            delay(100);
              servo.write(50);
              delay(500);
          servo.write(0);
            delay(1000);
 
    //Change bowl light back to WHITE
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(100);
  digitalWrite(bowlLight, HIGH);
  delay(100);
  digitalWrite(bowlLight, LOW);
  delay(3600000);
}
 
  else
  {
    servo.write(0);
  } 
}
34  Using Arduino / General Electronics / Re: Do you have any tricks for identifying chips? on: March 12, 2013, 05:24:23 am
Thank you all for sharing. Moral of the story, buy your chips lol.
35  Using Arduino / General Electronics / Re: Do you have any tricks for identifying chips? on: March 11, 2013, 02:05:11 am
some chips are proprietary, like black-boxes, some manufacturers use part numbers that overlap other manufacturers components.
sometimes looking for a chip, you cant find the exact number, so you can truncate the last few digits, like anything after a dash, to find the chip family data.

That makes perfect sense.

None of the chips I scavenged have a dash or anything of that nature. So when I found the "family", for the example chip above, "PS224". Stumped as to where to go from there. I suspect I should just trial and error or don't use them at all in that case.

Google "PS224" and the datasheet is the first item to come up. Googling works with many recent components but not some very old ones.
I can only see 8 pins in that photo. How did you get 16?

I found the results for PS224, but nothing for the second line of text. Back at square one.

That pic is just something pretty to look at. I do have some unidentified 8 pins as well though. 
36  Using Arduino / General Electronics / Do you have any tricks for identifying chips? on: March 10, 2013, 10:52:06 pm
Greetings,
        Ever since I got my hands on an Arduino, I've seen electronics in a different light. I had some dead electronics laying around so I thought I'd dissect them and use them towards future projects. As I retrieved some capacitors, diodes, chips, transistors etc., now I can't seem to identify some of them. I'm kinda hoping just like how someone can accurately search for the name of a pill (medication) online. You could do the same for electronic components? Or perhaps there is another method. I'm new to this, I'm trying to learn but Google isn't helping.

          Thank you!

For example, how would I find information about this chip:
    Size/Shape: Rectangle
     Symbol: A diamond shape within a square outline
      Pins: 16 pin
       1st line of text: PS224U
        2nd line of text: H08918A1F

37  Using Arduino / Programming Questions / Re: [Newb] DigitalRead - 1's & 0's in my "0's function" :S on: March 09, 2013, 04:29:21 pm
WOW! quick to respond!

Quote
The button circuit from 5v to GND,
If you actually did that you would short out the power supply.

My take on inputs:-
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Yeh, typo. It was supposed to be 5v > Button > Input Pin.


My write-up on handling switches:

http://www.gammon.com.au/switches


That's amazing! I'm getting solid numbers between states now after using the resistors.

It was the internal resistor on digital side GND that was throwing me off. As when I used it in the tutorials, but on my project I used the power side GND's.

Thanks for the advice and resource share Nick!
38  Using Arduino / Programming Questions / [Newb] DigitalRead - 1's & 0's in my "0's function" :S on: March 09, 2013, 03:26:58 pm
Greetings,
        New guy here, so first things first. Hello!  smiley-lol

        I picked up a Arduino Uno yesterday. So far I've been having a lot of fun messing around, trying to get feel for the basics. I didn't suspect it would be so addicting. smiley-grin

       I'm trying to make a small led light show for my first project but I'm having problems with digitalRead. The layout is very basic right now as I'm trying to plan. So I have two separate circuits. The button circuit from 5v to GND, which is the input when pressed. The other circuit is a simple led (pin 13, resistor, GND).

        The Serial Monitor is displaying 1's & 0's randomly when the button is off resulting in a low flicker of the led. Then all 1's when it is pressed, which is correct.

        In all honestly, I don't know if this is a programming or hardware issue. I've been trying different arithmetic to make it all 0's/off but to no avail (= 0 LOW, = 1 HIGH). If you have any suggestions they would be much appreciated.



Code:
//

int led = 13;
int in = 2;

void setup()
{
  Serial.begin(9600);
 
  pinMode(led, OUTPUT);
  pinMode(in, INPUT);
}

void loop()
{
  int state = digitalRead(in);
  Serial.println(state);
  delay(1);
 
  if (state > 0)
  {
    digitalWrite(led, HIGH);
  }
 
  else (state < 0);
  {
    digitalWrite(led, LOW);
  }
}
Pages: 1 2 [3]