I guess what you want is to not have direct access from outside (the internet) to the inside (your local network)?
To send a command through php you use curl to call the arduino instead, and the visitors on the page then calls that php page. Same way I do it for my home automation system.
In your first code, you set a position, go to it, set a position, go to it, etc.
In your second code, you set a position, and head towards it. Once you get there, you never set a new position or move again. Shouldn't you? There are methods to see if you are at the commanded position, so you can tell when to define a new position.
The first code is only like that because I got it to work, at first the new position was in setup to just make it move once, when that worked I stepped it up to move to a new position over and over.
With the second code I am still at the stage where I just want it to move to one position before going to the next.
But as far as I can see in the code it is possible to use just .run() in the loop to make it non-blocking while the stepper is getting to its position. The code for non-blocking would I expect would look like this, but it does not work as expected, instead it just makes a few steps and never gaining speed.
Code:
#define pinDir 2 //Pin for setting rotation direction #define pinStep 4 //Pin for doing the steps
***In stepper motors(bi-polar and unipolar) when it comes to torque and accuracy what best motor to use or ur best choice.. Btw i prefer bipolar here..
Will need torque and speed needed to be able to answer.
Would be using less pins if you went for something like this http://www.pololu.com/catalog/product/1182 and at the same time it would also be easier to control, since you only need a direction and step pin. If you want to control when the stepper should be enabled or not, it will take an additional pin, but it can be wires to be always enabled.
If the steppers only should run the same direction, you can go down to just the step pin, so only one wire will be needed for each motor.
Those SIM20 transceivers sounds interesting, but where can you get them? My electronics pushers seems to not have any of them, and google also failing to find me some that would actually show me any prices before buying...
The trigger in the mailbox will just be some simple micro switches with a long arm attached to them. The mail will then slide down of a little metal slide, run over the switches, then fall down to the bottom of the mailbox.
I am working on a new version of my snailmail notifier.
Old version:
But the problem with the sensor I hacked into, is that it got very low range. Description says up to 50 meters, but if it reaches 25 meters without anything in between, it is a good day...
So instead I am now looking into what I can do instead. I have looked a bit at using xbee's to do the wireless communication needed between the mailbox and receiver, but the price of them is a bit higher than I would like to spend on that. What could I use instead? I have looked at some NRF24L01 modules too, but they are on 2.4 ghz so I am afraid they will mess up my wifi too, as the 2.4 ghz wireless cameras do...
I have done some experiments with the simple 433 mhz rf modules too, but they also seem to be limited a lot when put into the mailbox (made from 1.5mm steel).
Another problem I also got is how to power it. I have thought about some rechargeable batteries, and then an arduino going to sleep to save power, and then some switches mounted where the letters fall through to wake it up again. But not sure how long that still would last, and what batteries would be good for something like this.
From mailbox to receiver there is 25-30 meters in a straight line.
The limits would really be the step size and the amount of weight of the "print head" plus suspension line. Both can be made much more easy to take care of by using a gear reduction system. The rest is just software...
Lead-free-solder, from the guys who brought you these rules too
And that article is full of errors... Or, maybe not errors, but things left out.
The thing with "Waters does not hydrate you." is not something they actually said, they just didn't want company's who bottled the water to claim that their water was more hydrating than normal water, and that is what some had done, even when it was absolutely normal water in the bottles.
And "Diabetics are banned from driving" no they are not, they are if they got 2 dangerous attacks from it within a year, then yes. And why is that so bad? Or is it better when they can end up driving like in those youtube video's with people getting ill while driving, changing onto oncoming traffic, or are close to hitting pedestrians? There are many stupid rules made, but some of them are also made worse than they actually are, just because some need something to complain about. If someone get ill while driving and kills someone, people complain too, but that also cost a life.
SO - in Europe, if you get shot by a shotgun, will you die from steel poisoning?
If you were shot by a lead bullet, if it were not in a vital area you would still not die from lead poisoning. Elemental lead, in and of itself, is fairly benign, it is the various compounds of lead that make it dangerous. Paint used to contain various oxides of lead. Lead dust oxidizes and forms other compounds much more readily that does solid chunks, because of surface area.
I am not saying that lead is by any means harmless, but , as with many things in life, we can become so alarmed by the "possible" harm that we overlook the many more hazardous things we deal with in everyday life. Like Gasoline...
I am pretty sure that you are exposed to being shot way less than you are to being exposed to it other places... And we don't have gasoline with lead in either, that got removed many years ago.
Could you post the components -electrical circuit when you get time . I see it is very recent but I could find nothing on the Utube site about that either. Thanks
It is pretty simple, but can try to see if I can get a diagram made over it.
Also a nice chicken feeder, let me know if you need something to put over that hole on the outside, I can print you a thing a bit like the one I got on mine where it falls out.
It is controlled by an arduino ethernet, and can be started from my website.
Around the bottom of the bowl collecting the food, there is a printed white ring with 8 blue led's under. The led's are controlled by a 74HC595N shift register and makes a wipe animation while food is dispensed, and will circle around 30 seconds after the motors has stopped. After the 30 seconds all led's will be turned off.
#define motorPin 2 unsigned long timeStart = 0; unsigned long timeRun = 0; unsigned long timeRunLast = 0; /* Ethernet stuff */ #include <SPI.h> #include <Ethernet.h>
// Enter a MAC address and IP address for your controller below. // The IP address will be dependent on your local network: byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 0, 177);
// Initialize the Ethernet server library // with the IP address and port you want to use // (port 80 is default for HTTP): EthernetServer server(80);
boolean currentLineIsBlank;
/* Ring light stuff */ #define ringUpdateRate 100
int dataPin = 7; int latchPin = 6; int clockPin = 5;
// listen for incoming clients EthernetClient client = server.available(); String inString = String(35); //Used to hold the string from the ethernet shield
while (client.connected()) //We got a client online { if (client.available()) { char c = client.read(); inString += c;
if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println();
break; }
if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(1);
int startCommand = inString.indexOf('_'); // Find the start of the command to send int stopCommand = inString.indexOf('_', startCommand + 1); // Find the stop of the command to send
if (startCommand > 0 && stopCommand > 0) // If we got a valid command... { client.print("Running for "); // Show on the reply what message we send, just for debugging client.println(inString.substring(startCommand+1, stopCommand)); // Cut away the stuff that are not a part of the command client.println(" milliseconds");
timeRun = string2int(inString.substring(startCommand+1, stopCommand)); timeRunLast = timeRun; timeStart = millis(); } // close the connection: client.stop();
inString = ""; }
int string2int(String func) { char* output;
String temp = String(35);
String getPinDel = func; char tempNum[10]; tempNum[getPinDel.length() + 1]; // Temp save pin value getPinDel.toCharArray(tempNum, 10);
return atoi(tempNum); }
unsigned long lastRingUpdate = 0; void updateRing() { if (millis()-lastRingUpdate < ringUpdateRate) return; if (ringMode == 1) { if (ringStep == sizeof(running)) ringStep = 0;
digitalWrite(latchPin, LOW); //Pull latch LOW to start sending data shiftOut(dataPin, clockPin, MSBFIRST, running[ringStep]); //Send the data digitalWrite(latchPin, HIGH); //Pull latch HIGH to stop sending data } else if (ringMode == 2) { if (ringStep == sizeof(wipe)) ringStep = 0;
digitalWrite(latchPin, LOW); //Pull latch LOW to start sending data shiftOut(dataPin, clockPin, MSBFIRST, wipe[ringStep]); //Send the data digitalWrite(latchPin, HIGH); //Pull latch HIGH to stop sending data } else { digitalWrite(latchPin, LOW); //Pull latch LOW to start sending data shiftOut(dataPin, clockPin, MSBFIRST, B00000000); //Send the data digitalWrite(latchPin, HIGH); //Pull latch HIGH to stop sending data ringStep = 0; }