Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
dyne
May 9, 2003
[blank]

SnoPuppy posted:

Others have given good explanations as to what you need to do to buffer the signal, but I'm curious if you've tried just driving it directly with the 5V output from the Arduino.

Even though the existing signal is at 12-14V, it's possible that the tach will accept a TTL level signal (5V) directly.

edit:
Out of curiosity, how are you interfacing the 12-14V alternator signal to the arduino?

It doesn't work with just the 5v signal, unfortunately. It does work with the npn transistor, though! I'm able to output to that tachometer using the tone() function, and the tachometer seems to be reading it correctly and is displaying the correct corresponding RPM (except when I try tone() with a frequency of 0; the tachometer reads about 900rpm this way for some reason unknown to me).

For the input circuit, I had simply made a voltage divider ( [engine signal wire]--[10k resistor]--[arduino]--[10k resistor]--[ground] ), so that the signal would be 6-7v for the arduino

I had written a simple sketch that had used attachinterrupt() to determine the period of the engine signal, multiplied that by 1.5, then output an appropriate square wave just using digitalWrite() and delay(). It had been working okay on a breadboard a couple years ago when I originally made it (using a comparator instead of an npn transistor for output). Then I made the circuit on a perfboard, it didn't work, and I gave up until a couple nights ago.

The arduino isn't reading the engine signal now, for some reason. I swear it was reading it just fine before on the breadboard.

Adbot
ADBOT LOVES YOU

Sagebrush
Feb 26, 2012

Do you have access to an oscilloscope? Hook it up and see if you're getting a clean signal from the car, then check and see that it's also going cleanly into wherever the arduino connects, and so on.

dyne
May 9, 2003
[blank]
I don't, unfortunately. I think I could make one of those arduino oscilloscopes; I bought enough parts to build a few arduinos.

I wonder if it's a noisy signal or if the voltage is still too high with the resistors I used for the divider circuit.

Delta-Wye
Sep 29, 2005

dyne posted:

I don't, unfortunately. I think I could make one of those arduino oscilloscopes; I bought enough parts to build a few arduinos.

I wonder if it's a noisy signal or if the voltage is still too high with the resistors I used for the divider circuit.

It could be a number of things, but I wouldn't be surprised if you blew up that digital input :toot:

The arduino input should read a high at surprisingly low voltages. I haven't played with atmega chips to know off the top of my head, but I was doing some stuff with a PIC16 series chip and the 5V input switched at ~1.25V, for example. 6-7V is too high and I recommend you do something like [input] -> [10k] -> [10k] -> [arduino] -> [10k] -> [gnd]. If your input is 12-14V (based on your previous divider outputs) this should give 4-4.5V which should be alright. I'd recommend running the input through a low-pass filter to remove noise (do you know your highest input frequency?) and a diode clamp to prevent over voltage.

Really basic low-pass filter:


Zener clamp:


A zener of ~4.5-5V should be fine. Between this and a low-pass filter, you will have reasonable protection for arduino from the hellishly noisy automotive environment, including transitory voltage spikes. If you're curious about calculating some of these values, I'd be willing to help if you can produce some expected frequency ranges for your input.

dyne
May 9, 2003
[blank]
Some help would be great. The frequencies I could conceivably seen on the input side are 0 to 400 Hz (which would correspond to ~8000rpm). If it helps, I have a large selection of resistors, 22pF ceramic caps, 0.1uF and 10uF electrolytic caps, and 17V 0.5w zener diodes (and also whatever radioshack carries in store).

Delta-Wye
Sep 29, 2005

dyne posted:

Some help would be great. The frequencies I could conceivably seen on the input side are 0 to 400 Hz (which would correspond to ~8000rpm). If it helps, I have a large selection of resistors, 22pF ceramic caps, 0.1uF and 10uF electrolytic caps, and 17V 0.5w zener diodes (and also whatever radioshack carries in store).

Probably a better post for the magic blue smoke thread, but here we go! I wish I had mathematic markup, but this will work. See http://www.electronics-tutorials.ws/filter/filter_2.html for more detail if you're curious.

400Hz is a good number, but I'll aim the low-pass filter cutoff frequency a bit higher to maintain some of the square wave shape while hopefully still removing noise. If you knew what the introduced noise looks like, you can often filter specific sources out (for instance, removing 60Hz hum from wall powered audio equipment), but whatev; I'll aim for 1KHz for explanatory purposes, someone else may want to chip in with a better recommendation. Whatever your goal frequency is though, this formula applies:
code:
f = 1 / (2*pi*R*C)
If we assume you have a 0.1uF capacitor, you can rearrange the formula to get
code:
(f * 2 * pi * C) = 1 / R
when solved using f = 1KHz and C = 0.1uF, the value R = 1.6K is found.

1.6K should be part of the E24 resistor set so hopefully you have one around. If not, you can find a simliar value and recalculate to find the corner frequency.

Your 17V zener diodes are a bit weird - I normally place diodes at the output side (nearest the arduino) instead of at the input, but that would require ~5V zener. If you use the second circuit, it should work to remove a large portion of the high frequency noise and clamp the input to no higher than 17V (zeners suck and I wouldn't be surprised if it will peak out closer to 20V by the time the zener is totally 'on'), but we can use 18V for our calculations. The RC filter relies on a fairly hefty input resistance IIRC, so I would use a pretty hefty resistor divider. The divider should be 1:3, so either 10k->30K or 1M->3M or something, with fairly high values if you have them, which will give 4.5V at 18V. Sanity check shows that 12V gives only 3V. If you are missing signals, you may have to get a little less aggressive with the divider or drop a comparator into the circuit. Hell, you can even use a MOSFET that can withstand 20Vish input on the gate and use it to switch 5V on and off.



Connect the gate (Vin) up to the output of your RC-clamp circuit, and Vdd to 5V, and the output (Vout) to your digital input. If your 5V is solid, the mosfet should provide quite a bit of protection to the rest of your circuit.

Delta-Wye fucked around with this message at 23:22 on May 23, 2013

Delta-Wye
Sep 29, 2005
Also, can the Arduino interrupt on falling and rising edges? If so, your interrupt handler can simply keep a count of edges and toggle your output every three edges. Something like this (psuedo code!)

code:
void digital_int<interupt__>() {

  static int count = 0;

  if (++count > 2) {
    output ^= output;
    count = 0;
  }

}

dyne
May 9, 2003
[blank]
Thanks for the suggestions. I apparently was apparently smart and used the appropriate voltage divider resistors when I put the circuit together (39k and 22k), so that it reduced the 14v signal to 5ish volts. My problem with not getting any input was that I had stupidly assigned the attachInterrupt to pin 2, when I was supposed to assign it to zero. Woops.

Anywho, my new problem is that I'm getting a very erratic input. When I enabled the attachInterrupt correctly, even with the pin disconnected from anything but a 3" wire, I get really erratic/random/wonky output from the arduino to the tachometer. The only time it settles down is if I ground the input pin. If I attach the input pin to the engine tachometer signal (via the voltage divider and RC filter), there isn't any effect.

Could this be due to noise coming in through the power lines or something?

here's my preliminary code:
code:
int pinTachOut = 3;
int pinTachIn = 0;
long tpTach = 0;
long tcTach = 0;
unsigned volatile int freq = 50;
volatile float TachPeriod = 0;

void setup() {
  pinMode(pinTachIn,INPUT);
  digitalWrite(pinTachIn,HIGH); 
  attachInterrupt(pinTachIn,pulseTach,RISING);
  pinMode(pinTachOut,OUTPUT);
}

void loop() {
  if(freq < 400){
    tone(pinTachOut, freq);
  }
}

void pulseTach() {
    tpTach = tcTach;
    tcTach= millis();
    TachPeriod = (tcTach-tpTach)*1.5;
    freq = (int) 1000/TachPeriod;  
}
Thanks for all the help so far.

TheLastManStanding
Jan 14, 2008
Mash Buttons!

dyne posted:

here's my preliminary code:


Thanks for all the help so far.

- Interrupt 0 is on pin 2. Confusing, I know. So pinTachIn should be 2, with the tach input on pin 2. When you attach the interrupt, the first argument is 0. You also don't want that first digitalwrite.
- I don't get why your if statement runs if freq is < 400. You should have your main loop running on a timer so that it updates regularly: As it is it will be banging the tone function constantly, which can give erroneous results.
- tpTach and tcTach need to be volatile unsigned long since they are storing the millis. As an int they are probably rolling over.
- TachPeriod and freq could be integers since they are small, but it doesn't matter.

dyne
May 9, 2003
[blank]

TheLastManStanding posted:

- Interrupt 0 is on pin 2. Confusing, I know. So pinTachIn should be 2, with the tach input on pin 2. When you attach the interrupt, the first argument is 0. You also don't want that first digitalwrite.
- I don't get why your if statement runs if freq is < 400. You should have your main loop running on a timer so that it updates regularly: As it is it will be banging the tone function constantly, which can give erroneous results.
- tpTach and tcTach need to be volatile unsigned long since they are storing the millis. As an int they are probably rolling over.
- TachPeriod and freq could be integers since they are small, but it doesn't matter.
-Yeah, attach interrupt is a bit confusing. So I would reference the physical pin as 2 everywhere except in the attachInterrupt()?
-I have the first digitalWrite because I thought you had to do that to activate the pull up resistor? I had figured I was getting an erratic signal on the input because the voltage was floating
-I added the freq < 400 because the output was all over the place, and at greater frequency the tachometer needle smacks around way past red line. I'll be removing that when I finally get the thing working properly.
-Thanks for the tips re:variable types. Shouldn't tachperiod be a float since I'm multiplying the period by 1.5? Or does that not matter?

dyne fucked around with this message at 04:04 on May 24, 2013

Delta-Wye
Sep 29, 2005

dyne posted:

-Yeah, attach interrupt is a bit confusing. So I would reference the physical pin as 2 everywhere except in the attachInterrupt()?
-I have the first digitalWrite because I thought you had to do that to activate the pull up resistor? I had figured I was getting an erratic signal on the input because the voltage was floating
-I added the freq < 400 because the output was all over the place, and at greater frequency the tachometer needle smacks around way past red line. I'll be removing that when I finally get the thing working properly.
-Thanks for the tips re:variable types. Shouldn't tachperiod be a float since I'm multiplying the period by 1.5? Or does that not matter?

You want to avoid float or floating point operations as much as possible. I think this is still the right way to do it:

code:
int pinTachOut = 3;
int pinTachIn = 0;
long tpTach = 0;
long tcTach = 0;
unsigned volatile int freq = 50;
volatile float TachPeriod = 0;

void setup() {
  pinMode(pinTachIn,INPUT);
  digitalWrite(pinTachIn,HIGH); 
  attachInterrupt(pinTachIn,pulseTach,CHANGE);
  pinMode(pinTachOut,OUTPUT);
}

void loop() {

}

void pulseTach() {

  static int count = 0;

  if (++count > 2) {
    digitalWrite(pinTachOut, !digitalRead(pinTachOut));
    count = 0;
  }
}
EDIT: Realize I forgot to change 'RISING' to 'CHANGE'. A very important detail too!

Delta-Wye fucked around with this message at 16:06 on May 24, 2013

TheLastManStanding
Jan 14, 2008
Mash Buttons!

dyne posted:

-Yeah, attach interrupt is a bit confusing. So I would reference the physical pin as 2 everywhere except in the attachInterrupt()?
-I have the first digitalWrite because I thought you had to do that to activate the pull up resistor? I had figured I was getting an erratic signal on the input because the voltage was floating
-I added the freq < 400 because the output was all over the place, and at greater frequency the tachometer needle smacks around way past red line. I'll be removing that when I finally get the thing working properly.
-Thanks for the tips re:variable types. Shouldn't tachperiod be a float since I'm multiplying the period by 1.5? Or does that not matter?

- Correct. You're using pin 2, which is the 0th interrupt. If you use pin 3 it's the 1st interrupt.
- In this case you don't need it. Technically you don't need the pinmode input either since that's the default, but still use them just to be safe.
- You can still use that if statement to protect over running the tach, but you always have to be careful with simple loops with pin writes since they'll often loop before the write cycle is complete and you end up a signal that's always high or low.
- I don't remember when the number gets truncated, so you'd have to test. Floats take more space and take longer to calculate, but in this case it doesn't matter (it very very rarely does).

code:
int pinTachIn = 2; // pin 2 is interrupt 0.
int pinTachOut = 3;
unsigned long timer = 0; // timers are always unsigned longs
volatile unsigned long tcTach = 0; // volatile since it's called inside an interrupt
volatile unsigned int freq = 50; // reference says this is what the tone function expects

void setup()
{
  pinMode(pinTachIn,INPUT);
  attachInterrupt(0,pulseTach,RISING); // 0th interrupt
  pinMode(pinTachOut,OUTPUT);
}

void loop()
{
 if( millis() - timer > 100 ) // This times the loop to run every 100 ms
  {
   timer = millis(); // resets loop timer
   if(freq < 400) // protects overrun
    {
     tone(pinTachOut, freq); // output
    }
  }
}

void pulseTach()
{
 freq = 2000 / 3 / ( millis() - tcTach ); // get freq from timing last read
 tcTach = millis(); // resets tach timer
}

TheLastManStanding fucked around with this message at 08:49 on May 24, 2013

Delta-Wye
Sep 29, 2005

TheLastManStanding posted:

- You can still use that if statement to protect over running the tach, but you always have to be careful with simple loops with pin writes since they'll often loop before the write cycle is complete and you end up a signal that's always high or low.

I thought digitalWrite was blocking on the Arduino platform? Also AnalogRead, which takes forever.

dirtycajun
Aug 27, 2004

SUCKING DICKS AND SQUEEZING TITTIES
I want to get into using arduino for some art projects, what do you guys recommend as the best way to learn how to use one (best starter set or what not) Add to this that I have never coded before and this will be my first time on that front too. I live in Philly if you can point me to a workshop or something.

Bad Munki
Nov 4, 2008

We're all mad here.


It's going to be harder because you've never programmed before. With that in mind, the first thing you'll want to do is establish a basic understanding of program controls, structures, and flow. For that, just google around for some C tutorials. Here are a few (scroll down to the second section, titled "C Tutorial - C Made Easy"): http://www.cprogramming.com/tutorial.html

For Arduino-specific stuff, the nice folks at Arduino HQ have a good series of tutorials covering all sorts of Arduino-related topics covering everything from simply blinking a single LED to controlling a full-on robot: http://arduino.cc/en/Tutorial/HomePage

If you have the time, it'd probably be a good idea to enroll in a programming class if you can find one. Really any beginner-level class will do, but for your purposes, a class working in C would be optimal. Formal schools are good, but you might find something better tailored to your goals through a less formal group, such as a makerspace. Philadelphia has several, and I'm sure at least one of them has some programming classes once in a while. Just poking at their websites real quick, it looks like Hive76 has a microcontroller workshop coming up, that might be right up your alley. Here's a list of local makerspaces: http://hackerspaces.org/wiki/Philadelphia

Hopefully that's enough to at least get you moving in the right direction. :)

dirtycajun
Aug 27, 2004

SUCKING DICKS AND SQUEEZING TITTIES

Bad Munki posted:

It's going to be harder because you've never programmed before. With that in mind, the first thing you'll want to do is establish a basic understanding of program controls, structures, and flow. For that, just google around for some C tutorials. Here are a few (scroll down to the second section, titled "C Tutorial - C Made Easy"): http://www.cprogramming.com/tutorial.html

For Arduino-specific stuff, the nice folks at Arduino HQ have a good series of tutorials covering all sorts of Arduino-related topics covering everything from simply blinking a single LED to controlling a full-on robot: http://arduino.cc/en/Tutorial/HomePage

If you have the time, it'd probably be a good idea to enroll in a programming class if you can find one. Really any beginner-level class will do, but for your purposes, a class working in C would be optimal. Formal schools are good, but you might find something better tailored to your goals through a less formal group, such as a makerspace. Philadelphia has several, and I'm sure at least one of them has some programming classes once in a while. Just poking at their websites real quick, it looks like Hive76 has a microcontroller workshop coming up, that might be right up your alley. Here's a list of local makerspaces: http://hackerspaces.org/wiki/Philadelphia

Hopefully that's enough to at least get you moving in the right direction. :)

Thank you for the quick response! I have a fair amount of practice building stuff and fixing electronics so at least it won't be too bad on that end. I really want to get into messing with these boards because I can see a whole bunch of uses for street art that hasn't been approached before.

HATE TROLL TIM
Dec 14, 2006
Don't worry about learning C or taking programming classes. While Wiring is based on the structure of C, there's so many libraries and bits of example code out there it's very easy to start off by customizing other people's code. If you're at all intelligent (and it sounds like you are) you should have no problems learning this way.

After all, Wiring (and Arduino by extension) was designed to be used by artists.

If you want a good book, I highly recommend "Programming Arduino" by my friend Dr. Simon Monk. Well written, fast paced and fun.

Bad Munki
Nov 4, 2008

We're all mad here.


I was just recommending the class as an alternate form of learning--and specifically a class at a makerspace because it'll likely be tailored for exactly what he's going to be doing. Different people learn different ways, and for some, an interactive class is the best option. For others, a written tutorial is fine. While I agree that for a lot of basic stuff you can sort of bludgeon your way through by mashing up various examples, if you don't know how to program at all, that's REALLY not going to get you very far, and the first time something doesn't luckily work, you'll be completely stuck. Remember, completely new to programming means you don't know about functions, you don't know about logic statements, you don't even know about variables. That is stuff that is the most fundamental part of ANY programming language, and without those basic tools at your disposal, you're going to have a really hard time, if you meet with any success at all. How, pray tell, do you customize someone's code if you don't even know how to read it? :)

So yeah, with that in mind, you have to start somewhere, and "learning to program" is the first step, be it through a class, a tutorial, or, as you suggested, a book.

dirtycajun
Aug 27, 2004

SUCKING DICKS AND SQUEEZING TITTIES

Bad Munki posted:

I was just recommending the class as an alternate form of learning--and specifically a class at a makerspace because it'll likely be tailored for exactly what he's going to be doing. Different people learn different ways, and for some, an interactive class is the best option. For others, a written tutorial is fine. While I agree that for a lot of basic stuff you can sort of bludgeon your way through by mashing up various examples, if you don't know how to program at all, that's REALLY not going to get you very far, and the first time something doesn't luckily work, you'll be completely stuck. Remember, completely new to programming means you don't know about functions, you don't know about logic statements, you don't even know about variables. That is stuff that is the most fundamental part of ANY programming language, and without those basic tools at your disposal, you're going to have a really hard time, if you meet with any success at all. How, pray tell, do you customize someone's code if you don't even know how to read it? :)

So yeah, with that in mind, you have to start somewhere, and "learning to program" is the first step, be it through a class, a tutorial, or, as you suggested, a book.

I learn by doing and hands on stuff almost exclusively which is pretty awesome for some things and terrible for others. I can build a computer, fix a car, be a paramedic; but my whole life things like foreign languages and coding have been really really difficult. I looked up that Hive 76 hackerspace and they have all kinds of open houses so maybe that will get me jump started.

HATE TROLL TIM
Dec 14, 2006

Bad Munki posted:

I was just recommending the class as an alternate form of learning--and specifically a class at a makerspace because it'll likely be tailored for exactly what he's going to be doing. Different people learn different ways, and for some, an interactive class is the best option. For others, a written tutorial is fine. While I agree that for a lot of basic stuff you can sort of bludgeon your way through by mashing up various examples, if you don't know how to program at all, that's REALLY not going to get you very far, and the first time something doesn't luckily work, you'll be completely stuck. Remember, completely new to programming means you don't know about functions, you don't know about logic statements, you don't even know about variables. That is stuff that is the most fundamental part of ANY programming language, and without those basic tools at your disposal, you're going to have a really hard time, if you meet with any success at all. How, pray tell, do you customize someone's code if you don't even know how to read it? :)

So yeah, with that in mind, you have to start somewhere, and "learning to program" is the first step, be it through a class, a tutorial, or, as you suggested, a book.

I guess my post came off a bit smarmy, though I didn't mean it that way, just the unfortunate side effect of typing on my iPhone I suppose.

While I do agree a programming class is a great idea if you get serious and want to learn things by the book, Wiring itself is fairly simple to get the hang of and you don't really need to worry about a lot of the traditional programming stuff (functions) when dealing with Arduino as everything can live happily inside the main or loop functions. Logic and variables can be quite easily learned from tutorials or a book.

I suppose what I was trying to get across was that Wiring and Arduino were designed from the ground up to be easy to use for non-programmers.

Edit: If you learn by doing, just dive in and start messing with code you find online. If you focus on figuring small pieces out as you go, you'll be able to write your own program before you know it! I've learned every language I know this way. Classes and books just don't do it for me, I've got to tinker and figure it out.

Billa
Jul 12, 2005

The Emperor protects.
I do not know anything about programming but I'm learning slowly and good it felt when yesterday made a led blink for a second using the loop function. It was awesome!

wolrah
May 8, 2006
what?

Billa posted:

I do not know anything about programming but I'm learning slowly and good it felt when yesterday made a led blink for a second using the loop function. It was awesome!

I've been programming for years and I still did a big :haw: grin when I first ran the blink example, then tinkered with the loop a bit and made it do random intervals. Even though I know it's still the same idea, the fact that my code on my screen makes physical things do things somehow makes it feel sort of new again.

Delta-Wye
Sep 29, 2005

wolrah posted:

I've been programming for years and I still did a big :haw: grin when I first ran the blink example, then tinkered with the loop a bit and made it do random intervals. Even though I know it's still the same idea, the fact that my code on my screen makes physical things do things somehow makes it feel sort of new again.

This a 100x times. Forget crappy console applications or GUI applications, my programs drive around in a robot body :science:

Bad Munki
Nov 4, 2008

We're all mad here.


What's the easiest route to get my arduino to make an http request to a server on the web somewhere with a little bit of data via url params? I'm looking at xbees and wifi shields and such, but the former seems to be more for xbee-to-xbee communication (for mesh networks) and both seem to be more geared towards a much lower level of communication than I'm after. I literally just the path of least resistance to being able to periodically hit something like http://mysite.com/logger?val=X

I like the xbee more if I can easily make it do what I want because it seems to be a more interesting module in general (and is more readily compatible with my teensy, which isn't required, but a definite plus), but if it's going to be a huge hassle software-wise, I'm less interested.

Zuph
Jul 24, 2003
Zupht0r 6000 Turbo Type-R
Does it have to be wireless?

Bad Munki
Nov 4, 2008

We're all mad here.


Yep.

Delta-Wye
Sep 29, 2005

Bad Munki posted:

What's the easiest route to get my arduino to make an http request to a server on the web somewhere with a little bit of data via url params? I'm looking at xbees and wifi shields and such, but the former seems to be more for xbee-to-xbee communication (for mesh networks) and both seem to be more geared towards a much lower level of communication than I'm after. I literally just the path of least resistance to being able to periodically hit something like http://mysite.com/logger?val=X

I like the xbee more if I can easily make it do what I want because it seems to be a more interesting module in general (and is more readily compatible with my teensy, which isn't required, but a definite plus), but if it's going to be a huge hassle software-wise, I'm less interested.

If you go xbee, you're going to need a base-station of some sort eventually - the xbee's are used for xbee-to-xbee communication. If you just have two, you can configure them to transparently act as serial ports and get wireless rs232 without additional configuration (I have two I have paired and just plug them in when needed, they store the config between powerups). If you have many, you can also configure them for mesh networking (iirc) so that all of your nodes don't need to see the base station, just one with a string of nodes connecting all the others. This is pretty nice for a distributed setup like whole-house monitoring or the like.

Eventually you'll need an ethernet or 802.11 adapter. Is there any reason you're shying away from some of the available shields? You say complexity, but if you're just doing the request and the device has an onboard tcp/ip stack, you're just sending out a series bytes that you can workout ahead of time (you can easily type up that request in telnet to see what I mean).

Ethernet: https://www.sparkfun.com/products/9026 (there is also a dedicated arduino model with the ethernet crap integrated)
Serial-to-ethernet gateway: https://www.sparkfun.com/products/9476
There are also small standalone 802.11 modules:
https://www.sparkfun.com/products/10004
https://www.sparkfun.com/products/10822 (in a xbee-like package!)

The prices don't seem outlandish.

EDIT:
Like this:

quote:

[me@My_Computer ~]$ telnet https://www.google.com 80
Trying 173.194.33.50...
Connected to https://www.google.com.
Escape character is '^]'.
GET / HTTP/1.1
host: https://www.google.com
The bold bits are what I actually typed; hitting enter twice after the host line results in the page, in all of it's text glory, being spit into my terminal. You can replace / with whatever path you want. The host bit is to assist a multi-host ip address with directing you to the right page afaik. It's a couple dozen characters, should be easy to write out and have the module send to the proper ip address.

Delta-Wye fucked around with this message at 21:53 on May 29, 2013

Bad Munki
Nov 4, 2008

We're all mad here.


I think that last item--the 802.11b/g xbee-form-factor board--might be just what I'm after. I'll have to look into writing some arduino software against it just to see what'll be involved.

HATE TROLL TIM
Dec 14, 2006
Just an FYI, my local Rat Shack has a lot of Arduino shields on massive clearance, not sure if it's nationwide or what, but I got a nice motor driver shield for $10 and they had ethernet shields for $15. (I also picked up a 1W/3W 9-12VAC/5-14VDC constant current source kit for $5, which seems nice. I'd have put more than $5 in parts making one from scratch.)

Edit: These are the official shields I guess? The $10 clearance motor shield.

HATE TROLL TIM fucked around with this message at 03:13 on Jun 1, 2013

whiteshark12
Oct 21, 2010

How that gun even works underwater I don't know, but I bet the answer is magic.
Anybody got an opinion on the Spark core on kickstarter right now? It's a small wifi module for $40 that backing ends for in 6 hours, and i'm sorely tempted to pick one up.

Gounads
Mar 13, 2013

Where am I?
How did I get here?

whiteshark12 posted:

Anybody got an opinion on the Spark core on kickstarter right now? It's a small wifi module for $40 that backing ends for in 6 hours, and i'm sorely tempted to pick one up.

Looking at their API, it looks like it connects to one of their servers, that proxies messages instead of directly connecting.

http://docs.sparkdevices.com/

That'd be a downside for me.

TheLastManStanding
Jan 14, 2008
Mash Buttons!

Gounads posted:

Looking at their API, it looks like it connects to one of their servers, that proxies messages instead of directly connecting.

http://docs.sparkdevices.com/

That'd be a downside for me.
The kickstarter says you can still program over usb or with a jtag.

MiNDRiVE
Nov 8, 2012
OK so i'm considering a project for my car using a Leonardo board to start off with during the prototyping and development. Spec sheet says 7v - 12v recommended and 6v - 20v are its limits. I have only ever used an Arduino board powered by usb so what i'm wondering is how well the on board voltage regulator will hold up to 12-14v. I won't be drawing much current at all so i'm probably worrying for no reason but I just figured I would cover all the bases.

HATE TROLL TIM
Dec 14, 2006

MiNDRiVE posted:

OK so i'm considering a project for my car using a Leonardo board to start off with during the prototyping and development. Spec sheet says 7v - 12v recommended and 6v - 20v are its limits. I have only ever used an Arduino board powered by usb so what i'm wondering is how well the on board voltage regulator will hold up to 12-14v. I won't be drawing much current at all so i'm probably worrying for no reason but I just figured I would cover all the bases.

I wouldn't power it directly from the car due to various power quality issues. Easiest solution would be to just use a USB cigarette lighter adapter.

dyne
May 9, 2003
[blank]
How well do the usb car chargers handle all the noise?

dyne fucked around with this message at 21:34 on Jun 4, 2013

wolrah
May 8, 2006
what?

dyne posted:

How well do the usb car chargers handle all the noise?

Not very. If I charge a cell phone while playing audio from it via Aux I get a fair bit of ignition noise. Three cars, three phones, and five power adapters with the same experience across the board. My GPS, which also uses a USB charger, actually puts noise in to the system. Plugging it in raises the noise floor on my CB significantly, I have the bump the squelch up two notches.

Assume car power is an electrical nightmare where all you can expect of it is to average 12-14 volts. If you expect anything else it might work in some or even most cars, but then fail miserably in another where the right combination of worn or underperforming parts and noisy components meet to make your device's life hell.

wolrah fucked around with this message at 23:18 on Jun 4, 2013

asdf32
May 15, 2010

I lust for childrens' deaths. Ask me about how I don't care if my kids die.

dyne posted:

How well do the usb car chargers handle all the noise?

Probably fine, but not necessarily any better than whatever on-board regulator handles the 6-20V input.

So I'd use whichever is more convenient, 5V or 12V.

MiNDRiVE
Nov 8, 2012
I see lots of bypass caps in my future.

a_pineapple
Dec 23, 2005


I'm building a bigass MIDI controller from scratch. I have a bunch of sketches written and tested, and a bunch of little "blocks" built (PCB soldered to knobs and buttons). The concept is something quite modular, where it would be possible to basically copy and paste functions in. Gonna post a thread when it's finished, just waiting for more loving wire connectors to show up.

I was wondering... A lot of the code uses for loops to cycle through multiplexers and LEDs and poo poo. For my purposes I want a fast codebase.
SO I was wondering. Which would run faster, a for loop or just addressing each thing in its own line or whatever?

This, where each instruction is a separate thing:
code:
void loop() {
	digitalWrite(1, HIGH);
	digitalWrite(2, HIGH);
	digitalWrite(3, HIGH);
	digitalWrite(4, HIGH);
	digitalWrite(5, HIGH);
	digitalWrite(1, LOW);
	digitalWrite(2, LOW);
	digitalWrite(3, LOW);
	digitalWrite(4, LOW);
	digitalWrite(5, LOW);
}
Or a for loop:
code:
void loop() {
	for(int i=0; i<5; i++){
		digitalWrite(i, HIGH);
	}
	for(int i=0; i<5; i++){
		digitalWrite(i, LOW);
	}
}

a_pineapple fucked around with this message at 21:04 on Jun 9, 2013

Adbot
ADBOT LOVES YOU

evensevenone
May 12, 2001
Glass is a solid.
It would be basically the same. In theory the loop would need to do some compare-and-jumps but in practice a modern compiler will just unroll it anyway if it can. Anyway it's going to be a teensy difference.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply