Alright so I havent posted in a while, and the novelty of the wm+ has worn off. I dont have the funding to start a drone project right now, mainly since I’m a broke college student. And even if I did have the money, I dont think I would have the time this semester. I can barely manage to make it to classes right now. But it was from that problem that my last project took shape and has been helping me make it to my classes, making sure I dont fail out.
A little background info first: my city (Gainesville FL) recently put gps systems in most of their busses, which can be checked from the internet. Cool huh? It partially makes up for the fact that busses follow their schedule with an error of + or - 10 minutes (for a 40 minute route). While this is great, I found myself checking the computer every 30 seconds when I woke up, or my old computer would fail to shut down properly leaving it on all day while I wasnt home, not so good for a laptop. I wanted a way to be notified of when I actually had to get my butt out of the door and head to the bus, preferably without using my computer. Well, having just started to play around with the wiznet ethernet module (which comes on the arduino ethernet shield), I decided to make this my next project. So without further ado, I present the Bus Notifier!
I started by finding the static IP address for my bus's website, but since it is php based, the arduino obviously couldnt do anything with it. After mucking around, I found a text based version which was much more useful. The hardest parts of the project were creating a good string parsing algorithm to find just the info I wanted, and then figuring out which string tokens I wanted to make my program look for, signifying a change of state. The three states I decided upon were: nowhere near your apt, stopped somewhat close (for some reason my bus stops at one specific spot for like 10-15 minutes and just sits…yea really annoying) , and the last state is “the bus is coming, get out there!”. To allow me to know what state the bus(or busses) were in, I just used three leds, red, yellow, and green respectively. Later I added a piezo buzzer for the “get out there” state. It worked great for about three months in this state but eventually website updated and all my string parsing had to be redone. So on the next revision, I made the string parsing VERY easy to work with in case of later changes. It has been working this way every morning for the last three or so months.
Another kinda cool module I added was the ability to tweet the location of each of the busses every five minutes. I know this might seem stupid at first, but given the fact that twitter is very easy (and free) to check via text message, this allows me to check the location of the busses once I get out of class with nothing more than a “GET knuckles904” text message to twitter’s shortcode. It gives me the functionality of having a smartphone and internet plan without all the cost.
It took a lot of work, and several revisions to get everything working right but for the past 6 months, but of all the projects Ive spent time on, this has by far been the most useful. I feel I have actually gotten a return on my time investment on this one.
I am posting my most current code (just barely fits in a 168) below, as well as some links that are useful to see. Feel free to adapt any part of this code to your project. I am very proud of it, especially the new string searching function. Just please give credit where its due, and if possible link back here. Also as with all my other posts, any click to the “sponsors” on the right of the page is much appreciated.
Dropboxed .pde of code I realized that the code wont necessarily work just by copy+paste, since there is embedded html in the pde. Use the scrollbox to view, and download the pde to run or modify.
#define green 3 //pin definitions for leds and buzzer #define yellow 4
#define red 5
#define buzzer 6
#define clientRefresh 20000 //just refresh times #define buzzerRefresh 15000
#define twitterRefresh 300000
/* char yellowstr[]="SE 20th Pl"; //means bus is waiting char greenstr1[]="4th St"; //by itself means bus is on the move towards apt char greenstr2[]="State Hwy 331"; //these two must be together char greenstr3[]="Southwest"; //" " mean that bus is on the way to apt char tagstr[]="";
char redstr1[]="SE 16th Ave"; //means that bus is already gone if contains this char redstr2[]="West"; //and west char redstr3[]="North"; //or redstr1 and this */
voidloop(){
if ((millis()-timer1)>clientRefresh){
ConnectToWebserver();
state=makestate(state);
//Serial.print(F("Status: ")); //Serial.println(state); twitterupdate();
clearstrings();
timer1=millis();
}
switch (state){
case 0:
blink(red, 1000);
break;
case 1:
turnon(green);
if((millis()-timer3)>buzzerRefresh){
buzz(1000, 100);
timer3=millis();
}
break;
case 2:
turnon(yellow);
break;
case 3:
turnon(red);
break;
}
//Serial.println((millis()-timer4)); delay(1);
}
void ConnectToWebserver(){
uint8_t connectStatus;
if (busClient.connect()) {
Serial.println(F("-Connected"));
// Send the HTTP GET to the server busClient.println(F("GET /t/route.php?id=66 HTTP/1.0")); //id=?? for php address busClient.println();
timer2 = millis(); //secondary timer to wait up to five seconds for the server to respond while ((!busClient.available()) && ((millis() - timer2 ) < style="color: #777755;">//loop until we either get a response or five seconds is up
// Read the response while(busClient.available()>0){
readvalue=busClient.read();
while(busClient.available()>0&×earch.equals("")==false){
makestring(readvalue, timesearch);
readvalue=busClient.read();
//do nothing until find timestart tag }
while(busClient.available()>0&&readvalue!='<'){
makestring(readvalue, timestring);
readvalue=busClient.read();
}
timesearch="";
while(busClient.available()>0&&busSearch.equals("
Bus 1
")==false){
makestring(readvalue, busSearch);
readvalue=busClient.read();
//do nothing until find bus1start tag }
while(busClient.available()>0&&readvalue!='<'){
makestring(readvalue, bus1Locationstring);
readvalue=busClient.read();
}
busSearch="";
while(busClient.available()>0&&busSearch.equals("
void makestring(char inChar, String &inString) {
int maxLength=inString.capacity();
// read the incoming data as a char: // if you're not at the end of the string, append // the incoming character: if (inString.length() < style="color: rgb(204, 102, 0);">else { //rolling string, taking out the first char and putting in a new one at the end for(int i=0;ivoid buzz(int period, int number){
for (int i=0;idigitalWrite(buzzer, LOW);
delayMicroseconds(period/2);
digitalWrite(buzzer, HIGH);
delayMicroseconds(period/2);
}
}//we use 1000,100 for now
void twitterupdate(){
if((millis()-timer4)>twitterRefresh){
if(!bus1Locationstring.equals("")){
twitterpost(1);
buzz(1000, 100);
delay(1000);
buzz(1000, 100);
delay(1000);
buzz(1000, 100);
}
if(!bus2Locationstring.equals("")){
twitterpost(2);
buzz(1000, 100);
delay(1000);
buzz(1000, 100);
delay(1000);
buzz(1000, 100);
}
timer4=millis();
}
}
/* String getbackstring(const prog_char* str){ String tempstring(30); //str.copy(tempstring, str.length()); return tempstring; } */ /* //this whole sketch is based on the new ethernet client example int ReadResponse(){ int totalBytes=0; unsigned long timer2 = millis();
// First wait up to 5 seconds for the server to return some data. // If we don't have this initial timeout period we might try to // read the data "too quickly" before the server can generate the // response to the request
while ((!busClient.available()) && ((millis() - timer2 ) <>
while (busClient.available()) { char c = busClient.read(); Serial.print(c); totalBytes+=1; } return totalBytes; } */
Thanks combination of suitable and useful information and well-written sentences that will certainly entice your sense.There are so multiple comments here that are really entertaining and conducive to me thanks for sharing a link especially for sharing this blog.
Nice job, but this is quite an overkill. From what I understand all processing is done on the controller, which is nice but takes up a lot of work and a lot of time(running the TCP stack+processing on uC). Why didn't you simply write a computer program/script to do the processing and have it notify your "led"? It didn't even have to run on a computer, routers these days can run programs too.
Nice project! I love seeing people do innovative, small things that agregates info from the real world and other sources to make life a bit easier. d(^-^)
If only my local bus company would do the same. *sigh* A few years back they got electronic currency cards which I asume communicates with their central computer system through GSM or some such. Why they haven't included GPS-updates is beyond me, the added cost would be utterly negible compared to the value.
Instead of wasting 10-20 minutes a day waiting for the bus home from work, I could just map it's GPS-coordinates to google maps, and know exactly when I had to leave.
I started with a book of the "visual quickstart" series entitled C++ programming. Theres not an easier way to get started in my opinion. Like anything though, skill comes with practice.
I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post.
Hey,Good impressive job.This is the great project you have done here.This is the very interesting knowledge shared through this article.Thanks and keep posting more valuable data like this. generic viagra online
I am thoroughly convinced in this said post. I am currently searching for ways in which I could enhance my knowledge in this said topic you have posted here. It does help me a lot knowing that you have shared this information here freely. I love the way the people here interact and shared their opinions too. I would love to track your future posts pertaining to the said topic we are able to read.
Well, having just started to play around with the wiznet ethernet module (which comes on the arduino ethernet shield), I decided to make this my next project. So without further ado, I present the Bus Notifier!
Great post! I?m just starting out in community management/marketing media and trying to learn how to do it well - resources like this article are incredibly helpful. As our company is based in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your own genuine enthusiasm and share the fact that your product is useful in that case. Singapore travelAgen Sbobetchinese new year 2012mid autumn festival 2011hungry ghost festival 2011
This post is really intresting.Thank you for sharing the post.We ship our tropical indoor and outdoor furniture to any U.S. and worldwide location. Florida Rattan Furniture
I must admit that this is one great insight. It surely gives a company the opportunity to get in on the ground floor and really take part in creating something special and tailored to their needs. Agen Sbobet Bola Tangkas Casino Sbobet
Thanks for taking the time to discuss this, I feel strongly about information and love learning more on this. If possible, as you gain expertise, It is extremely helpful for me. would you mind updating your blog with more information. Thanks for taking the time to discuss this, I feel strongly about information and love learning more on this. If possible, as you gain expertise, It is extremely helpful for me. would you mind updating your blog with more information.
Hi! This is an excellent news, congratulations! I think its really helpfull for all of us. Something like this would perfectly work in londres I guess... Bye!
Hi, Sounds great! I have set up a google docs spreadsheet in South Florida so people can update the position and time of each bus and train in the Miami / Ft. Lauderdale area. I would love to be able to get a service available for non-smartphone useres and update these bus/train location times via SMS. If anyone can help, please contact pb33141@gmail.com http://realtimebustracker.blogspot.com https://www.facebook.com/pages/Real-Time-BUS-Tracker-South-Florida/234862156600159
Thank you for sharing to us.there are many person searching about that now they will find enough resources by your post.I would like to join your blog anyway so please continue sharing with us. Agen Sbobet338A
Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome Great work. Agen Sbobet
In this lesson we’ll explain just what some of those colourful expressions mean along with a list of terms which any poker player, who aspires to become conversant in the game needs to know. idn poker online Let’s start off with a list of poker terms that you’ll need to be familiar with. idn poker online After this all important glossary, we’ll return to the above “poker speak” example as it is the kind of conversation you will hear from other more experienced players. idn poker online
In this lesson we’ll explain just what some of those colourful expressions mean along with a list of terms which any poker player, who aspires to become conversant in the game needs to know. idn poker online Let’s start off with a list of poker terms that you’ll need to be familiar with. idn poker online After this all important glossary, we’ll return to the above “poker speak” example as it is the kind of conversation you will hear from other more experienced players. idn poker online
ketika anda ingin bermain poker anda pastinya menacari situs poker yang sudah terpercaya dan menjadi pilihan banyak pemain, situs IDN poker bisa jadi pilihan anda untuk bermain poker, pelaynan terbaik yang bisa anda dapatkan dan keuntungan yang bisa anda dapatkan setiap hari dengan mudah, dan keamanan saat anda bermain anda bisa dapatkan saat anda bermain poker di situs IDN Poker. https://cishub.boardhost.com/profile.php?section=personal&id=5669
Yes yes yes
ReplyDeleteSince I started to ride the bus I have been dreaming of such a system but I have a lack of the needed skills.
Good luck to you and you get a big +1 in my book
Thanks combination of suitable and useful information and well-written sentences that will certainly entice your sense.There are so multiple comments here that are really entertaining and conducive to me thanks for sharing a link especially for sharing this blog.
DeleteYou're a genius = congratulations for creating a solution to such a common problem
ReplyDeleteNice job, but this is quite an overkill.
ReplyDeleteFrom what I understand all processing is done on the controller, which is nice but takes up a lot of work and a lot of time(running the TCP stack+processing on uC).
Why didn't you simply write a computer program/script to do the processing and have it notify your "led"?
It didn't even have to run on a computer, routers these days can run programs too.
Eyal.
eyal@cohenim.net
Nice project! I love seeing people do innovative, small things that agregates info from the real world and other sources to make life a bit easier. d(^-^)
ReplyDeleteIf only my local bus company would do the same. *sigh* A few years back they got electronic currency cards which I asume communicates with their central computer system through GSM or some such. Why they haven't included GPS-updates is beyond me, the added cost would be utterly negible compared to the value.
Instead of wasting 10-20 minutes a day waiting for the bus home from work, I could just map it's GPS-coordinates to google maps, and know exactly when I had to leave.
Lucky bastard... =P
I think you meant to say flash based, not php based... the text version is written in php too.
ReplyDeleteYou are correct. I meant the map is flash based
ReplyDeleteSo a real time programer makes me want to ask what do you recommend to learn your skill and how to begin.
ReplyDeleteI started with a book of the "visual quickstart" series entitled C++ programming. Theres not an easier way to get started in my opinion. Like anything though, skill comes with practice.
ReplyDeleteThat same project in live I have seen in Germany (Bremen), in every bus stop was table where I can see ho min. is to next bus!
ReplyDeleteyour post looks very interesting for me, Great blog! I am loving it!! Will come back again. I am totally excited about this blog
ReplyDeletefoto gadis smu,camera,komputer game,film,Pencairan Es Greenland
I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post.
ReplyDeleteAC Milan vs Lazio Live Streaming
West Bromwich Albion vs Wigan Athletic Live Streaming
Manchester United vs Aston Villa Live Streaming
Sunderland vs Chelsea Live Streaming
Arsenal vs Everton Live Streaming
AC Milan vs Lazio Live Streaming
West Bromwich Albion vs Wigan Athletic Live Streaming
Manchester United vs Aston Villa Live Streaming
Sunderland vs Chelsea Live Streaming
Arsenal vs Everton Live Streaming
Technology News | News Today | Live Streaming TV Channels Online Free
man you are genius
ReplyDeleteHey,Good impressive job.This is the great project you have done here.This is the very interesting knowledge shared through this article.Thanks and keep posting more valuable data like this.
ReplyDeletegeneric viagra online
nice post...
ReplyDeleteJust Sharing
Media Online News
Music Reviews
Song Lyrics
Pets for Us
I am thoroughly convinced in this said post. I am currently searching for ways in which I could enhance my knowledge in this said topic you have posted here. It does help me a lot knowing that you have shared this information here freely. I love the way the people here interact and shared their opinions too. I would love to track your future posts pertaining to the said topic we are able to read.
ReplyDeleteI would like to thank you for that great post. It's very interesting to read your posts.
ReplyDeleteWell, having just started to play around with the wiznet ethernet module (which comes on the arduino ethernet shield), I decided to make this my next project. So without further ado, I present the Bus Notifier!
ReplyDeleteThanks for sharing your invention it's really nice I like it good job keep doing more as same.
ReplyDeleteThanks for sharing about IP address and your invention it's really great job you did I appreciate it good luck.....
ReplyDeletegeneric viagra
The complete and informative as usuall.. since i found your blog just stuck on it thanks again bro
ReplyDeleteGreat post! I?m just starting out in community management/marketing media and trying to learn how to do it well - resources like this article are incredibly helpful. As our company is based in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your own genuine enthusiasm and share the fact that your product is useful in that case. Singapore travel Agen Sbobet chinese new year 2012 mid autumn festival 2011 hungry ghost festival 2011
ReplyDeletewell...i have not seen it and used it either ...but i also think it takes ample amount of time....
ReplyDeleteThis post is really intresting.Thank you for sharing the post.We ship our tropical indoor and outdoor furniture to any U.S. and worldwide location. Florida Rattan Furniture
ReplyDeleteHi,
ReplyDeleteThanks for sharing this uniuqe information.. Really very much informative..
Thanks!!!!
buy viagra
this article are incredibly helpful. As our company is based in the US
ReplyDeleteNorth Face coats
ReplyDeleteKids North Face Jackets
Mens North Face Down Jackets
Mens North Face Hoody
Mens North Face Jackets
Mens North Face Shoes
North Face Backpacks
North Face Gloves
Womens North Face Jackets
Womens North Face Shoes
North Face 3 in 1 Jackets
North Face Apex Bionic Jackets
North Face Bionic Jackets
North Face Boots
North Face Down Jackets
North Face Gore Tex Jackets
North Face Hats
I must admit that this is one great insight. It surely gives a company the opportunity to get in on the ground floor and really take part in creating something special and tailored to their needs.
ReplyDeleteAgen Sbobet
Bola Tangkas
Casino Sbobet
Thanks for taking the time to discuss this, I feel strongly about information and love learning more on this. If possible, as you gain expertise, It is extremely helpful for me. would you mind updating your blog with more information.
ReplyDeleteThanks for taking the time to discuss this, I feel strongly about information and love learning more on this. If possible, as you gain expertise, It is extremely helpful for me. would you mind updating your blog with more information.
I am totally dumped fellow. I did not even any idea about these thing what you shared.
ReplyDeleteIt has been working this way every morning for the last three or so months.
ReplyDeleteGPS bus notifier is more useful.It is hopefully convenient for using.
ReplyDeleteI think that this could be a success if you take the time to improve it, HCG Blue Drops, the Faster and Natural way to lose weight...
ReplyDeletegenius.. thanks..
ReplyDeletePet Bounce
You are genius . Very useful project . Thanks for those link and code .
ReplyDeletethe door and head to the bus, preferably without using my computer.
ReplyDeleteA little background info first: my city (Gainesville FL) recently put gps systems in most of their busses, which can be checked from the internet.
ReplyDeleteWhere did you get that GPS bus notifier? I need something like that
ReplyDeleteHi! This is an excellent news, congratulations! I think its really helpfull for all of us. Something like this would perfectly work in londres I guess... Bye!
ReplyDeleteHi, Sounds great! I have set up a google docs spreadsheet in South Florida so people can update the position and time of each bus and train in the Miami / Ft. Lauderdale area.
ReplyDeleteI would love to be able to get a service available for non-smartphone useres and update these bus/train location times via SMS.
If anyone can help, please contact pb33141@gmail.com http://realtimebustracker.blogspot.com
https://www.facebook.com/pages/Real-Time-BUS-Tracker-South-Florida/234862156600159
Tale un bel post. Continuate così.
ReplyDeleteThank you for sharing to us.there are many person searching about that now they will find enough resources by your post.I would like to join your blog anyway so please continue sharing with us. Agen Sbobet 338A
ReplyDeleteIts a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome Great work. Agen Sbobet
ReplyDeletemantap gan :)
ReplyDeleteForum Judi Bola
Agen Bola
Agen Ibcbet
Agen Bola
In this lesson we’ll explain just what some of those colourful expressions mean along with a list of terms which any poker player, who aspires to become conversant in the game needs to know.
ReplyDeleteidn poker online
Let’s start off with a list of poker terms that you’ll need to be familiar with.
idn poker online
After this all important glossary, we’ll return to the above “poker speak” example as it is the kind of conversation you will hear from other more experienced players.
idn poker online
In this lesson we’ll explain just what some of those colourful expressions mean along with a list of terms which any poker player, who aspires to become conversant in the game needs to know.
ReplyDeleteidn poker online
Let’s start off with a list of poker terms that you’ll need to be familiar with.
idn poker online
After this all important glossary, we’ll return to the above “poker speak” example as it is the kind of conversation you will hear from other more experienced players.
idn poker online
ketika anda ingin bermain poker anda pastinya menacari situs poker yang sudah terpercaya dan menjadi pilihan banyak pemain, situs IDN poker bisa jadi pilihan anda untuk bermain poker, pelaynan terbaik yang bisa anda dapatkan dan keuntungan yang bisa anda dapatkan setiap hari dengan mudah, dan keamanan saat anda bermain anda bisa dapatkan saat anda bermain poker di situs IDN Poker.
ReplyDeletehttps://cishub.boardhost.com/profile.php?section=personal&id=5669