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
Bad Munki
Nov 4, 2008

We're all mad here.


vas0line posted:

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 third option is that you could #define a shorthand for it that would be both readable, short, and force the technically-guaranteed-to-be-at-least-as-fast-if-not-ever-so-marginally-faster unrolled version, something like

code:
#define spew(a, b, c, d, e) digitalWrite(1, a); digitalWrite(2, b); digitalWrite(3, c); digitalWrite(4, d); digitalWrite(5, e);
...
spew(HIGH, HIGH, LOW, HIGH, LOW);
e: Of course, that's assuming you want different values on each pin. If you want literally the examples you posted, something like the following might be even simpler:

code:
#define spew(a) digitalWrite(1, a); digitalWrite(2, a); digitalWrite(3, a); digitalWrite(4, a); digitalWrite(5, a);
...
spew(HIGH);
spew(LOW);

Bad Munki fucked around with this message at 02:20 on Jun 10, 2013

Adbot
ADBOT LOVES YOU

Sagebrush
Feb 26, 2012

Not sure if this is something that's come up in the thread before, but I just discovered it and I think it's awesome. Energia is a refactoring of the Arduino IDE and toolchain to make a version that's compatible with the TI MSP430 launchpads. I haven't played with it much, but all the Arduino code I've tried so far has run seamlessly on the MSP430 after adjusting for the proper pins and such. This is a super big deal for me because I really like the MSP430 series as hardware, especially for their highly accurate internal clock and extreme low-power sleep mode, but the TI Code Composer Studio toolchain is just abysmal. Being able to just treat it like a slightly different Arduino is amazing.

Also the development kit is $10, often goes on sale for $4.30, and actually comes with two microcontrollers and a better socket than the Arduino so it's easy to program one and then drop it into another circuit (or breadboard). It even comes with a USB cable, something the current Arduinos inexplicably don't provide. Pretty sweet!

e: and it's even compatible with the Stellaris launchpad, which costs $13 and runs an 80MHz Cortex M4...I have two of those and haven't even tried programming them yet, so this is great

Sagebrush fucked around with this message at 23:06 on Jun 9, 2013

Delta-Wye
Sep 29, 2005

Sagebrush posted:

Not sure if this is something that's come up in the thread before, but I just discovered it and I think it's awesome. Energia is a refactoring of the Arduino IDE and toolchain to make a version that's compatible with the TI MSP430 launchpads. I haven't played with it much, but all the Arduino code I've tried so far has run seamlessly on the MSP430 after adjusting for the proper pins and such. This is a super big deal for me because I really like the MSP430 series as hardware, especially for their highly accurate internal clock and extreme low-power sleep mode, but the TI Code Composer Studio toolchain is just abysmal. Being able to just treat it like a slightly different Arduino is amazing.

Also the development kit is $10, often goes on sale for $4.30, and actually comes with two microcontrollers and a better socket than the Arduino so it's easy to program one and then drop it into another circuit (or breadboard). It even comes with a USB cable, something the current Arduinos inexplicably don't provide. Pretty sweet!

e: and it's even compatible with the Stellaris launchpad, which costs $13 and runs an 80MHz Cortex M4...I have two of those and haven't even tried programming them yet, so this is great

When you wrap the MSP430 hardware with the Arduino framework, do you lose a lot of the benefits like the low-power sleep modes? Interesting idea, but if you aren't able to take advantage of the low-power features there isn't a terrible amount of stuff in the MSP430 that is better than the competitors.

If you hate Code Composer (and you should!) I would recommend checking out CrossWorks for MSP430. It's my IDE of choice and it's a hell of a lot better than Code Composer. The integrated debug abilities are awesome.

TheLastManStanding
Jan 14, 2008
Mash Buttons!

vas0line posted:

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);
}
What you're looking for is Port Manipulation. Using PORTD you can read or write to pins 0 through 7 simultaneously using a single binary byte.

Mantle
May 15, 2004

Sagebrush posted:

Not sure if this is something that's come up in the thread before, but I just discovered it and I think it's awesome. Energia is a refactoring of the Arduino IDE and toolchain to make a version that's compatible with the TI MSP430 launchpads. I haven't played with it much, but all the Arduino code I've tried so far has run seamlessly on the MSP430 after adjusting for the proper pins and such. This is a super big deal for me because I really like the MSP430 series as hardware, especially for their highly accurate internal clock and extreme low-power sleep mode, but the TI Code Composer Studio toolchain is just abysmal. Being able to just treat it like a slightly different Arduino is amazing.

Also the development kit is $10, often goes on sale for $4.30, and actually comes with two microcontrollers and a better socket than the Arduino so it's easy to program one and then drop it into another circuit (or breadboard). It even comes with a USB cable, something the current Arduinos inexplicably don't provide. Pretty sweet!

e: and it's even compatible with the Stellaris launchpad, which costs $13 and runs an 80MHz Cortex M4...I have two of those and haven't even tried programming them yet, so this is great

When has the 430 gone on sale since the price bump? I'd like to pick up a few at that price.

HATE TROLL TIM
Dec 14, 2006

Sagebrush posted:

Not sure if this is something that's come up in the thread before, but I just discovered it and I think it's awesome. Energia is a refactoring of the Arduino IDE and toolchain to make a version that's compatible with the TI MSP430 launchpads. I haven't played with it much, but all the Arduino code I've tried so far has run seamlessly on the MSP430 after adjusting for the proper pins and such. This is a super big deal for me because I really like the MSP430 series as hardware, especially for their highly accurate internal clock and extreme low-power sleep mode, but the TI Code Composer Studio toolchain is just abysmal. Being able to just treat it like a slightly different Arduino is amazing.

Also the development kit is $10, often goes on sale for $4.30, and actually comes with two microcontrollers and a better socket than the Arduino so it's easy to program one and then drop it into another circuit (or breadboard). It even comes with a USB cable, something the current Arduinos inexplicably don't provide. Pretty sweet!

e: and it's even compatible with the Stellaris launchpad, which costs $13 and runs an 80MHz Cortex M4...I have two of those and haven't even tried programming them yet, so this is great

Wow, that's pretty cool! I've always liked the MSP430 (I'm a TI fanboy, what can I say), but absolutely hated the IDE and compiling by hand is a pain in the rear end, especially when you're just rigging up code for breadboarding or something. I use AVRs a lot in my projects because Wiring is a really quick way to prototype stuff. In fact, I don't even own an Arduino! I've just got an envelope full of ATmega328's that I either breadboard or stick into my Gertboard so I can directly program it via SPI from my Raspberry Pi.

If I can turn around some quick code on an MSP430 or Stellaris, that'll be my micro of choice from now on, I think. I wonder if Energia supports programming without a Launchpad? If I could just get some sample chips and throw em on a breadboard like I do with the ATmega328, that would be sweet! Though the Launchpad is only :10bux:, not that big of a deal...

Anyway, thanks for pointing this out! I might feature these more heavily in my book, instead of the AVRs.

A God Damn Ghost
Nov 25, 2007

booyah!
I'm just getting into doing this and am looking to buy some materials for my first project. I know Python (no C), and was recommended to use BeagleBone instead of an Arduino board since it has Linux on it and has easier/more I/O. Does that seem like a good suggestion to you? I'm decent but not spectacular at Python, really only have limited experience in the past year or so with programming so I'd rather not learn a new language just yet, if I don't have to.

TheLastManStanding
Jan 14, 2008
Mash Buttons!
What you should get depends on what you plan to do as a project, but I recommend starting with an Arduino. C is a very simple language and is the easiest language (in my opinion) to learn. The Arduino also benifits from having the most documentation and the largest user base (as far as I know). If you're set on sticking with python and are still new then I'd probably recommend a Raspberry Pi over a BeagleBone; it has a lot less I/O, but it has the same functionality for fraction of the price.

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

TheLastManStanding posted:

What you should get depends on what you plan to do as a project, but I recommend starting with an Arduino. C is a very simple language and is the easiest language (in my opinion) to learn. The Arduino also benifits from having the most documentation and the largest user base (as far as I know). If you're set on sticking with python and are still new then I'd probably recommend a Raspberry Pi over a BeagleBone; it has a lot less I/O, but it has the same functionality for fraction of the price.

For anyone who hasn't looked into BeagleBone lately, there's a new board out that's not much more pricy than a Raspberry Pi, but has waaay more I/O capability.

Sagebrush
Feb 26, 2012

Also another thing from a couple weeks ago that I don't think has come up in the thread yet. I was working the Arduino booth at Maker Faire, and we were demoing some of the first production models of the Arduino Yun:



What's that? An Arduino with built-in ethernet and a USB-A port? What is underneath that metal shield? What is that U.FL connector for?

Why, it's a full Arduino Leonardo with an Atheros SoC capable of running the sort of Linuxes you'd have on a wifi router. Native Wifi and networking capability, and the two "sides" can speak to and control each other with a couple of libraries. SSH into your board! Trigger shell scripts from your sensors! Talk to your Arduino wirelessly without any bulky shields! Amazing!

There were a lot of people at the show making comparisons to the Raspberry Pi, which isn't quite accurate...the Yun doesn't have a GPU and the SoC isn't as powerful, while the RPi doesn't have built-in wifi or as many GPIO pins, and it uses more power (or so I've heard -- don't think full power specs for the Yun are out yet).

http://blog.arduino.cc/2013/05/18/welcome-arduino-yun-the-first-member-of-a-series-of-wifi-products-combining-arduino-with-linux/

MiNDRiVE
Nov 8, 2012

Sagebrush posted:

Also another thing from a couple weeks ago that I don't think has come up in the thread yet. I was working the Arduino booth at Maker Faire, and we were demoing some of the first production models of the Arduino Yun:



What's that? An Arduino with built-in ethernet and a USB-A port? What is underneath that metal shield? What is that U.FL connector for?

Why, it's a full Arduino Leonardo with an Atheros SoC capable of running the sort of Linuxes you'd have on a wifi router. Native Wifi and networking capability, and the two "sides" can speak to and control each other with a couple of libraries. SSH into your board! Trigger shell scripts from your sensors! Talk to your Arduino wirelessly without any bulky shields! Amazing!

There were a lot of people at the show making comparisons to the Raspberry Pi, which isn't quite accurate...the Yun doesn't have a GPU and the SoC isn't as powerful, while the RPi doesn't have built-in wifi or as many GPIO pins, and it uses more power (or so I've heard -- don't think full power specs for the Yun are out yet).

http://blog.arduino.cc/2013/05/18/welcome-arduino-yun-the-first-member-of-a-series-of-wifi-products-combining-arduino-with-linux/

This could be a fun toy and I will definitely be grabbing one to try it out.

Sagebrush
Feb 26, 2012

I picked up some Teensys and a miniature OLED screen for a project I'm working on. Runs great:

TVarmy
Sep 11, 2011

like food and water, my posting has no intrinsic value

Sagebrush posted:

I picked up some Teensys and a miniature OLED screen for a project I'm working on. Runs great:



:laffo:

Man, I really wish more Arduinos and Arduino clones/accessories would embrace the Teensy form factor. It's so much easier to breadboard with than to have one board to the side with a bunch of jumper wires going to a separate breadboard, just waiting for you to nudge it loose. Protoshields with breadboards don't count, as they are tiny.

echinopsis
Apr 13, 2004

by Fluffdaddy
OK So I'm thinking about hopping on this. I've been wanting to electronic for a while now and I think this might be the ideal way to start.

I'm budget as gently caress so right now I need to know the minimum things I can use

http://www.fasttech.com/products/1001700
I'm going to start with that. I know it's not official but it's cheap as gently caress. I know I can run the blinking LED program off this so strictly this is the absolute limit. Unfortunately I have a higher vision

I suspect I'll need some kind of breadboard? http://www.fasttech.com/products/1144000
Cables like this? http://www.fasttech.com/products/1144702
I was thinking of this as a display: http://www.fasttech.com/products/1187400 probably harder to code than http://www.fasttech.com/products/1005/10002088/1150400-arduino-26-lcd-1602-display-shield-module ? I suspect with the Nokia screen I would need to code the characters specifically?? I Don't really know.


What kind of resistors/etc will I need to do some basic things?


I'm quite excited about this. Also about the low prices I may be able to do this for.
Also quick question... Once you upload your code to the board, if you connected with power supply you can remove the USB and it will just run that code, is that correct?

Bad Munki
Nov 4, 2008

We're all mad here.


Forget the jumper cables, just get some old cat 5 and strip off the sheath. Yeah, they're not the optimal gauge for a breadboard, but they work fine.

Also, did you have some particular project in mind already? I just ask because you're trying to pinch pennies on the arduino and other components (which is fine, nothing wrong there) but you're buying a display right off the bat, which implies you have something in mind.

If you can find one for a price you like, I'd recommend getting a breadboard with vertical rails along each edge. They're incredibly useful as power rails for whatever you're working on.

I'd recommend getting a small smattering of components. Some 100/200/470/47k/100k resistors would be a really basic set but would probably suit you for a lot of tasks. A similar spread with capacitors, just google up a few projects, see what they use, and get a handful of each. Do NOT buy from radioshack. 5 resistors at the shack will cost you the same as 250 from, say, digikey. Also get some LEDs, maybe some pots and buttons and dipswitches, that all depends on what you might be doing. I've started making a habit of any time I need a part, I buy a bunch of them. Need a resistor I don't have? Order a 100-pack. Costs me a few extra bucks, but more and more I'm finding I already have everything I need.

And yeah, once you upload your code to the board, if you provide external power, it'll run just fine on its own. Power can be from a wall wart, from a 9-volt battery plugged into the appropriate pins, whatever.

echinopsis
Apr 13, 2004

by Fluffdaddy

evensevenone posted:

So I've been working on this:

This is awesome! I just get inspiration after inspiration while looking at this stuff. The idea I can run servos off this makes me giddy


Bad Munki posted:

Also, did you have some particular project in mind already? I just ask because you're trying to pinch pennies on the arduino and other components (which is fine, nothing wrong there) but you're buying a display right off the bat, which implies you have something in mind.

Thanks for the tips.. :)


Um, I kinda have things in mind, I want to make a temp/humidity sensor but with the ability to do something with that data. The display is because I want to gently caress around with it basically.. And perhaps read out the data from my temp/humid sensor or something.. And just make stuff for the kids.. IDK really?

Bad Munki
Nov 4, 2008

We're all mad here.


If you keep the arduino hooked up to a computer via USB, you can send any data you collect to the computer via Serial, and then you can do all sorts of crazy stuff beyond just displaying it on a tiny screen. :)

echinopsis
Apr 13, 2004

by Fluffdaddy
Can you essentially run two programs, one on PC and one on arduino easily? I guess it's high time to learn how to make two devices talk to each other!!! I am quite excited about all these prospects

Bad Munki
Nov 4, 2008

We're all mad here.


Yeah, you can have a program on the computer listening/talking to the arduino over that serial port. Case in point: I saw one where a computer was listening to music and doing FFTs and such (much too heavy for an arduino to calculate) and then spitting the results via serial to an arduino, which was in turn using those results to drive a 5 meter ws2801 LED strip with eye candy. :)

For super easiness, check out the Processing environment. There are libraries readily available that will handle the communication between the two, you just spew/read data as needed and then do amazing pretty things in Processing because Processing is the poo poo for low-overhead (and/or one-off) graphics stuff. :)

echinopsis
Apr 13, 2004

by Fluffdaddy
Thanks! I mean most of that stuff is leagues away from where I am but it's good to know what I could do in the future. I think an "easy" yet satisfying project would be a laser module on a couple of servos and control it from the other side of the room. I'm sure my kids would love it and I would be stoked if I got there

Bad Munki
Nov 4, 2008

We're all mad here.


With that in mind, I'd probably skip the little screen if your budget is super tight. There are only a handful of projects I've actually wanted one, and I've generally just found other ways (serial connection, that sort of thing.)

echinopsis
Apr 13, 2004

by Fluffdaddy
it's not really that my budget is tight, it's more that I'm budget. but thanks for your concern :) I just found a joystick module for a few dollars which I am stoked with!

Sagebrush
Feb 26, 2012

If you're just getting started with Arduino, I'd suggest looking at the stuff on Sparkfun and Adafruit to begin. Some of it is a little expensive (Adafruit is cheaper), but there are two big advantages to buying, say, an LCD from Adafruit instead of buying the raw unit online somewhere: (1) it will come with a breakout board that doesn't require any SMD soldering or additional components (diodes, driver chips, resistors, shift registers, etc); and (2) it will have documented examples of Arduino code available, if not an outright code library that is basically plug-and-play.

A lot of people just strip open cat5 cable to make jumper wires but I personally find them a little too small for breadboard work. You don't want a wiggly wire making an intermittent connection because that's a pain in the rear end to track down. Here's a pack of 6 colors of 22ga solid wire; for 16 dollars and a wire stripper you can make like 500 4-inch wires that won't pop out of the breadboard.

(I do use cat5 for general hookups though because it conveniently has eight different colors in one cheap cable)

I agree with Bad Munki that you should get stuff in bulk or at least not from Radio Shack. When I'm just browsing for weird parts online, I generally check Jameco, All Electronics and Electronic Goldmine; if you need something specific, like a certain IC or whatever, Digi-Key or Mouser. I also have a bunch of little Adafruit things because she really makes good stuff.

Bad Munki posted:

Yeah, you can have a program on the computer listening/talking to the arduino over that serial port. Case in point: I saw one where a computer was listening to music and doing FFTs and such (much too heavy for an arduino to calculate) and then spitting the results via serial to an arduino, which was in turn using those results to drive a 5 meter ws2801 LED strip with eye candy. :)

For super easiness, check out the Processing environment. There are libraries readily available that will handle the communication between the two, you just spew/read data as needed and then do amazing pretty things in Processing because Processing is the poo poo for low-overhead (and/or one-off) graphics stuff. :)

Processing is a great environment to learn to code in, especially in parallel with the Arduino. Get a copy of that too. Talking back and forth the computer is trivial.

Also, Arduinos can too do FFTs completely on-board, though you'll be maxing out the chip's capacity: http://www.arduinoos.com/2013/03/plaindsp-part-1/

Bad Munki
Nov 4, 2008

We're all mad here.


Okay, yeah, I guess I said FFTs were too much for an arduino, but it was meant more as "too much for an arduino that wants to do a bit of other interesting stuff as well." ;)

Sagebrush
Feb 26, 2012

You could easily do them on a Mega, though, with lots of room to spare. Or get a DIP m328 for $2.50, burn it with the FFT code and run it alongside your main board as a co-processor ;)

saint gerald
Apr 17, 2003
I broke my leg and need something to entertain me and my son for the next week or two while I heal. Is this a not-too-terrible deal? Prime shipping means I could get it in time for the weekend and it looks like it has lots to keep us busy.

http://www.amazon.com/Arduino-Starter-Official-170-page-Projects/dp/B009UKZV0A/ref=sr_1_4?ie=UTF8&qid=1375287216&sr=8-4&keywords=arduino

Bad Munki
Nov 4, 2008

We're all mad here.


How old is your son?

saint gerald
Apr 17, 2003

Bad Munki posted:

How old is your son?

He's 8. He's pretty good at basic electronics, though.

Bad Munki
Nov 4, 2008

We're all mad here.


Just throwing it out there: http://www.amazon.com/gp/product/B0000683A4/ref=oh_details_o02_s00_i00?ie=UTF8&psc=1

PERFECT for that age, and has tons of fun devices (lights, speakers, motors, switches, a helicopter rotor that launches?!) and such that you won't get out of most arduino kits. Is more rugged than a breadboard with components. Skips the whole overly-tedious-and-complex microcontroller stuff you have to fuss with with an arduino.

The arduino might be more fun for you, granted, but for a father/8-year-old-son combo? My money is hands down on that kit there. I got one for a friend and his boys (right at that age) love it (they are also a very technologically-oriented family), and I know a couple other people have recommended that kit (and its brethren) as well. Heck of a lot cheaper than the arduino kit, to boot!

saint gerald
Apr 17, 2003

You are right on the money. He has a bunch of those (the basic set, the green power one, and the one with the remote-controlled buggy) and loves them. We're looking for the next step up, I guess.

Bad Munki
Nov 4, 2008

We're all mad here.


Haha! Right on.

As for the kit you linked originally, it's hard to say, I don't see a list of actual contents, although the projects sound interesting enough. From the comments, it SHOULD be a <$100 kit, but it sounds like maybe the kits have gone a bit scarce from the $100 providers, so yay price hike. In any event, the comments are generally pretty positive, so that's good. If you aren't too worried about spending $125 on it, I'd say I guess go for it? You could almost certainly get all the same parts for less than that total price, but then you have to figure out what parts/accessories you need, and how to actually use them. To me, there's value in having someone else do that for you in certain situations (such as when working with an 8 year old.) At the very least, you'll have some fun components and an arduino. :)

saint gerald
Apr 17, 2003

Bad Munki posted:

As for the kit you linked originally, it's hard to say, I don't see a list of actual contents, although the projects sound interesting enough. From the comments, it SHOULD be a <$100 kit, but it sounds like maybe the kits have gone a bit scarce from the $100 providers, so yay price hike. In any event, the comments are generally pretty positive, so that's good. If you aren't too worried about spending $125 on it, I'd say I guess go for it? You could almost certainly get all the same parts for less than that total price, but then you have to figure out what parts/accessories you need, and how to actually use them. To me, there's value in having someone else do that for you in certain situations (such as when working with an 8 year old.) At the very least, you'll have some fun components and an arduino. :)

That sounds like a plan. I figured it would be priced a bit over the odds, but it's the next ten days or so I really need to fill, and I don't have time to hunt around for the absolute best deal and deal with multiple vendors, shipping times, out-of-stock stuff, etc. I can live with paying a $30 premium or so for that. Thanks for the help.

saint gerald fucked around with this message at 19:55 on Jul 31, 2013

Bad Munki
Nov 4, 2008

We're all mad here.


Be sure to post a trip report just for informational purposes. :)

JawnV6
Jul 4, 2004

So hot ...
I want to track a car's position with an arduino and an accelerometer. I need resolution down to about a foot, finer is better. I'm not planning on being in any crashes, so anything sampling up to 2g's is more than enough.

Is this doable with arduino's limitations? My main loop would only have one other sensor being polled. I have the arduino and other sensor already, recommendations on the accelorometer would also be appreciated.

Bad Munki
Nov 4, 2008

We're all mad here.


I don't think an accelerometer alone would suffice, or would be horribly inaccurate, and not due to a limitation of the arduino. Throw a gyro in the mix and you'll get better. Combine it with some gps and some sensors at the wheels to detect rpm and you'll have onstar.

JawnV6
Jul 4, 2004

So hot ...
How does a gyro help? I kinda want to bang this together over the weekend, which puts GPS out of my time window.

echinopsis
Apr 13, 2004

by Fluffdaddy
Is it something to do with accumulated errors? My understanding is that to get turning data from an accelerometer is half-assed because it doesn't really supply turning data you just need to derive it somehow.


I am interested in your results though!


http://www.banggood.com/6DOF-MPU-6050-3-Axis-Gyro-With-Accelerometer-Sensor-Module-For-Arduino-p-80862.html I haven't received it yet but I've ordered it. Will it be complete trash? It's more likely than you think

Bad Munki
Nov 4, 2008

We're all mad here.


JawnV6 posted:

How does a gyro help? I kinda want to bang this together over the weekend, which puts GPS out of my time window.

Well, an accelerometer doesn't handle rotation at all, and what if you're accelerating up or down a hill? You need to know the angle of the dangle in order to factor in multiple vectors of acceleration: gravity (which suddenly isn't fixed because your accelerometer can change angle on a hill) vs. your car's engine pushing it forward or back, vs. the acceleration to the side (in the vehicle's reference frame) as you go around a corner. There may be others I'm not thinking of.

The gyro(s) provides you with that extra information which lets you do some (relatively) simple math to get MUCH more accurate positioning. The big addition the wii motion plus added was a set of gyros to alleviate the errors created by relying solely on accelerometers.

JawnV6
Jul 4, 2004

So hot ...
I don't need turning data or anything with y-position. I really just need a linear measure from the last complete stop for this prototype.

edit:

Bad Munki posted:

The gyro(s) provides you with that extra information which lets you do some (relatively) simple math to get MUCH more accurate positioning. The big addition the wii motion plus added was a set of gyros to alleviate the errors created by relying solely on accelerometers.
I'm in a pretty simple problem space. A single dimension's positioning is enough, I'll fix up the rest of it in software. I'm going to try swinging by Radio Shack to see if they've got something, otherwise I'll be getting something overnighted.

JawnV6 fucked around with this message at 21:27 on Aug 1, 2013

Adbot
ADBOT LOVES YOU

Bad Munki
Nov 4, 2008

We're all mad here.


Right, and the way to really do what you seem to want would be a rotary encoder on the wheels.

But assuming that's not an option, you're trying to fake it with an accelerometer, and it's going to be extremely rough (read: probably more wrong than right) in almost every case without additional sensors.

I'm not saying don't give it a shot, but just also expect that the data you get out is going to be pretty whack.

With all that in mind: no, I don't think an arduino will be insufficient for the job. You can build one for like $5, too, so if you want to just give it a shot, your investment will be minimal.

JawnV6 posted:

I'm in a pretty simple problem space. A single dimension's positioning is enough, I'll fix up the rest of it in software. I'm going to try swinging by Radio Shack to see if they've got something, otherwise I'll be getting something overnighted.
Your end result is, yes, but there are multiple vectors of acceleration being applied to that one final resultant vector. And if you don't account for those, it's going to be wrong.

As an example, say you have your one accelerometer aligned with the direction your car travels, front to back. Then you park on a hill. Your accelerometer reads some portion of the gravity vector and shows your car accelerating (albeit slowly) forever. By the time you get up in the morning, your car has slowly crept up to a thousand miles an hour, without going anywhere a tall! That's why you need a gyro, to be able to measure the direction your car is facing and nullify that portion of the gravity vector. Same thing happens when you go around a corner.

Bad Munki fucked around with this message at 21:31 on Aug 1, 2013

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