Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Project Guidance / Re: gracefully shutdown a windows computer with arduino on: September 12, 2012, 04:54:49 pm
yes I do, but the button is used as a flipper button when the pc and software are running, so I will have to make sure that the button press does not lead to any shutdown action in windows, not when pressed briefly, or when being held for several seconds, but I guess that can all be configured in windows xp itself.
2  Using Arduino / Project Guidance / Re: gracefully shutdown a windows computer with arduino on: September 12, 2012, 03:14:36 pm
ah thanks people, it seems there are quite a few options. I think I will have to experiment a bit to see what works best.

@Peter: The arduino does not work together  with the PC really. It is only used to switch it on. The PC will run pinball emulation software with 2 screens (one for playfield, one for backglass) and a Dot Matrix Display. Together with several buttons hooked up to a keyboard encoder (and some additional electronics) to act as inputs.

So the Arduino is only really used to detect a button press and switch the whole thing on. If you want to know more about these builds, you can check my progress or better yet, the "HyperPin Cabinet Forum". Its really fun :-)
3  Using Arduino / Project Guidance / Re: gracefully shutdown a windows computer with arduino on: September 12, 2012, 09:41:38 am
Ah thanks for that idea. Simpler is better and I simply had not thought about this direction :-) I think I will give this a try! However monitoring the PC's status still brings up similar questions: what is the safest/most reliable way to do that? Detect something over USB? Hookup a part of the PC to an input pin on the arduino (or would that fry the arduino or pc?)
4  Using Arduino / Project Guidance / Re: gracefully shutdown a windows computer with arduino on: September 12, 2012, 09:30:15 am
it is indeed running windows, PaulS. But, I am not sure what you mean having the PC shutting itself down? Like instead of going to a screensaver, shutting down?
5  Using Arduino / Project Guidance / gracefully shutdown a windows computer with arduino on: September 12, 2012, 09:22:48 am
Hi All,

As a lover of old arcade games and pinball, I have started building my own virtual pinball machine (if you want to know more you can check my blog). And for this project I have a question:

I want to use an arduino to switch on and off a PC that is inside the pinball machine. I plan to hookup a flipperbutton to an arduino and have it trigger an interrupt which switches the pc on. That I can work out.

However, if the machine is left alone for several minutes I want it to power down automatically, so when the flipperbutton is touched, I plan to set a timer for , say, 5 minutes. When the timer counts down to zero, it should shutdown windows and via a smartstrip the rest of the electonics in the cabinet is powered off also.

I wonder if this graceful shutdown is possible by using an Arduino? What would be a good and safe way to do this? Hookup the pc-power switch to the arduino? Or have it act as a keyboard and "press" the right keys or give it some sort of special command via usb? I do not want to just cut the power to it, as it will cause windows to be messed up on the next startup.

I have thought about these concepts, but am not sure where to start, nor do I want to break the PC.

Is this feasible or is this not something to do with an Arduino?
6  Using Arduino / Programming Questions / Re: Seeedstudio stalker v2 and Arduino IDE 1.0.1 can't get the example code to work? on: August 10, 2012, 04:34:15 am
that's actually what I had started to do: download and install IDE 0022 or 0023, see if that works and work from there. However, sooner or later I will want to go to Arduino 1.0, but not sure what I will have to change then.
7  Using Arduino / Programming Questions / Re: Seeedstudio stalker v2 and Arduino IDE 1.0.1 can't get the example code to work? on: August 10, 2012, 04:26:54 am
Wow, thanks for the quick reply! I will give that a go tonight!
8  Using Arduino / Programming Questions / Seeedstudio stalker v2 and Arduino IDE 1.0.1 can't get the example code to work? on: August 10, 2012, 04:16:10 am
Hi All,

I installed the Arduino IDE 1.0.1 today and was able to run some basic sketches on the stalker v2 I have, so programming works (with the uartsbee v3.1). However, I cannot get the example code to work (the example mentioned here: http://www.seeedstudio.com/wiki/Seeeduino_Stalker_v2.0#Source_Code_Examples).

Whatever I do, it cannot compile and complains that a lot of stuff is not "declared in this scope". It starts for example withe line in battery.cpp that sets the analogReference(INTERNAL). Compiler complains that INTERNAL is not declared.

I am guessing that I am doing something wrong with the location of the files, but dont know what.

Can somebody tell me where to put the cpp and .h files and the sketch? Mind you that I am using the latest Arduino IDE (the example mentions 0019 instead). And I running this on a Mac, but that seems to make no difference.

Any help is appreciated, because I would love the example to work so I can figure out how to use it for my own datalogging :-)
9  Using Arduino / Project Guidance / Re: How to optimize my code for future use? on: August 08, 2012, 09:06:10 am
Thanks! Will do, although I built in a parameter to switch logging on and off, so i hope that did not influence it. But I will work all these ideas in (once I am finished moving my "tinkering" room to the other side of the house) :-)
10  Using Arduino / Project Guidance / Re: How to optimize my code for future use? on: July 19, 2012, 04:51:11 am
Thanks for the tip, but I do not quite understand what benefit I get from putting it in a struct compared to sending just the two floats?

The receiver is also an arduino with an ethernet shield and an xbee shield, so it will also be programmed in C (Arduino IDE)
11  Using Arduino / Project Guidance / Re: How to optimize my code for future use? on: July 19, 2012, 01:55:20 am
Ah thanks! I will give that a try. I did not notice any crashing of the program or something, so how would this improve the sketch? By saving/not using memory?
12  Using Arduino / Project Guidance / Re: How to optimize my code for future use? on: July 18, 2012, 07:26:43 am
Were you able to, before? You can get a lot of data in 35 bytes.
Yes, I am not sure why but in the code I linked to, it works up to 35 characters, but breaks when I try to send 36. But, I believe others have been able to send a lot more in one packet?

Quote
Are key and value strings? They don't need to be.
Yes, I quite literally put in 'dev:grow,tmp:23.2,hum:86,mst:1021,lgt:1001,d1:1,d2:0,d3:1,d4:0'. At least thats the kind of information I want to send, but its too long. How would you suggest sending the data if it should not be strings?

The reason to send key and value pair (instead of only value and decoding it somewhere down the line) was to be able to easily expand whatever is sent without having to update the gateway unit to decode it before sending it to a webserver? Come to think of it, I could of course just send the whole payload to the webserver and use the gateway only as a device to change tranmission medium (xbee to ethernet).

Quote
Is there any reason why you can't send just key and value in a packet, and send multiple packets?
The reason for sending it all in one go was to save energy and have the radio on only as short as possible since I want to run the future update of this project on a seeedstudio stalker with solar panel and battery.

Quote
That's easy. Compile, link, upload, delete. No future changes possible.

I think if I rephrase my question/idea: how to go about dreaming up a way to easily expand what is sent from xbee nodes without having to change code everywhere. And do it in a fashion that consumes as little energy as possible.



[/quote]
13  Using Arduino / Project Guidance / How to optimize my code for future use? on: July 18, 2012, 06:01:50 am
Hi All,

In 2010 I saw several projects on using arduino's to monitor a garden. As an excercise I developed a similar project to monitor and control a greenhouse and send data wirelessly using Xbee to another xbee-equipped arduino, which connected to the internet and put the received data in a database.

That worked fine, until the box which I thought was waterproof, turned out not to be waterproof. Fried electronics and demotivated I threw the project aside.

Now, I want to pick it up again and change and expand it, but I am running into issues with managing my code. For example, for whatever reason I cannot seem to get more than 35 or so characters in an Xbee package between two Xbee (series 2) radio's. Another is the gateway device that I would like to extend to be able to deal with more nodes and thus more different types of data. For example: a weathernode may send temp, humidity, wind, rain, etc values. The garden node may send soiltemp, airtemp, soil moisture levels, etc while a node in the water tank reports water levels.

The problem with that is that I am not sure how to develop a protocol that can be used by the nodes and expanded later. I started using a string in each xbee message like this <key:value,key:value,key:value> but considering the 35 character limit of an xbee packet, I cannot send all the readings in one package.

I think I will be able to program a solution (I did manage to build the controller node and gateway node after all), but not sure how to "future proof" my code.

I know this is not a very concrete question, but is there anybody with similar experiences that has already learned some similar lessons and is willing to share?

If you want to have a look at the old code, I put it up on github some time ago: https://github.com/sindono/GrOW/blob/master/GrOW_Gateway/GrOW_Gateway.pde
https://github.com/sindono/GrOW/blob/master/GrOW_Controller/GrOW_Controller.pde

All help appreciated!
14  Using Arduino / Programming Questions / Re: How to extract server/domain from a URL in char[] on: July 04, 2011, 01:13:44 pm
Hi Rob,

Thanks for the valuable addition! Your addition eliminates the logic to look for a double forward-slash (which occurs in the protocol id http://)

Arno
15  Using Arduino / Programming Questions / Re: How to extract server/domain from a URL in char[] on: July 02, 2011, 05:12:22 am
All,

It took a bit of fiddling with the code but I managed to come up with a piece of code that does this:
Code:
      // Read the input from the terminal
      while (Serial.available()) {
        requestedURL[length] = Serial.read();
        length = (length+1) % 512;
        delay(50);
      }
      // terminate the input
      requestedURL[length] = '\0';
     
      // Now, find the spot where the domain/server ends and the rest of the URL starts
      int splitLocation = 0;
      boolean foundSplit = false;
     
      // Go through the terminal input, one character at a time and check for a forward-slash
      // if found, make sure the character before or after is not a forward-slash also, because
      // in that case we are dealing with the http:// part of a url.
      // if we find a single forward-slash, remember the position where that is in the char[]
      for (int i=0; i < length; i++) {
        if (foundSplit != true && requestedURL[i] == '/') {
          if (requestedURL[i-1] != '/' && requestedURL[i+1] != '/') {
            foundSplit = true;
            splitLocation = i;
          }
        }
      }
     
      // if foundSplit is true, then requestedURL can be split, if false, there is only a domain/server and no page
      // now store the domain/server part in hostName[]
      if (foundSplit == true) {
        for (int j=0; j < splitLocation; j++) {
          hostName[j] = requestedURL[j];
        }
       
        // and the rest in pagePartOfURL[]
        for (int k=splitLocation; k < length; k++) {
          pagePartOfURL[k-splitLocation] = requestedURL[k];
        }
        hostName[splitLocation] = '\0';
        pagePartOfURL[length-splitLocation] = '\0';
      }

Hopefully this may help others. And if anyone reading this has tips, tricks, improvements, etc, please let me know as I am sure there is room for improvement here!
Pages: [1] 2 3 4