Long distance proximity detector

Hello.  Does anybody have any idea on how to make a very cheap proximity sensor, which could work over a distance of about 100 metres? I want to make a system where LEDs (carried by people!) change colour as they approach a certain point, i.e, white LEDs turn red as they move towards a central point. The problem is I want to have 50+ separate LEDs, and I'm on a very tight budget! Any ideas appreciated. Thanks!

Topic by megbrazil   |  last reply


long range Transmitter ?

Hi, i'm working on a project, and i need a high range transmitter to send a signal to a receiver from a distance of at least 1 mile (1.6 Km) is it possible ? Thanks :)

Question by fox.sadik   |  last reply


Long Distance WiFi - From Apartment to Work (0.5/1mile)?

Hi there, I would like to access my WiFi from my apartment, when I am at work. Distance between the two is about 0.5 - 1 mile.  How would I go about doing that? I did some research and most likely I would need to set up 1 antenna transmitting the signal from my apartment, to a 2nd antenna at my work receiving the signal. The receiving antenna though, I would like to be small and not as awkward like. I work in an industrial plant, that is built out of solid concrete, as I say that, I do get good reception inside there, just don't know about WiFi though.. Good news perhaps is, I work nearby a big garage door, so maybe I could get signal from there. Anyways, If you got suggestions please let me know. Thanks! 

Question by Scriptom   |  last reply


how can i call my friend with out the use of money or a phone? Answered

My friend is long distance and if i want to call him i cant because my phone charges for long distance and i dont want to pay for skype any ideas around this?

Question by knexsuperbuilderfreak   |  last reply


Make the ping distance match the pot distance?

Hi I have a Personal Fan that is working.  But, I am trying to change the ping distance to operate a rely. Trying to get the Ping distance to track a pot input so the distance the fan will come on can be changed by the pot. In the serial monitor the pot input will change from 0 to 1024. I was not able to get the ping distance to read out and how to make the Distance value track to the input pot? Thanks to anybody that could look at this ad steer me in the write direction.  #include "Ultrasonic.h" int RELAY = 9;  // RELAY Pin. Ultrasonic sensor1(11,10); // Ultrasonic(int TP, int EP); //int TRIG = 11; // Trigger Pin //int ECHO = 10; // Echo Pin int Range; // The range of the object from Ping Sensor int Dist; // The Distance value int POTPIN = A1; //#declare relayState; int  relayState; //int distPot; distControl; //#declare distPot; int distPot; //#declare distControl; int distControl; long cm; //distance min and max const int minDistance = 2;  //dist in CM dont go below 2 const int maxDistance = 200;  //dist in CM //Ultrasonic ultrasonic(TRIG,ECHO); // Create and initialize the Ultrasonic object. void setup() {   pinMode(RELAY, OUTPUT); //To the relay via the transistor   //Dist = 15; //The distance in inches. Change this for increasted or dicreasted range. Dist = map(Dist,0, 5, 1, 1023); Serial.begin(9600); } void loop(){   //Range = ultrasonic.Ranging(CM); // Range is calculated in Centimeters. Dist = analogRead(POTPIN);   // check the distance pot   distPot = analogRead(Dist);   //distControl = map(distPot,0,1024,minDistance,maxDistance);   distControl = constrain(RELAY,0,255);   if(relayState){     Dist  = distControl.Ranging(CM);     digitalWrite(RELAY,HIGH);   }      else{      digitalWrite(RELAY,LOW);   }    // RELAY = map(cm,distControl,minDistance); //variable map formula relationship     RELAY = constrain(RELAY, 0, 255); //int i = analogRead(POTPIN); // if (i == Dist)digitalWrite(RELAY,HIGH); // else digitalWrite(RELAY,LOW);   //Range = ultrasonic.Ranging(INC); // Range is calculated in Inches.     //if (Range < Dist) {     //digitalWrite(RELAY, HIGH);     //} else if (Range > Dist)      //digitalWrite(RELAY, LOW);      //delay(90);   Serial.print(Dist); Serial.println("inch"); delay(100); //Serial.print(sensor1);   Serial.print(distControl); //Serial.println("POTPIN"); delay(100); }

Question by WWC   |  last reply



how to maintain the intensity of IR at long distance and make it directional

We are trying to make an infrared shooting game which includes a transmitting gun and a receiving jacket.as everyone knows IR is not directional so at long distance it will diverge but in shooting game we need a pointed IR beam. is there any technique implement this?? we need help..! :(

Topic by FypB   |  last reply


Create standstill effect with LED from hall effect sensor ?

Hi everyone, A little bit info of what I'm working on. I am trying to create a standstill effect of the spokes of the car rim. I attached a hall effect sensor and a magnet to inside of the rim . I have tried 2 different approaches : ( code for each method are also attached)              1. use the hall effect sensor to determine the RPM of the rim and then flash the led accordingly to the spokes on the rim. The problem with this approach is that the led flash quite dim and and the spoke image rift.  I cant find the right windows for flashing LED.               2. use the the hall effect sensor to detect any magnetic field and then flash whenever it is detected. This method is quite simple but the effect is blurry. The problem for this is that the magnet detection happen on the arc of the rim instead of at 1 pin point location. Hence the led is on for too long --> blurry effect. I also attache some diagram to explain my problem in case I didn't do well with words.  Do you have any suggestion, solution or comment on the approaches or the code. Please feel free to throw in. Im all ear.  Code:  Method 1: Calculating RPM then flash led : http://txt.do/5b9is I am leaning toward this method but the effect is rifting. Not entirely sure how to fix it or what could possibly cause it.  to clarify: the rifting effect happen when i use 2 magnets on the rim. with only 1 magnet, it still rift but the led very dim, almost unnoticeable.  Method 2:  Image for the 2nd approach in case the pictures didnt show on instructables the front : http://imgur.com/HwFm1lT the back : http://imgur.com/1DvWjZK the side : http://imgur.com/RHZIbfR The problem : http://imgur.com/RHZIbfR flashing LED whenever sensor detect the magnet: http://txt.do/5b9b7

Question by Jack Vu   |  last reply


how to send ups signal to long distance through a mobile or pc (with internet)?

I want to use my UPS to know my home power failure, when i'm at office(its like 50 km distance). please submit detailed diagram. 

Question by sripeople   |  last reply


How to make a DIY relatively long distance radio signal emitter/tracker? Answered

Hi, This is a bit of a two-parter. The first part is that I would like to make a DIY radio emitter that could transmit to a distance of 1km. I'm not sure about the laws in South Africa, but it should be legal if within the ranges prescribed by the law. The second part is that I would like to create several devices that could track the nearest radio signal on a specific band or band range (as I would expect that I would have to use a filter for both the transmission and receiving). I think that direction of the source of the signal would be sufficient.  The reason for this is that I have had a few instances over the years where people got lost while camping and had to sleep in the wilds because it was too dark to find their way back to camp. Any advice, thoughts, links would be much appreciated. Also, if you have any other ideas that will cost about the same or less, that would be awesome to try out, too :) Best regards, Vuur

Question by Vuur   |  last reply


What is the best 10mm LED light for distance?

HI I'm making a LED torch and i have purchased some 290000 mcd LED lights.I think i will put them in a ring inside the torch which will allow me to see clearly in front of me.Then i thought i could put a long distance light in the middle would allow me to see out further  but i am unsure of what LED light is best for this task.Basically i am after a LED light that shines really far.

Question by Mattdog123   |  last reply


the distance of others planets measure with tausends of years of light speeds. Answered

How come a ufo creator on board reach to earht.are thair life too long to do it?

Question by tayyareci   |  last reply


Shock Collar activated by mobile phone call/text?

Hi,  I want to convert an electric shock collar to be activated by a call or text sent from my mobile phone. It has to operate long distance, so I assume some sort of stripped-down mobile device will be needed that can receive a mobile signal.  I have no idea how ot go about this, anybody have a solution for me? Does a device like this already exist, here or on the market?  I tried shopping about but could find no commercial device of this nature, only 'long range' RF shock collars with a maximum range of 1000 metres. 

Question by Ohnanka   |  last reply




In Need of Wifi Help? Need to Make a 1.8 Mile Connection HELP? Need some Ideas!

I need some help making a long distance connection Any help is well appreciated!'MY GEARI'm using a PowerBook G4 laptop, HP Pavilion notebook, and a MacPro Desktop. An Apple Base Station for my in-house network. The Base Station has an external pigtail antenna connector.'MY PROBLEM'I live out in the country about 1.8 miles away from Subway (in town) which has a FREE open network with speeds at around 900-1.3mbps. Since I live in the country, an expensive satellite setup just isn't going to happen. I'm only 1.8 miles away from Subway and I'm sure there is a way I can reach the network with a some help, supplies and ingenuity. I read that people are reaching 3, 5, even 10t to 15 or more miles with DIY antennas. Line of sight from my house to Subway isn't the best, there are some obstacles like trees and houses in the way, so there's no direct line of sight at all.'SEARCHING'I searched the forum for some ideas. I tried one antenna from the site with a wifi USB-G adapter I had sitting around and was able to reach close to a mile and the signal was really weak. I wasn't using the Base Station, just plugging the adapter into my Mac laptop and using the software it came with. It's a hawkins wifi usb adapter for the Mac.'IDEAS'I was thinking of setting up an enclosed solar powered transmitter, using circuitry from one of the two 2.4gzh 5-mile walkie talkies I have, and placing it at a not so visible spot at Subway. The other one would be adapted to my Base Station which I would still have control over the network creating a closed hidden network with WEP encryption, but not sure. This is where I could use some help and your ideas? An antenna seems like the best and easiest approach but I'm not sure how to get it to reach 2+ miles and maintain high speeds.Any helpful advice, links, photos, etc. would be great! Thanks!'

Topic by zoozack   |  last reply


any ideas on ground wave radio control? Answered

So I have a pipe dream of building an extremely long range remote controlled boat (100's of kilometers). from my research it seems as if I would need to broadcast my control signal at less than 30 MHz so that the waves travel along the ground and less power is used for longer range. I am up to my ears in designs for the vehicle itself, but I am struggling as to how I would communicate data for such long distances. I have considered adapting Ham radios, and making a sound controlled robot. but this seems unreliable. So... any ideas? Thanks for your help :)  -Cheeseboy

Question by cheeseboy   |  last reply


Long Range Off the Grid WiFi Repeater

Hello Everyone,  I've got quite the project that I am undertaking and I am looking for a bit of advice. This will be my very 1st forray into long-distance wifi, as well as off-grid power resources, so Im biting off quite a bit at once! I have a friend who has been helping me with the research who has a much firmer understanding of both electricity and hardware, but he will be out of town for the next week and I would like to get a bit of progress on this while he is gone. SO, I shall consult the hive mind known as the internet. Alright, this project consists of creating an uplink between a remote shed, and a home in a nearby city, with a broadband connection. The rub, there is 10,000 ft mountain range in between the two. We have a site were we can put a repeater node at approx. 10,000 ft elevation, that has wonderful line-of-sight to both locations. However, this site is very remote, and will have to run off the grid obviously. The distances are as follows: Home to repeater: 3.96 miles (thats with Google Earth following the contours of the          mountain/valley, not sure how to make it just do a straight angled shot, so thats a rough estimate) Repeater to Remote shed: 2.68 miles (same issue) Background environment info: shed has generator + 60w solar array with 3-4 deep discharge lead RV batteries at 7400 feet. Has spring fed running water, which could be utilized for power as well, as obviously its always running. Repeater location is at 10k, as stated. Moderate to high winds very likely (data from peaks of similar altitude in the general area show gusts ranging from 40-60 mp/h, temperature ranges of  averaging 7 to 90+ for a the later part of July and August (F). Obviously, its very possible to get soemething below this, though the lowest Ive ever seen at the shed has been -15 (f), I would say most winters we could get a few nights that see temps below 0, but not often. Equipment Ideas: So to pull this off, we have come up with two ideas for the network equipment, which I shall discuss 1st, then I will show you what we have come up with for power.  - Network    - Repeater Node: rb433 wireless access point ($99.00) http://www.routerboard.com/pricelist.php?showProduct=43         with 2 r52h mini PCI wifi chips ($59.00 x2) http://www.routerboard.com/pricelist.php?showProduct=69         2 8-18 inch satelite dishs converted for long-range WIFI use (20.00 x2) http://www.engadget.com/2005/11/15/how-to-build-a-wifi-biquad-dish-antenna/ OR instead of a rb433, we could use 2 WRT54G Linksys routers like this. (I also have 2 BEF 801.11b routers that are legacy to the WRT54G. I would like to use this if possible! http://hackaday.com/2005/08/23/how-to-greyhat-wifi-repeater/ Now, I know that this later choice would increase power use by about double. From what I have been able to find, the WRT's would at anywhere from 4.2w to 8w of power. Anyways, I like this later choice because it would be significantly cheaper for the equipment, but do you have any other ideas? I know that the RB433 would work great, but its rather expensive all said and done after I throw up the power as well. Plus, if it takes a lighting strike, its out of commission, and 2 cheap linksys routers are much cheaper to replace! Anyways any input here would be great! - Power  so power to the repeater node is the real challenge. We crunched the numbers and came up with something almost exactly the same as below: From the datasheets, a routerboard will draw between 6-10W. So design for 10W. Over 24 hours you will need 10Wx24h = 240 Watt.Hours of power. For 7 days, you need 7x240Wh = 1680 Watt.Hours. A single, large deep cycle 110Ah 12V battery gives you about 1320 Watt.Hours of power, almost meeting the requirement. Now, to look at the solar panels: A good rule of thumb is to install 6 times the wattage that is drawn by the device. This is because only about 8 hours a day in sunny weather gives you maximum power output from a solar panel. So the other 16 hours you need to draw from the battery. (So already you need 3 times the wattage drawn by the device to break even each day) To generate 1 full day of extra battery power per sunny day, you need another 3 times the wattage. This is how we arrive at 6 times. 6 x 10W = 60W. So at a minimum I would recommend 60W of solar panels. That qoute comes from http://diywifilink.wordpress.com/ and http://mybroadband.co.za/vb/showthread.php?179547-Advice-needed-Setting-up-wifi-repeater-11km which is a project from a guy in South Africa almost exactly the same as the one that we are working on. The numbers came out to be about the same (Though they were a bit different when we calculated for the WRT54G option.) so, 60w of power generation to keep a decent charge on a battery. Now, we have a 60w panel at the shed, which is rather large to take up to 10,000 ft and place on the side of a mountain, and given the consistent wind element up there, we are hoping to do a hybrid system of both solar and wind. This is where things get tricky. A perfect balance, or even a more wind heavy balance would be great, such as 30-40w wind 20-30w solar. That keeps the panel size down, and uses a power source that runs 24/7. A Faroun Savonius wind turbine seems like the best system, but the controller to prevent overcharging etc is where I get nice and lost, having breached into very unknown territory. https://www.instructables.com/id/Faroun-Savonius-Wind-Turbine/ http://www.fieldlines.com/board/index.php/topic,129060.html This looked at 1st like a good, cheap system to use a controller board for the wind, but my question is would the controller board that comes with these solar panels (see below) work for both. That below is the setup that we use more or less at the shed, with some mods, such as a better alternator. http://www.costco.com/Browse/Product.aspx?Prodid=11298029&search;=solar&Mo;=5&cm;_re=1_en-_-Top_Left_Nav-_-Top_search&lang;=en-US&Nr;=P_CatalogName:BC&Sp;=S&N;=4001192&whse;=BC&Dx;=mode+matchallpartial&Ntk;=Text_Search&Dr;=P_CatalogName:BC&Ne;=4000000&D;=solar&Ntt;=solar&No;=3&Ntx;=mode+matchallpartial&s;=1&topnav;=&Nty;=1&s;=1 So, can a small, 30-50w wind turbine and generator be built, with a small solar array to power this thing? I dont care if we have some down time, this is primarily going to be used as a system to get a weather station with web cam to send in hourly photos during the peak hours. I can have the system at the shed shutdown automatically  using some cron jobs in linux during the evening to conserve power. When there are people at the shed, we would like to be able to get a good enough wifi connection to use a wifi device (such as an android phone or ipod) to use as a voip phone in essential communication. The teenagers aren't going to be chatting with their friends for hours, but we would like to be able to put a short call through in case something goes wrong, or we just need to get ahold of someone at the shed or in the city. Next the equipment at the shed should be comparable to the repeater node,  sans 1 antenna and just some low power embedded system. We would like to get a webcam and weather station hooked up on this end, but that can wait for upgrades later if needed, if power doesnt allow it. like I said, a simple water turbine could be used (something similar to the wind turbine perhaps?) and even another wind turbine could be built to add extra power dedicated to running any system at the shed, though I dont think the wind is quite regular enough to be viable here, but if its cheap, we could throw it on anyways. equipment at the home in the city is simple, just use an extra laptop or desktop we have laying around to be server/router, hook up antenna to this, broadcast connection, run the weatherstation/webcam web server off of this. So, thats the plan, but load of input is needed to try to come up with this. We hope to try to keep this sub $1000.00, but the budget could go higher. This is DIY at its finest! Thanks in advance for you help!

Topic by kydan   |  last reply


Airfoil (structure glider)

Which airfoil is best for a good structure glider (for long distance)? and please tell me some app for design and analyse glider (or model aircraft/)...

Question by vergil I   |  last reply


can anyone tell me how to actually start an e learning course i.e long distance education course?

My mum wants to start teaching dance over the internet to students abroad... i need to know how to exactly go about it starting right from web design, advertising, registration(if there is any) and actually start teaching... something like a video chat room... instead of chatting, we'll be taking classes. i have absolutely no idea how to go aout it so any help would be greatly appreciated... thanx

Question by ravimaiden   |  last reply


Need Help with a simple arduino code plz?

HELLO instructables , i need help with writing an extra simple code over my arduino code that simply works with the arduino code i wrote , the description of what i want is very simple ,  I've got an ultra sensor i want if it reads a distance of less than or 10 cm it makes a red LED goes on. I've this arduino code written so can u plz tell me what should code shall i write to work with it  ?  #include #define trigPin 7 #define echoPin 6 Servo servo; int sound = 250; void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); servo.attach(8); } void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance < 10) { Serial.println("the distance is less than 10"); servo.write(90); delay(100); } else { servo.write(39); } if (distance > 10 || distance <= 0){ Serial.println("The distance is more than 10"); } else { Serial.print(distance); Serial.println(" cm"); } delay(2000); }

Question by Tigernoob   |  last reply


i will the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/*  2011-10-03  robot4wd_06.pde  Eric Pavey - www.akeric.com  This software is released to the wild, free to be used and modified.  If you use it,  I just ask for some credit ;)    Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor  and a servo for collision detection.    Hardware:    Arduino Duemilanove (but I'm sure any others will work)  http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove  Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis.    Main chassis is the "4wd mobile platform" from DF Robot  http://www.dfrobot.com/index.php?route=product/product&path;=37&product;_id=97  http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8  http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile    Motor control using the Adafruit motorshield:  http://www.ladyada.net/make/mshield/index.html  There doesn't seem to be API docs, but there is this header file:  https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h  Motor shield is powered off 4xC batteries (6v).    Paralax ping))) :   http://www.parallax.com/tabid/768/ProductID/92/Default.aspx  http://www.arduino.cc/en/Tutorial/Ping  Notes:  I had to rewire the ribon connecting the ping to the motorshield:  The  ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal.  It works from 2cm to 3m.    Paralax (Fubata) "standard servo":  This is found in the "PING))) Mounting Bracket Kit":  http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx  This is plugged into the 'servo2' port on the motorshield.  It uses the servo library:  http://arduino.cc/en/Reference/Servo    Much of the ping code at the bottom is taken straight from the Arduino examples.  */ //-------------------------------------------------------------------------- // Library include stuff: #include   // needed for the motorshield. #include   // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0;  // used for collision detection int g_rightDist = 0;  // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees.  98 is straight ahead based on how I mounted the servo (it must be     // a little inaccurate).  full left is 180, full right is 0.     // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right?  Max is 180, full right. int g_servoLeft = 45; // how far left?  Min is 0, full left. // time stuff unsigned long g_time;  // global time tracker unsigned long g_ptime;  // global previous time tracker unsigned long g_elapsed = 0;  // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps).  This slows down the processing allowing the     // multiple systems to play nicely together.  Make this number smaller and it won't have enough     // time for each state to run properly:  The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for.  Since we don't know how far     // it turns, we just guess on how long it should.  The type of terrain turing on has a great     // effect on what this should be.  This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() {   // Attach & center the servo:   g_servo2.attach(g_servo2pin);   g_servo2.write(g_servoCenter);  // center it by default   // Setup our framerate stuff   g_time = millis();   g_ptime = g_time; } void loop() {   // Main program entry point.     // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets   // to the ping the faster it will aim, and do bad stuff.   g_ptime = g_time;   g_time = millis();   g_elapsed += g_time - g_ptime;   // Wait for the proper amount of time to pass before we do anything:   if(g_elapsed < g_interval){     return;   }   else{     g_elapsed = 0;   }   //  Do stuff, based on the current mode:   if(g_mode == 1){     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way, drive!       if(g_driveDir != 1){         g_driveDir = 1;         move(g_driveDir);       }     }     else{       // if we're too close to something, stop the motors and switch to 'proximity check' mode:       if(g_driveDir != 0){         g_driveDir = 0;         move(g_driveDir);       }       // initialize the proximity check stuff:       g_checkLeft = false;       g_checkRight = false;       g_checkCenter = false;       g_leftDist = 0;       g_rightDist = 0;        // switch to mode 2:       g_mode = 2;        }   }   else if(g_mode == 2){     // Do proximity check!     boolean checked = proximityCheck();      if(checked){       // Define which direction to turn.       // If the right distance is greater than the left distance, turn that direction,       // otherwise go the other way:       if(g_rightDist >= g_leftDist){         g_driveDir = 2;       }       else{         g_driveDir = 3;       }       // now that we've set which direction to turn, start timing how long the turn       // has taken, and switch to mode 3.       g_turnUntil = millis() + g_turnlength;       g_mode = 3;     }   }   else if(g_mode == 3){     // We must be turning!  The logic for switching to other modes is in that function.     turn();   } } //-------------------------------------------------------------------------- // Helper functions: void turn(){   // Executed when g_mode == 3   // Used to turn the robot.     if (millis() < g_turnUntil){     // keep'on turning...     move(g_driveDir);   }    else{     // If we're done turning, see if there is anything still in our way:     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way go back to mode 1:       g_mode = 1;     }     else{       // If stuff is still in our way, turn more in the same direction until       // not blocked:       g_turnUntil = millis() + g_turnlength;     }   } } boolean proximityCheck(){   // Used when mode == 2:  Swing the ping left and right taking readings to   // find which way is safe to go.  Returns false when in the middle of the check   // operation, returns true when entire check process is complete.     // Current angle of the servo:   float angle = g_servo2.read();     // check left first: ( full left is 0 deg)   if(g_checkLeft == false){     if(angle > g_servoLeft){       g_servo2.write(angle-10) ;       return false;        }     else{       g_checkLeft = true;       g_leftDist = ping();       return false;       }   }   // check right second: ( full right is 180 deg)   if(g_checkLeft == true && g_checkRight == false){     if(angle < g_servoRight){       g_servo2.write(angle+10) ;       return false;          }        else{       g_checkRight = true;       g_rightDist = ping();       return false;     }   }   // Go to center position third:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){     if(angle != g_servoCenter){       g_servo2.write(angle-10) ;       return false;     }           else{       g_checkCenter = true;       return false;     }   }   // Finally if we've checked left, right, and got back to center, return true   // to tell the later code that the full check is complete:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){     return true;   }   else{     return false;   } } void move(byte mode){   // This function moves the wheels.  Can be called to when mode == 1 (driving) or 3 (turning).   if(mode == 0){     // all stop!     g_motor1.setSpeed(0);     g_motor2.setSpeed(0);     g_motor3.setSpeed(0);     g_motor4.setSpeed(0);   }   else{     // full speed!     g_motor1.setSpeed(g_motorSpeed);     g_motor2.setSpeed(g_motorSpeed);     g_motor3.setSpeed(g_motorSpeed);     g_motor4.setSpeed(g_motorSpeed);         // full speed, but which direction?     if(mode == 1){       // go straight       g_motor1.run(FORWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(FORWARD);     }     else if(mode == 2){       // turn right       g_motor1.run(FORWARD);       g_motor2.run(BACKWARD);       g_motor3.run(BACKWARD);       g_motor4.run(FORWARD);      }     else if (mode == 3){       // turn left       g_motor1.run(BACKWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(BACKWARD);     }   } } float ping(){   // Returns the distance in cm from the ping sensor.  Pulled from   // Arduino docs.     // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.   // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:   pinMode(g_pingPin, OUTPUT);   digitalWrite(g_pingPin, LOW);   delayMicroseconds(2);   digitalWrite(g_pingPin, HIGH);   delayMicroseconds(5);   digitalWrite(g_pingPin, LOW);   // The same pin is used to read the signal from the PING))): a HIGH   // pulse whose duration is the time (in microseconds) from the sending   // of the ping to the reception of its echo off of an object.   pinMode(g_pingPin, INPUT);   long duration = pulseIn(g_pingPin, HIGH);    float cm = microsecondsToCentimeters(duration);   return cm; } long microsecondsToCentimeters(long microseconds){   // Simple conversion setp, kept as a function simply to illustrate   // how it works.  Pulled from Arduino docs.     // The speed of sound is 340 m/s or 29 microseconds per centimeter.   // The ping travels out and back, so to find the distance of the   // object we take half of the distance travelled.   //return microseconds / 29 / 2;   return microseconds / 58; }          // while(val == HIGH) {                  // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1;             // Count echo pulse time} //ultrasoundValue = timecount;          // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL  cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}    

Question by pe2hlc   |  last reply


Im will create the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/* 2011-10-03 robot4wd_06.pde Eric Pavey - www.akeric.com This software is released to the wild, free to be used and modified. If you use it, I just ask for some credit ;) Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor and a servo for collision detection. Hardware: Arduino Duemilanove (but I'm sure any others will work) http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis. Main chassis is the "4wd mobile platform" from DF Robot http://www.dfrobot.com/index.php?route=product/product&path=37&product_id=97 http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8 http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile Motor control using the Adafruit motorshield: http://www.ladyada.net/make/mshield/index.html There doesn't seem to be API docs, but there is this header file: https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h Motor shield is powered off 4xC batteries (6v). Paralax ping))) : http://www.parallax.com/tabid/768/ProductID/92/Default.aspx http://www.arduino.cc/en/Tutorial/Ping Notes: I had to rewire the ribon connecting the ping to the motorshield: The ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal. It works from 2cm to 3m. Paralax (Fubata) "standard servo": This is found in the "PING))) Mounting Bracket Kit": http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx This is plugged into the 'servo2' port on the motorshield. It uses the servo library: http://arduino.cc/en/Reference/Servo Much of the ping code at the bottom is taken straight from the Arduino examples. */ //-------------------------------------------------------------------------- // Library include stuff: #include // needed for the motorshield. #include // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0; // used for collision detection int g_rightDist = 0; // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees. 98 is straight ahead based on how I mounted the servo (it must be // a little inaccurate). full left is 180, full right is 0. // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right? Max is 180, full right. int g_servoLeft = 45; // how far left? Min is 0, full left. // time stuff unsigned long g_time; // global time tracker unsigned long g_ptime; // global previous time tracker unsigned long g_elapsed = 0; // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps). This slows down the processing allowing the // multiple systems to play nicely together. Make this number smaller and it won't have enough // time for each state to run properly: The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for. Since we don't know how far // it turns, we just guess on how long it should. The type of terrain turing on has a great // effect on what this should be. This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() { // Attach & center the servo: g_servo2.attach(g_servo2pin); g_servo2.write(g_servoCenter); // center it by default // Setup our framerate stuff g_time = millis(); g_ptime = g_time; } void loop() { // Main program entry point. // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets // to the ping the faster it will aim, and do bad stuff. g_ptime = g_time; g_time = millis(); g_elapsed += g_time - g_ptime; // Wait for the proper amount of time to pass before we do anything: if(g_elapsed < g_interval){ return; } else{ g_elapsed = 0; } // Do stuff, based on the current mode: if(g_mode == 1){ g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way, drive! if(g_driveDir != 1){ g_driveDir = 1; move(g_driveDir); } } else{ // if we're too close to something, stop the motors and switch to 'proximity check' mode: if(g_driveDir != 0){ g_driveDir = 0; move(g_driveDir); } // initialize the proximity check stuff: g_checkLeft = false; g_checkRight = false; g_checkCenter = false; g_leftDist = 0; g_rightDist = 0; // switch to mode 2: g_mode = 2; } } else if(g_mode == 2){ // Do proximity check! boolean checked = proximityCheck(); if(checked){ // Define which direction to turn. // If the right distance is greater than the left distance, turn that direction, // otherwise go the other way: if(g_rightDist >= g_leftDist){ g_driveDir = 2; } else{ g_driveDir = 3; } // now that we've set which direction to turn, start timing how long the turn // has taken, and switch to mode 3. g_turnUntil = millis() + g_turnlength; g_mode = 3; } } else if(g_mode == 3){ // We must be turning! The logic for switching to other modes is in that function. turn(); } } //-------------------------------------------------------------------------- // Helper functions: void turn(){ // Executed when g_mode == 3 // Used to turn the robot. if (millis() < g_turnUntil){ // keep'on turning... move(g_driveDir); } else{ // If we're done turning, see if there is anything still in our way: g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way go back to mode 1: g_mode = 1; } else{ // If stuff is still in our way, turn more in the same direction until // not blocked: g_turnUntil = millis() + g_turnlength; } } } boolean proximityCheck(){ // Used when mode == 2: Swing the ping left and right taking readings to // find which way is safe to go. Returns false when in the middle of the check // operation, returns true when entire check process is complete. // Current angle of the servo: float angle = g_servo2.read(); // check left first: ( full left is 0 deg) if(g_checkLeft == false){ if(angle > g_servoLeft){ g_servo2.write(angle-10) ; return false; } else{ g_checkLeft = true; g_leftDist = ping(); return false; } } // check right second: ( full right is 180 deg) if(g_checkLeft == true && g_checkRight == false){ if(angle < g_servoRight){ g_servo2.write(angle+10) ; return false; } else{ g_checkRight = true; g_rightDist = ping(); return false; } } // Go to center position third: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){ if(angle != g_servoCenter){ g_servo2.write(angle-10) ; return false; } else{ g_checkCenter = true; return false; } } // Finally if we've checked left, right, and got back to center, return true // to tell the later code that the full check is complete: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){ return true; } else{ return false; } } void move(byte mode){ // This function moves the wheels. Can be called to when mode == 1 (driving) or 3 (turning). if(mode == 0){ // all stop! g_motor1.setSpeed(0); g_motor2.setSpeed(0); g_motor3.setSpeed(0); g_motor4.setSpeed(0); } else{ // full speed! g_motor1.setSpeed(g_motorSpeed); g_motor2.setSpeed(g_motorSpeed); g_motor3.setSpeed(g_motorSpeed); g_motor4.setSpeed(g_motorSpeed); // full speed, but which direction? if(mode == 1){ // go straight g_motor1.run(FORWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(FORWARD); } else if(mode == 2){ // turn right g_motor1.run(FORWARD); g_motor2.run(BACKWARD); g_motor3.run(BACKWARD); g_motor4.run(FORWARD); } else if (mode == 3){ // turn left g_motor1.run(BACKWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(BACKWARD); } } } float ping(){ // Returns the distance in cm from the ping sensor. Pulled from // Arduino docs. // The PING))) is triggered by a HIGH pulse of 2 or more microseconds. // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: pinMode(g_pingPin, OUTPUT); digitalWrite(g_pingPin, LOW); delayMicroseconds(2); digitalWrite(g_pingPin, HIGH); delayMicroseconds(5); digitalWrite(g_pingPin, LOW); // The same pin is used to read the signal from the PING))): a HIGH // pulse whose duration is the time (in microseconds) from the sending // of the ping to the reception of its echo off of an object. pinMode(g_pingPin, INPUT); long duration = pulseIn(g_pingPin, HIGH); float cm = microsecondsToCentimeters(duration); return cm; } long microsecondsToCentimeters(long microseconds){ // Simple conversion setp, kept as a function simply to illustrate // how it works. Pulled from Arduino docs. // The speed of sound is 340 m/s or 29 microseconds per centimeter. // The ping travels out and back, so to find the distance of the // object we take half of the distance travelled. //return microseconds / 29 / 2; return microseconds / 58; } // while(val == HIGH) { // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1; // Count echo pulse time} //ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}

Question by pe2hlc   |  last reply


Audio frequency and signal strength sensor: is there such thing?

Hi, I'd like to know if there's a sensor easily used with an Arduino that detects the signal strength of a sound of frequency determined by me. I want this to make a sensor that can be used to measure its distance to the emitting object omni-directionally, ie, not like ultrasonic or IR distance sensors, which only sense what's in front of them. I want the sensor to sense the SPACE AROUND it, like... spherically. If you know of a sensor that does that in another way, I'd LOVE to hear about it. I've been searching for something like that for a long time... Anyway, I just need a sensor - cheap, preferably :) - that senses the signal strength of a wave of frequency x. By the way, the distance range to be measured is about 10 - 150cm... Thanks!

Question by pedrotome   |  last reply


Voltage Drop

I have a 12v led bulb, I need to connect the led bulb to 12V rechargeable battery  and connect bulb for  long distance from battery and i connect the bulb i won't  work, i think the voltage drop would be the  answer and how can i solve that????

Topic by rshan   |  last reply


security system (not responding after combining ultrasonic sensor code and esp8266 code )

The base of this project is https://www.instructables.com/id/SIMPLE-ARDUINO-ULTRASONIC-SENSOR-DOOR-ALARM-/ &http;://randomnerdtutorials.com/door-status-monitor-using-the-esp8266/ I changed according to my uses from above links I tryed by dividing into two parts one for ultrasonic sensor and other for esp8266 they worked fine while separating ultrasonic and buzzer are working in (Tools and wifi module is working in onlt(Tools when i mix ultrasonic and buzzer nothing happening) any idea here is the code #include #include #include #include #define USE_SERIAL Serial #define trigPin 9 #define echoPin 10 #define piezoPin 8 ESP8266WiFiMulti WiFiMulti; int normalDistance; boolean triggered = false; long duration, distance; void setup() {   USE_SERIAL.begin(115200);   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   pinMode(piezoPin, OUTPUT);   long duration, distance; while (millis() < 5000) {   digitalWrite(piezoPin, HIGH);       digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2;         normalDistance = distance;       USE_SERIAL.print("Distance: "); USE_SERIAL.println(distance);         digitalWrite(piezoPin, LOW);    for(uint8_t t = 4; t > 0; t--) {         USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);         USE_SERIAL.flush();         delay(1000); } WiFiMulti.addAP("username", "pass"); } } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2; USE_SERIAL.print("Distance: "); USE_SERIAL.println(distance); if (distance < normalDistance-5) {       triggered = true;     }     else {         triggered = false;     }     if (triggered) {     tone(piezoPin, 635);     delay(500);     tone(piezoPin, 912);     delay(250);     if((WiFiMulti.run() == WL_CONNECTED)) {         HTTPClient http;         USE_SERIAL.print("[HTTP] begin...\n");                 http.begin("iftt link.........................."); //HTTP         USE_SERIAL.print("[HTTP] GET...\n");         // start connection and send HTTP header         int httpCode = http.GET();         // httpCode will be negative on error         if(httpCode > 0) {             // HTTP header has been send and Server response header has been handled             USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);             // file found at server             if(httpCode == HTTP_CODE_OK) {                 String payload = http.getString();                 USE_SERIAL.println(payload);             }         } else {             USE_SERIAL.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());         }         http.end();     }     } } any idea about whats going on Thanks Hemanth

Topic by hemanth kumar reddy   |  last reply


how to write specification for transmitter?

I trying to write specification for transmitter that transmit voice signal over 100 meter long at 97 mhz frequency modulation type Input voltage 12 v input current 9 mA input power output voltage output current output power operating frequency 92 - 97 Mhz oscillator circuit that generate 97 mhz frequency transmitting distance 100 meter long how to decide how much output voltage and current I need at output side ?  

Question by vead   |  last reply


Internet browsing device

I have a grand central account, and I use it for free long distance, but I have to turn on my computer just to make a call. I was wondering if anybody knows of something similar to the nokia internet tablet thingies, but much cheaper (under $100). Any ideas (or GC tips)?

Topic by LinuxH4x0r   |  last reply


Rangefinder

I need help. I need a way to (using optics) build a rangefinder that I could use to aim my air cannon over long distances. How would I judge the distance away from my target? Could I use lasers? Mirrors? Lenses? And once I judge how far away my target (to be drenched with a water balloon) is, then what? How will I know what degree of elvation I should angle my cannon at? Is there some mathmatical formula I could use to make a chart that I could just look at and adjust my gun? How could I build this?

Topic by MattGyver92   |  last reply


what LED to use?

Hi there, What kind of LED can I use to activate a phototransistor based switch for a (3 - 5) merters distance ? The phototransistor will be placed in a (2-3) cm long black tube, the whole thing could be installed indoors (shower) or  outdoors (beach). Also, should I worry about the steam blocking the light in the shower? Thanks!

Question by Control80   |  last reply


Pendulum length to falling body height ratio? Answered

How long does a pendulum need to be for its time period to be equal to the time it takes for a falling body to drop from a distance equal to the pendulum's length? A general equation as well as a specific solution for Earth surface gravity would be appreciated. With this, I would be able to establish standard time and distance units even if trapped on an island without any instruments other than what I can make from available materials. I'm sure I'm the only one tired that happening so often. Of course, I'd still need a way to establish the gravitatoinal constant if stranded on another planet...

Question by MDude   |  last reply


Could you make a ghetto mortar out of an iron pipe? Answered

Imagine that you take a four foot long iron pipe and cap one end of it. Near the capped end, you make reasonably sized exhaust holes. Just above said exhaust holes, there would be a few metallic protrusions that would stop a round from sinking to the bottom of the barrel. Aforementioned round shells would be made of smaller, thinner metal and filled with propellants. Means of ignition is still TBA. But if such barrel and rounds were constructed, could it effectively launch rounds long distances?

Question by Mr. Deeds   |  last reply


Can you help me to find error in the code?

Hi! When I try to upload it, error occurs: "expected unqualified-id before numeric constant" Here is the code: #include #include #include #define ONE_WIRE_BUS 10 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire;); LiquidCrystal lcd(1, 2, 4, 5, 6, 7);  #define trigPin 8 #define echoPin 9 #define button 22 #define temp 10 int w=0; void setup() {    pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT);   pinMode(button, INPUT);   pinMode(temp,INPUT);   sensors.begin();       lcd.begin(16,2);        lcd.setCursor(0,0);     } void loop() {w = digitalRead(button);   if(w == LOW) ultrasonic();     if(w == HIGH) void temp(); } void ultrasonic() {   lcd.print("Target Distance:");   long duration, distance;   digitalWrite(trigPin, LOW);   delayMicroseconds(2);   digitalWrite(trigPin, HIGH);   delayMicroseconds(10);   digitalWrite(trigPin, LOW);   duration = pulseIn(echoPin, HIGH);   distance = (duration/2) / 29.1;   lcd.setCursor(0,1);   lcd.print("                ");   lcd.setCursor(0,1);    lcd.print(distance);   delay(250);   lcd.clear(); } void temp() { lcd.setCursor(0,0); lcd.print("TEMPERATURE"); lcd.setCursor(0,1); sensors.requestTemperatures(); lcd.print(sensors.getTempCByIndex(0)); } Thanks for help!

Question by KacperK8   |  last reply


how to set wire router as wifi wireless resever?

I got problem to set wire as wifi wireless receiver should i connect it with axispoint to make it wireless , the router was made 2008 and how to set it as wireless reserve i want to use router due to the distance is long and my laptop is only 45 meter i just want to know does the wireless router could be wireless or just use the wireless one  

Question by zordrecon   |  last reply


[Arduino] Need some help with a few lines of code.

Hi! I have put together a nasty little robot over the past few days with an arduino, ardumoto shield, HCSR04 Ping Sensor, and a  beat up RC car. Currently I have it scrambling around the floor bashing into things and want to add even more unreliable muck to its maneuvers. Here is my code so far: #define trigPin 9 #define echoPin 10 int maxrange = 200; int minrange = 50; long duration, distance; void setup() {   pinMode(trigPin, OUTPUT);   pinMode(echoPin, INPUT); } void loop() {   digitalWrite(trigPin, LOW);   delay(2);     digitalWrite(trigPin, HIGH);   delay(10);     digitalWrite(trigPin, LOW);   duration = pulseIn(echoPin, HIGH);     distance = duration/58.2;     if (distance >= minrange){   digitalWrite(12, LOW);   analogWrite(3, 255); } else {   digitalWrite(12, HIGH);   analogWrite(3, 255); } } All this does is make it go back and forth in regards to objects, but the lack of any tread on its wheels make it spin around quite a bit. I want to add in random movements of the front steering wheels, but I don't know much about coding and even less about making code choose randomly. Any help?

Topic by martzsam 


electric kontiki - electronic fail safe

Has any one come up with and electronic fail safe - return to beach/ gps type system for the electric fishing kontiki's that we have here in Newzealand - and i am sure every where else... currently i understand the only controls available are timed engine run to get it to the desired distance off the shore, and the latests ones have gps correction for tides and surf out to a way point, the trouble is when the long line anchored on the beach becomes separated from the unit ( and the commercial ones are freaking expensive) you have just lost it... surely with the wizardry of electronics and the people that hang out here some one can create a system even better if its gps waypoint based ( beach) that on separation of the long line will automatically turn that hardware around and send it back to the beach, to some where near where it set off from?

Topic by agatornz 


Control LED's via text with Arduino? Answered

I would like to create an arduino setup that can turn LED's from RED to Green (and vice versa) via TEXT from registered cellphones. How can I do this? What equipment would i need to buy? I also plan on wiring the LED's over long distances so how would I wire/program the power supply? I heard that I would need relays, but where would I get those and how would I install them?

Question by ilee1   |  last reply


Write output on registery inside ESP8266

Could any one help me please? I have the following code to make MODBUS tcp/ip(its work good) the other issue in the code is ultrasonic sensor (trig on D1& echo on D2 and output distance on serial port)I want to write distance on one of memory register say (3). I use the command "digitalWrite(distance, MBHoldingRegister[3] )" its fail then I use analogWrite also fail what's the solution?#include #define trigPin D1#define echoPin D2#define analog_output D5float distance;long duration;int dataIn;int m = 0;int h = 0;int t = 0;const char* ssid = "MH_Ext";const char* password = "74375325";int ModbusTCP_port = 502;//////// Required for Modbus TCP / IP /// Requerido para Modbus TCP/IP /////////#define maxInputRegister 20#define maxHoldingRegister 20#define MB_FC_NONE 0#define MB_FC_READ_REGISTERS 3 //implemented#define MB_FC_WRITE_REGISTER 6 //implemented#define MB_FC_WRITE_MULTIPLE_REGISTERS 16 //implemented// MODBUS Error Codes//#define MB_EC_NONE 0#define MB_EC_ILLEGAL_FUNCTION 1#define MB_EC_ILLEGAL_DATA_ADDRESS 2#define MB_EC_ILLEGAL_DATA_VALUE 3#define MB_EC_SLAVE_DEVICE_FAILURE 4// MODBUS MBAP offsets//#define MB_TCP_TID 0#define MB_TCP_PID 2#define MB_TCP_LEN 4#define MB_TCP_UID 6#define MB_TCP_FUNC 7#define MB_TCP_REGISTER_START 8#define MB_TCP_REGISTER_NUMBER 10byte ByteArray[260];unsigned int MBHoldingRegister[maxHoldingRegister];//////////////////////////////////////////////////////////////////////////WiFiServer MBServer(ModbusTCP_port);void setup() {pinMode(14, OUTPUT);pinMode(trigPin, OUTPUT);pinMode(echoPin, INPUT);Serial.begin(9600);delay(100) ;WiFi.begin(ssid, password);delay(100) ;Serial.println(".");while (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}MBServer.begin();Serial.println("Connected ");Serial.print("ESP8266 Slave Modbus TCP/IP ");Serial.print(WiFi.localIP());Serial.print(":");Serial.println(String(ModbusTCP_port));Serial.println("Modbus TCP/IP Online");}void loop() {distance = getDistance();Serial.println(distance);delay(1000);// Check if a client has connected // Modbus TCP/IPWiFiClient client = MBServer.available();if (!client) {return;}boolean flagClientConnected = 0;byte byteFN = MB_FC_NONE;int Start;int WordDataLength;int ByteDataLength;int MessageLength;// Modbus TCP/IPwhile (client.connected()) {if(client.available()){flagClientConnected = 1;int i = 0;while(client.available()){ByteArray[i] = client.read();i++;}client.flush();///// code here --- codigo aqui///////// Holding Register [0] A [9] = 10 Holding Registers Escritura///////// Holding Register [0] A [9] = 10 Holding Registers Writing/// Enable Output 14digitalWrite(14, MBHoldingRegister[14] );digitalWrite(distance, MBHoldingRegister[12] );//// end code - fin//// rutine Modbus TCPbyteFN = ByteArray[MB_TCP_FUNC];Start = word(ByteArray[MB_TCP_REGISTER_START],ByteArray[MB_TCP_REGISTER_START+1]);WordDataLength = word(ByteArray[MB_TCP_REGISTER_NUMBER],ByteArray[MB_TCP_REGISTER_NUMBER+1]);}// Handle requestswitch(byteFN) {case MB_FC_NONE:break;case MB_FC_READ_REGISTERS: // 03 Read Holding RegistersByteDataLength = WordDataLength * 2;ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one.ByteArray[8] = ByteDataLength; //Number of bytes after this one (or number of bytes of data).for(int i = 0; i < WordDataLength; i++){ByteArray[ 9 + i * 2] = highByte(MBHoldingRegister[Start + i]);ByteArray[10 + i * 2] = lowByte(MBHoldingRegister[Start + i]);}MessageLength = ByteDataLength + 9;client.write((const uint8_t *)ByteArray,MessageLength);byteFN = MB_FC_NONE;break;case MB_FC_WRITE_REGISTER: // 06 Write Holding RegisterMBHoldingRegister[Start] = word(ByteArray[MB_TCP_REGISTER_NUMBER],ByteArray[MB_TCP_REGISTER_NUMBER+1]);ByteArray[5] = 6; //Number of bytes after this one.MessageLength = 12;client.write((const uint8_t *)ByteArray,MessageLength);byteFN = MB_FC_NONE;break;case MB_FC_WRITE_MULTIPLE_REGISTERS: //16 Write Holding RegistersByteDataLength = WordDataLength * 2;ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one.for(int i = 0; i < WordDataLength; i++){MBHoldingRegister[Start + i] = word(ByteArray[ 13 + i * 2],ByteArray[14 + i * 2]);}MessageLength = 12;client.write((const uint8_t *)ByteArray,MessageLength);byteFN = MB_FC_NONE;break;}}}//===== getDistance - Custom Functionint getDistance() {// Clears the trigPindigitalWrite(trigPin, LOW);delayMicroseconds(2);// Sets the trigPin on HIGH state for 10 micro secondsdigitalWrite(trigPin, HIGH);delayMicroseconds(10);digitalWrite(trigPin, LOW);// Reads the echoPin, returns the sound wave travel time in microsecondsduration = pulseIn(echoPin, HIGH);// Calculating the distancedistance = duration * 0.034 / 2; // distance in cmreturn distance;}

Question by methaq_ali 


Use of Ethernet cable for 100m power and RS485 transmission is OK?

Hello Friends, I want to use Ethernet CAT 5e cable for Power transmission and RS485 transmission. But I am not sure this suits to my application or not. I have 5 different load which requires 20mA normally and 1A instantaneous current. I need to transmit 5V via Ethernet Cable as load accepts 5V.  If not possible to transmit then I may use 12V. Distance I need is 100meter. Ethernet Cable is ok for RS485 transmission over this range with 5v/12v power? CAT 5e seems better solution for this case or not?

Question by Vicharshunya   |  last reply


Is there technology to monitor a security camera remotely with no internet connection?

I have had a couple of robberies at my deceased grandfathers home, which is empty and no one is living there, and it is about 40 miles from my home. I was wondering if there might be a way to set up a camera and be able to monitor it at my home, either on my computer or my smartphone. I do still have the electricity going at his home, but I don't want to also pay for cable for an empty house(thus no internet connection). Just wondering if there is any technology available in which the camera could somehow broadcast over the cell phone network maybe? Any answers are greatly appreciated.

Question by stevecinstrfme   |  last reply


New here, first time posting. I want to add to the arduino insect bot

Well I am new here and this is my first post Well I have build the arduino insect bot from the book Arduino bots and gadgets. It is in the picture. I have it working but I want to add a touch sensor and attach it to the shell. I have an idea on how to build it. I would use a small button attached to the shell with the lie going to analog A0 pin. This would stop the robot by centering the servos and giving it the ability to stop when the shell was pressed down. Now the program is here. #include Servo frontServo; Servo rearServo; int centerPos = 90; int frontRightUp = 72; int frontLeftUp = 108; int backRightForward = 75; int backLeftForward = 105; int walkSpeed = 150; // how long to wait between steps int centerTurnPos = 81; int frontTurnRightUp = 63; int frontTurnLeftUp = 117; int backTurnRightForward = 66; int backTurnLeftForward = 96; // Ping Distance Measure int pingPin = 4; long int duration, distanceInches; long distanceFront=0; //cm int startAvoidanceDistance=20; //cm long microsecondsToInches(long microseconds) {   return microseconds / 74 / 2; } long microsecondsToCentimeters(long microseconds) {   return microseconds / 29 / 2; } long distanceCm(){   pinMode(pingPin, OUTPUT);   digitalWrite(pingPin, LOW);   delayMicroseconds(2);   digitalWrite(pingPin, HIGH);   delayMicroseconds(5);   digitalWrite(pingPin, LOW);     pinMode(pingPin, INPUT);   duration = pulseIn(pingPin, HIGH);     distanceInches = microsecondsToInches(duration);   return microsecondsToCentimeters(duration); } void center() {   frontServo.write(centerPos);   rearServo.write(centerPos); } void moveForward() {   frontServo.write(frontRightUp);   rearServo.write(backLeftForward);   delay(125);   frontServo.write(centerPos);   rearServo.write(centerPos);   delay(65);     frontServo.write(frontLeftUp);   rearServo.write(backRightForward);   delay(125);     frontServo.write(centerPos);   rearServo.write(centerPos);   delay(65); } void moveBackRight() {   frontServo.write(frontRightUp);   rearServo.write(backRightForward-6);   delay(125);   frontServo.write(centerPos);   rearServo.write(centerPos-6);   delay(65);   frontServo.write(frontLeftUp+9);   rearServo.write(backLeftForward-6);   delay(125);     frontServo.write(centerPos);   rearServo.write(centerPos);   delay(65); } void moveTurnLeft() {   frontServo.write(frontTurnRightUp);   rearServo.write(backTurnLeftForward);   delay(125);   frontServo.write(centerPos);   rearServo.write(centerPos-6);   delay(65);   frontServo.write(frontLeftUp-+9);   rearServo.write(backLeftForward-6);   delay(125);     frontServo.write(centerTurnPos);   rearServo.write(centerTurnPos);   delay(65); } void setup() {   frontServo.attach(2);   rearServo.attach(3);   pinMode(pingPin, OUTPUT); } void loop() {   distanceFront=distanceCm();     if(distanceFront > 1){       if (distanceFront         for(int i=0; i<=8; i++) {         moveBackRight();         delay(walkSpeed);       }             for(int i=0; i<10; i++){         moveTurnLeft();         delay(walkSpeed);       }      } else {        moveForward();        delay(walkSpeed);      }     } } I would like to know what line of code to add to receive input from pin AO and center the servo stopping the robot.

Topic by DHTArduinoNerd   |  last reply


I want to combine 2 - 12 volt 12 amp hour sealed lead acid battery's with 2 - 12 volt 50 sealed lead acid battery's

I want to extend my driving distance I know if I got with 4 - 12 volt 50 sealed lead acid battery's it will take 14 hours to charge the set of 4 and I do not know even if I bought a new 2 amp hour charger that it the charger will last very long being run for that long of time I wan to combine 2 - 12 volt 12 amp hour sealed lead acid battery's with 2 - 12 volt 50 sealed lead acid battery's is this a safe thing to do will the higher amp lead acid battery's do damage to the lesser one's ? this set up is for a E-bike which takes just under 25 amp hour draw I've seen the draw get into the first bar of red but only in winter when it's rile cold say about - 47 Celsius

Question by Cleasonsook   |  last reply


How can i combine these 3 codes?i'm completely new to arduino ?

Code 1: Ultrasonic sensor and LCD I2C Display #include #include #include #include #define I2C_ADDR 0x3F // <<- Add your address here. #define Rs_pin 0 #define Rw_pin 1 #define En_pin 2 #define BACKLIGHT_PIN 3 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define MAX_DISTANCE 500 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm. NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); void setup() { lcd.begin (16,2); // <<-- our LCD is a 20x4, change for your LCD if needed // LCD Backlight ON lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); // go home on LCD lcd.print("Obst. distance"); } void loop() { unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS). unsigned int cm = sonar.convert_cm(uS); // Convert into centimeters lcd.setCursor (0,1); // go to start of 2nd line lcd.print(" Distance:"); lcd.setCursor (0,3); // go to start of 4th line lcd.print(": "); lcd.print(cm); lcd.print(" cm "); delay(500); } code 2: PIR sensor with buzzer // Uses a PIR sensor to detect movement, buzzes a buzzer // more info here: http://blog.makezine.com/projects/pir-sensor-arduino-alarm/ // email me, John Park, at jp@jpixl.net // based upon: // PIR sensor tester by Limor Fried of Adafruit // tone code by michael@thegrebs.com int ledPin = 13;                // choose the pin for the LED int inputPin = 2;               // choose the input pin (for PIR sensor) int pirState = LOW;             // we start, assuming no motion detected int val = 0;                    // variable for reading the pin status int pinSpeaker = 10;           //Set up a speaker on a PWM pin (digital 9, 10, or 11) void setup() {   pinMode(ledPin, OUTPUT);      // declare LED as output   pinMode(inputPin, INPUT);     // declare sensor as input   pinMode(pinSpeaker, OUTPUT);   Serial.begin(9600); } void loop(){   val = digitalRead(inputPin);  // read input value   if (val == HIGH) {            // check if the input is HIGH     digitalWrite(ledPin, HIGH);  // turn LED ON     playTone(300, 160);     delay(150);        if (pirState == LOW) {       // we have just turned on       Serial.println("Motion detected!");       // We only want to print on the output change, not state       pirState = HIGH;     }   } else {       digitalWrite(ledPin, LOW); // turn LED OFF       playTone(0, 0);       delay(300);         if (pirState == HIGH){       // we have just turned off       Serial.println("Motion ended!");       // We only want to print on the output change, not state       pirState = LOW;     }   } } // duration in mSecs, frequency in hertz void playTone(long duration, int freq) {     duration *= 1000;     int period = (1.0 / freq) * 1000000;     long elapsed_time = 0;     while (elapsed_time < duration) {         digitalWrite(pinSpeaker,HIGH);         delayMicroseconds(period / 2);         digitalWrite(pinSpeaker, LOW);         delayMicroseconds(period / 2);         elapsed_time += (period);     } } CODE 3: MQ5 LPG gas sensor int sensor=7; int gas_value; void setup() { pinMode(sensor,INPUT); Serial.begin(9600); } void loop() { gas_value=digitalRead(sensor); Serial.println(gas_value); }

Question by aaryank4   |  last reply


Arduino yellow drummer robot?

I was looking at building a yellow drummer robot that I saw in Make 25. I don't have a Picaxe, the problem is that I have seen pictuures and videos of people that have used arduino but no detailed instructions. Can anyone give me a link to instructions or  give me tips. The best help I have had so far is the code. But how do I connect it up? (I have a arduino deumonlatave, but it should still work). // Yellow Drum Machine Program for Arduino Uno // setup pins and variables for SRF05 sonar device int echoPin = 12;                               // SRF05 echo pin (digital 12) int initPin = 13;                               // SRF05 trigger pin (digital 13) unsigned long pulseTime = 0;                    // stores the pulse in Micro Seconds unsigned long distance = 0;                     // variable for storing the distance (cm) // setup pins for drivetrain motors int DCMotor1Drive = 10;                         // DCMotor1 Drive Pin (PWM 3) int DCMotor1Reverse = 3;                        // DCMotor1 Reverse Pin (PWM 10)       int DCMotor2Drive = 9;                          // DCMotor2 Drive Pin (PWM 6) int DCMotor2Reverse = 6;                        // DCMotor2 Reverse Pin (PWM 9) // setup pins for sonar pivot pager int SensorPagerRight = 11;                        // SensorPager rotate right Pin (digital #) int SensorPagerLeft = 5;                         // SensorPager rotate left Pin (digital #) // setup pins for drumstick pagers int Pager1 = 8;                           // Pager1 rotate forward Pin (digital #) int Pager2 = 2;                         // Pager1 rotate reverse Pin (digital #) int Pager3 = 1; int speed = 0; int averageDistance = 0;                        // stores the average distance value int mode = 0; // Function for sonar reader int readsonar() {   // variables to take x number of readings and then average them   // to remove the jitter/noise from the SRF05 sonar readings   const int numOfReadings = 10;                   // number of readings to take/ items in the array   int total = 0;                                  // stores the cumlative total     // create array loop to iterate over every item in the array   for (int i = 0; i < numOfReadings; i++) {        // Trigger sonar to take reading     digitalWrite(initPin, HIGH);                    // send 10 microsecond pulse     delayMicroseconds(10);                          // wait 10 microseconds before turning off     digitalWrite(initPin, LOW);                     // stop sending the pulse         // Read sonar distance     pulseTime = pulseIn(echoPin, HIGH);             // Look for a return pulse, it should be high as the pulse goes low-high-low     distance = pulseTime/58;                        // Distance = pulse time / 58 to convert to cm.     total= total + distance;                        // add the reading to the total   } return total / numOfReadings; } // Drivetrain movement command functions   /* Drivetrain Forward */   int goforward(int speed) {      analogWrite(DCMotor1Reverse, 0);     analogWrite(DCMotor1Drive, speed);     analogWrite(DCMotor2Reverse, 0);     analogWrite(DCMotor2Drive, speed);   }   /* Drivetrain Reverse */   int goreverse(int speed) {     analogWrite(DCMotor1Reverse, speed);     analogWrite(DCMotor1Drive, 0);     analogWrite(DCMotor2Reverse, speed);     analogWrite(DCMotor2Drive, 0);   }           /* Drivetrain Turn Right */   int goright(int speed) {     analogWrite(DCMotor1Reverse, 0);     analogWrite(DCMotor1Drive, speed);     analogWrite(DCMotor2Reverse, 0);     analogWrite(DCMotor2Drive, 0);   }   /* Drivetrain Turn Left full speed*/   int goleft(int speed) {   analogWrite(DCMotor1Reverse, 0);   analogWrite(DCMotor1Drive, 0);   analogWrite(DCMotor2Reverse, 0);   analogWrite(DCMotor2Drive, speed);    }     /*Drivetrain turn around*/   int turnaround(int speed) {      analogWrite(DCMotor1Reverse, 0);      analogWrite(DCMotor1Drive, 255);      analogWrite(DCMotor2Reverse, 255);      analogWrite(DCMotor2Drive, 0);   }     /* Pager Pulse functions */   int rightstick() {     digitalWrite(Pager1, 0);     delay(200);     digitalWrite(Pager1, 1);   }     int leftstick() {     digitalWrite(Pager2, 1);     delay(200);     digitalWrite(Pager2, 0);   }     int tailstick() {     digitalWrite(Pager3, 1);     delay(200);     digitalWrite(Pager3, 0);   }      //Operational Modes   //Target Seeking Mode  int findtarget() {    int Center = readsonar();    if (Center > 50)       goforward(255); //Go forward!    else      mode = 1; //  }     //Fine-Tune Targeting Mode  int lockontarget() {     // Reading and moving the sonar     int Center = readsonar();     digitalWrite (SensorPagerLeft, 1);     digitalWrite (SensorPagerRight, 0);     delay (500);     int Left = readsonar();     digitalWrite (SensorPagerLeft, 0);     digitalWrite (SensorPagerRight, 1);     delay (500);     int Right = readsonar();     digitalWrite (SensorPagerLeft, 0);     digitalWrite (SensorPagerRight, 0);     delay (500);         //Speed and Direction Control      if ((Center < Right) && (Center < Left)) {         if (Center > 50)           goforward(255); //Go forward!        else if (Center > 7)          goforward(128); //        else          mode = 2;      }      else if ((Right < Center) && (Right < Left)) {        if (Right > 50)           goright(255); //Go forward!        else if (Right > 7)          goright(128); //        else          mode = 2;      }      else if ((Left < Center) && (Left < Right)) {        if (Left > 50)           goleft(255); //Go forward!        else if (Left > 7)          goleft(128); //        else          mode = 2;      }  } //LET THE BEAT DROP! int makesomenoise() {    tailstick();    rightstick();    leftstick();    delay (500);          tailstick();    rightstick();    leftstick();    delay (500);    tailstick();    rightstick();    leftstick();    delay (500);    tailstick();    tailstick();    tailstick();    tailstick();    rightstick();    leftstick();    tailstick();    rightstick();    leftstick();    delay (500);    tailstick();    rightstick();    leftstick();    delay (500);    mode = 3; }      //Go Somewhere Else//  int runaway()  {    goreverse(255);  }               // setup void setup() {   pinMode(DCMotor1Drive, OUTPUT);                     // sets DCMotor1Drive as output   pinMode(DCMotor1Reverse, OUTPUT);                   // sets DCMotor1Reverse as output   pinMode(initPin, OUTPUT);                           // set init pin 13 as output   pinMode(echoPin, INPUT);                            // set echo pin 12 as input   pinMode(Pager1, OUTPUT);   pinMode(Pager2, OUTPUT);   pinMode(Pager3, OUTPUT);   digitalWrite(Pager1, 1);   digitalWrite(Pager2, 0);   digitalWrite(Pager3, 0);    // initialize the serial port, lets you view the  // distances being pinged if connected to computer  //    Serial.begin(9600);   } void loop() {   if (mode == 0)     findtarget();   else if (mode == 1)     lockontarget();   else if (mode == 2)   {     makesomenoise();     turnaround(255);     mode = 0;   }   // Serial.println(mode, DEC);         // print out the average distance to the debugg }  

Question by David97   |  last reply


GPS Locator??

My brother and I are currently working on an air launcher projectile.  It is highly likely that it could go .5 to 1.5 miles.  We have the ability to test at this distance, however locating this costly projectile is likely to be difficult.  We have looked into gps trackers, however the cheapest one that would actually work was 500 dollars and if we had that kind of money we wouldn't need a gps tracker on the thing in the first place.  I just wondered if there was a quick and dirty way to make a short range locator.  I have heard of little bluetooth tracking stickers, but I wasn't quite sure if that would work to find a 1 foot long projectile in a square mile field.  This locator needs to be extremely shock resistant, fit in a container 7" by 1.5" and must weigh a minimal amount. We also are looking hopefully below 100 @most 150 dollars. 

Question by jj.inc   |  last reply


Multirotor used as a signal relay?

So in my years since first asking a question about electronics on here i have learned a whole lot. So much so that i am working on plans to build my own multirotor, rc car, and control system all from scrap and open source parts. Everything will be arduino controlled for simplicity (i think it will be easier this way) and i would like to use the OrangeRx radio modules.\ So my question is this; if i wanted to put an fpv system on my car and drive it long distances through a neighborhood, how difficult would it be to have a drone follow the car and act as a relay beacon for my transmitter. I know i could easily get the drone to follow the car by using gps but I have no ideas on how to make it a relay, or if thats even economically feasible on a hobby scale.

Question by budhaztm   |  last reply


How can i make a DIY cheat, small tracking device?

I want to make a tracking device that could potentially connect to a smartphone. I don't need it to do that many things. I want the device to understand borders, and when my phone leave that device for a certain (custom) distance. My phone should receive some sort of alert . Most likely i am going to make this device a sticker device, so i want it to be flat, or almost flat, and as thin as possible . I want this device to use very little energy, so i battery could last a very , very long time.  Also i don't want the device to be too costly, ( if possible 5-10 dollar for one )   Also, if i would to add gps feature , what module should i use, and would it increase the size by a lot? Thank you in advance.

Question by loyal.xie   |  last reply


Laser square projector

I work in a manufacturing facility and we've got a lot of forklifts that are buzzing around everywhere all the time. there's an initiative to make it safer for forklifts to interact with pedestrians. one of the ideas someone had came from another facility where they have these blue spot lights on top of the truck that project a blue dot in front of and behind the truck. you see the blue dot and you know a truck is coming. there's some concern that this might get missed by a pedestrian. a thought came to me, being a nerd, that we could use something maybe a little easier to see. I looked in to some disco type laser displays that you can display custom graphics with, but there's concern about how sturdy they are or how long you'd actually be able to use one (whatever it is would basically have to be on almost 24/7). we've got several Motorola barcode scanners, and the long range models (mc 9190) have a feature where it projects a red square to show the area where the scanning will take place. it's a solid red square, not just a perimeter, that scales up with distance (it's like 4"x4" if you're within 2' and goes up to a pretty large size the farther out you're pointing it). These scan guns are way more expensive than this project calls for of course. Does anyone know of a source for JUST the imagers for these things? or could anyone suggest a way to replicate the effect...a big red square on the floor, with other equipment. needs to be able to run for a long time, hopefully could be powered by a 24-36v DC source, possibly motion detection (though not really necessary)

Topic by crapflinger   |  last reply


Can Someone Modify an Arduino Sketch For Me? Answered

I recently got into Arduino, and my first long term project is an autonomous roaming robot. Now, I've been in electronics for a while, so the actual building of the thing was not a problem....but the programming is. I've found a couple examples of codes online, but they all use Sharp IR sensors, whereas I have a Ping))) Ultrasonic sensor. I was wondering if there were any Arduino experts out there that could modify a sketch that I found to only use the Ping))) instead of the IR sensor(s). This sketch actually uses both, and would be perfect if the Ping))) was used in place of the IR sensors, rather than with them. If anybody could modify the sketch below to do as I said, your help would be greatly appreciated. Thanks. Code: int micVal; int cdsVal; int irLval;  // Left IR int irCval;  // Center IR int irRval;  // Right IR int i;   // Generic Counter int x;  // Generic Counter int PLval;  // Pulse Width for Left Servo int PRval;  // Pulse Width for Right Servo int cntr;  // Generic Counter Used for Determining amt. of Object Detections int counter; // Generic Counter int clrpth;  // amt. of Milliseconds Of Unobstructed Path int objdet;  // Time an Object was Detected int task;  // Routine to Follow for Clearest Path int pwm;  // Pulse Width for Pan Servo boolean add;  // Whether to Increment or Decrement PW Value for Pan Servo int distance;  // Distance to Object Detected via Ultrasonic Ranger int oldDistance;  // Previous Distance Value Read from Ultrasonic Ranger float scale = 1.9866666666666666666666666666667;  // *Not Currently Used* int LeftPin = 6;  // Left Servo int RightPin = 9;  // Right Servo int PiezoPin = 11;  // Piezo int PingServoPin = 5;  // Pan Servo int irLPin = 0;            // Analog 0; Left IR int irCPin = 1;            // Analog 1; Center IR int irRPin = 2;            // Analog 2; Right IR int ultraSoundSignal = 7; // Ultrasound signal pin int val = 0;              // Used for Ultrasonic Ranger int ultrasoundValue = 0;  // Raw Distance Val int oldUltrasoundValue;  // *Not used* int pulseCount;        // Generic Counter int timecount = 0; // Echo counter int ledPin = 13; // LED connected to digital pin 13 #define BAUD 9600 #define CmConstant 1/29.034 void setup() {   Serial.begin(9600);   pinMode(PiezoPin, OUTPUT);   pinMode(ledPin, OUTPUT);   pinMode(LeftPin, OUTPUT);   pinMode(RightPin, OUTPUT);   pinMode(PingServoPin, OUTPUT);   pinMode(irLPin, INPUT);   pinMode(irCPin, INPUT);   pinMode(irRPin, INPUT);   for(i = 0; i < 500; i++) {     digitalWrite(PiezoPin, HIGH);     delayMicroseconds(1000);     digitalWrite(PiezoPin, LOW);     delayMicroseconds(1000);   }   for(i = 0; i < 20; i++) {   digitalWrite(PingServoPin, HIGH);   delayMicroseconds(655 * 2);   digitalWrite(PingServoPin, LOW);   delay(20);   }   ultrasoundValue = 600;   i = 0; } void loop() {   //Scan();   Look();   Go(); } void Look() {   irLval = analogRead(irLPin);   irCval = analogRead(irCPin);   irRval = analogRead(irRPin);   //if(counter > 10) {     //counter = 0;     //readPing();   //}   if(irLval > 200) {     PLval = 820;     PRval = 850;     x = 5;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else if(irCval > 200) {     PLval = 820;     PRval = 850;     x = 10;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else if(irRval > 200) {     PLval = 620;     PRval = 650;     x = 5;     cntr = cntr + 1;     clrpth = 0;     objdet = millis();   }   else {     x = 1;     PLval = 620;     PRval = 850;     counter = counter + 1;     clrpth = (millis() - objdet);     if(add == true) {       pwm = pwm + 50;     }     else if(add == false) {       pwm = pwm - 50;     }     if(pwm < 400) {       pwm = 400;       add = true;     }     if(pwm > 950) {       pwm = 950;       add = false;     }     digitalWrite(PingServoPin, HIGH);     delayMicroseconds(pwm * 2);     digitalWrite(PingServoPin, LOW);     delay(20);     readPing();     if(ultrasoundValue < 500) {       cntr = cntr + 1;       switch(pwm) {         case 400:           x = 7;           PLval = 650;           PRval = 650;           Go();           break;         case 500:           x = 10;           PLval = 650;           PRval = 650;           Go();           break;         case 600:           x = 14;           PLval = 850;           PRval = 850;           Go();           break;         case 700:           x = 10;           PLval = 850;           PRval = 850;           Go();           break;         case 950:           x = 7;           PLval = 850;           PRval = 850;           Go();           break;       }     }   }   //Serial.print("clrpth: ");   //Serial.println(clrpth);   //Serial.print("objdet: ");   //Serial.println(objdet);   //Serial.print("cntr: ");   //Serial.println(cntr);   if(cntr > 25 && clrpth < 2000) {     clrpth = 0;     cntr = 0;     Scan();   } } void Go() {   for(i = 0; i < x; i++) {     digitalWrite(LeftPin, HIGH);     delayMicroseconds(PLval * 2);     digitalWrite(LeftPin, LOW);     digitalWrite(RightPin, HIGH);     delayMicroseconds(PRval * 2);     digitalWrite(RightPin, LOW);     delay(20);   } } void readPing() {  // Get Distance from Ultrasonic Ranger timecount = 0; val = 0; pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output /* Send low-high-low pulse to activate the trigger pulse of the sensor * ------------------------------------------------------------------- */ digitalWrite(ultraSoundSignal, LOW); // Send low pulse delayMicroseconds(2); // Wait for 2 microseconds digitalWrite(ultraSoundSignal, HIGH); // Send high pulse delayMicroseconds(5); // Wait for 5 microseconds digitalWrite(ultraSoundSignal, LOW); // Holdoff /* Listening for echo pulse * ------------------------------------------------------------------- */ pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input val = digitalRead(ultraSoundSignal); // Append signal value to val while(val == LOW) { // Loop until pin reads a high value   val = digitalRead(ultraSoundSignal); } while(val == HIGH) { // Loop until pin reads a high value   val = digitalRead(ultraSoundSignal);   timecount = timecount +1;            // Count echo pulse time } /* Writing out values to the serial port * ------------------------------------------------------------------- */ ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue //serialWrite('A'); // Example identifier for the sensor //printInteger(ultrasoundValue); //serialWrite(10); //serialWrite(13); /* Lite up LED if any value is passed by the echo pulse * ------------------------------------------------------------------- */ if(timecount > 0){   digitalWrite(ledPin, HIGH); } } void Scan() {   // Scan for the Clearest Path   oldDistance = 30;   task = 0;   for(i = 1; i < 5; i++) {     switch(i) {       case 1:         //Serial.println("Pos. 1");         pwm = 1125;    ///  incr. by 100 from 1085         break;       case 2:         //Serial.println("Pos. 2");         pwm = 850; //// increased by 100 from 850         break;       case 3:         //Serial.println("Pos. 3");         pwm = 400;         break;       case 4:         //Serial.println("Pos. 4");         pwm = 235;         break;     }     for(pulseCount = 0; pulseCount < 20; pulseCount++) {  // Adjust Pan Servo and Read USR       digitalWrite(PingServoPin, HIGH);       delayMicroseconds(pwm * 2);       digitalWrite(PingServoPin, LOW);       readPing();       delay(20);     }     distance = ((float)ultrasoundValue * CmConstant);   // Calculate Distance in Cm     if(distance > oldDistance) {  // If the Newest distance is longer, replace previous reading with it       oldDistance = distance;       task = i;   // Set task equal to Pan Servo Position     }   }   //Serial.print("Task: ");   //Serial.println(task);   //Serial.print("distance: ");   //Serial.println(distance);   //Serial.print("oldDistance: ");   //Serial.println(oldDistance);   distance = 50;  // Prevents Scan from Looping   switch(task) {   // Determine which task should be carried out     case 0:  // Center was clearest       x = 28;       PLval = (850);       PRval = (850);       Go();       break;     case 1:  // 90 degrees Left was Clearest       x = 14;       PLval = (650);       PRval = (650);       Go();       break;     case 2:  // 45 degrees left       x = 7;       PLval = (650);       PRval = (650);       Go();       break;     case 3:  // 45 degrees right       x = 7;       PLval = (850);       PRval = (850);       Go();       break;     case 4:  // 90 degrees right       x = 14;       PLval = (850);       PRval = (850);       Go();       break;   } }    

Question by punkhead58   |  last reply


need help with design/placement of actuator or similar to raise and lower trailer gate.

My dad lost his leg but walks with a prosthesis he also only has use of 1 arm. What we are trying to do is make it so he can raise and lower his trailers gate using one simple control. He uses the trailer to transport his scooter which he rides when he cant walk long distances. Right now i have a hand powered boat winch going from the fender to the gate but its difficult to operate. What id like to do is use an actuator or something similar and have it powered by his wiring harness or even a battery on the trailer with a solar charger. I cant wrap my head around the design and placement atm so im asking for help. this is basically the same trailer model http://tinyurl.com/c32dlw

Question by viamptor   |  last reply