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
mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
You can power it elsewhere, but the grounds of the sensor and Arduino need to be tied together. This is so everything is at the same common ground and a 5V difference at the sensor is the same as a 5V difference at the Arduino. There are apparently some pitfalls and issues with grounding a lot of different things, but in general for a couple sensors it shouldn't be a big deal to run the sensor ground to the Arduino ground. You'll also need those sensor grounds attached to the ground of their power supply/battery.

Adbot
ADBOT LOVES YOU

Bad Munki
Nov 4, 2008

We're all mad here.


Bad Munki posted:

What the everliving hell. I am absolutely stumped by this.

:words:
teensy 3.0 keypad problem that works fine on arduino, seems to freak out on String += String operation
:words:

So, uhh...I was falling asleep at my computer and was sorta blindly mashing at google and I think I found the answer to my problem with the teensy 3.0 and the keypad that was freaking out. Turns out it's a problem with the Keypad library. I found this post:

http://forum.pjrc.com/threads/19003-Teensy-3-0-and-Keypad-arduino-app?highlight=keypad+library

quote:

So i've got it to act properly:

code:
bitWrite(bitMap[r], c, !pin_read(rowPins[r]));
// changed to 
bitWrite(bitMap[r], c, !digitalRead(rowPins[r]) );
so pin_read was mapped like this in Keypad.h
code:
virtual int  pin_read(byte pinNum) { return digitalRead(pinNum); }
so is there a reason why pin_read() didn't work even though it just forwarded the call to digitalRead?

I opened up Keypad.cpp and changed that function call (line 89) and while I don't have the actual installation here to test with, I can jump the row/column wires to simulate key presses and watch the output on the serial monitor, and it seems to work fantastically now. That's a pretty annoying bug, and like the poster who suggested the fix, I don't know why it would behave that way, since pin_read is just a virtual for digitalRead.

At least it appears to be working now, though. I can hardly wait to get down there this weekend and re-install it so I can get my uno back once and for all (I prefer the teensy, but I need to use the uno as a programmer for an attiny, since the teensy was having trouble interfacing properly.)

jovial_cynic
Aug 19, 2005

I'm playing around with some TFT LCD animations with the Uno, both with drawings on the LCD, and with bitmaps loaded from an SD card.

The basic animation I am working on is a simple 30x30 pixel square scrolling across the screen. With the rectangle - drawing functions, the animation is fairly smooth. However, trying to move a similarly sized bitmap isn't as smooth.

I think the problem is that my code calls the bitmap from the SD card every time. That seems slow. Is there a way to save the bitmap into an object in the arduino code and manipulate its position that way? Would that work faster?

jovial_cynic
Aug 19, 2005

Well, I never got my question answered, but I worked around it anyway.

Also, I made a neat thing here:

https://www.youtube.com/watch?v=Mw6Cf_TSfcA

It's a custom multi-gauge indicator system for my car. I'm quite in love with it.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass

jovial_cynic posted:

Well, I never got my question answered, but I worked around it anyway.

Also, I made a neat thing here:

https://www.youtube.com/watch?v=Mw6Cf_TSfcA

It's a custom multi-gauge indicator system for my car. I'm quite in love with it.

Nice! Are you going to hook it up to the CAN bus and read the car's sensors?

I've been thinking of building a little guage box to display some stats from an IMU, like angle, horizon level, altitude, direction, etc. Would be handy to have in my Jeep for off road driving so I know if I'm at a weird angle or heading in the wrong direction.

jovial_cynic
Aug 19, 2005

mod sassinator posted:

Nice! Are you going to hook it up to the CAN bus and read the car's sensors?

I've been thinking of building a little guage box to display some stats from an IMU, like angle, horizon level, altitude, direction, etc. Would be handy to have in my Jeep for off road driving so I know if I'm at a weird angle or heading in the wrong direction.

I do want to read all the sensors in my car... I think there's only 7 or 8 of them, so that does put me above what the UNO will handle on its own. I'm trying to decide if I want to run two of these systems in my car: one for the signals I NEED to see (temp, fuel/oil pressure), and another one for things that are fun to micromanage, but not as interesting. Throttle position sensor, for example. Or... if I want to upgrade to the MEGA or something like that and maintain a single system for everything.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
So glad the forums are back. I've had a question that's been nagging me.

I've been playing with an Arduino Uno and an LCD screen, working on a little basic program that fades LEDs in a pattern and runs an animation on the screen related to the LED fade variables.

So, to put it short, in my code, I declare something like this:

code:
int a; //fade value 0-255 for led 1
int b; //fade value 0-255 for led 2
int x;
int y;

loop:
if mode 1
set variables;
run fade subroutine()
run animation subroutine()

if mode 2
set variables;
run fade subroutine()
run animation subroutine()

end loop

fade subroutine
calculate fade based on time, reverse direction when peaked, write to pins

animation subroutine
x = map a to smaller values
y = map b to smaller values
map x and y values to bar graphs on screen
Anyways, in trying to strip down my code and make it more efficient, I tried changing my variable declarations, changing the ints above into bytes, since I only used values between 0-255 anyways. However, when I did this, my screen animation would stop. The bars would animate like they knew a recent value, and then would stop. If I flipped it between modes, the values would sometimes shift again, as if the variable updated and the animation subroutine had just now found the information, and then again, it would stop.

It's not a big problem, I still have plenty of space for the program. My first few micro controller programming experiences were with a Basic Stamp though, and from there I learned to make my variables as small as possible. I'm new to using subroutines though, and I'd like to know exactly what the issue was for future programs.

Sagebrush
Feb 26, 2012

It's really hard to say without the actual code, especially if something like variable typing is causing the problem. Those things don't come across in pseudocode.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
I was really hoping not to have to post my awful code. But here it is:
http://pastebin.com/06nCp56p

JawnV6
Jul 4, 2004

So hot ...

Fanged Lawn Wormy posted:

loop:
if mode 1
set variables;
run fade subroutine()
run animation subroutine()

if mode 2
set variables;
run fade subroutine()
run animation subroutine()

end loop
Those are "ifs" in your pseudocode, but while's in the pastebin? Matches your description of "runs RunLights(); RunAnimation2(); once on a mode switch" if you're getting stuck in the while() instead of falling out into the bigger loop.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
Ah yeah, I had gone back and forth on that a couple times when I was first writing the code, because I was having trouble with the Arduino recognizing my mode switch pins. Turned out I was dumb and had floating pins, switching to the pull-up input mode really helped.

It isn't getting stuck in either mode, but I'm wondering if IF statements will allow variables to get out to the global loop for updates...

JawnV6
Jul 4, 2004

So hot ...
You're asking if something like
code:
int variable = 0;
void loop() {
  if(digitalRead(Mode1)==LOW) {
    variable = 6;
  }
  RunLights()
}
RunLights will see 'variable' as 6. Is that what you mean by "get out"?

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
No, not exactly.

My variables "ear1brightness" and "ear2brightness" are globally declared ints. When I do this, the led's change brightness fine, and their brightness is mapped to a bargraph on the LCD fine as well.

if I make those two variables bytes (they are only ever 0-255 anyways) then the bar graph drawing routine acts like the variable isn't updating, although the LEDs still change brightness. I'm wondering why changing the type of variable matters, since all the math should still be fine. It's like, what I'm seeing is that the math functions of RunLights() still run, but for some reason, the Animation routine doesn't register that the variable changes.

Dynamite Dog
Dec 12, 2012

Just glancing at it the problem is probably in your map or analogWrite call with the ear brightness variables. If you stick a serial print in you can see if the math is working and the value is changing correctly. If the math is working and your value is progressing but not being written I'd try casting it as an int when you call map and analogWrite and just see if that works.

TheLastManStanding
Jan 14, 2008
Mash Buttons!

Fanged Lawn Wormy posted:

Anyways, in trying to strip down my code and make it more efficient.
If you're looking for efficiency, you can start by getting rid of those 3 extra digital reads at the start of your loop and switch all the other ones to PINB. Digital read is hilariously slow and is typically the line that is slowing people's code down the most.

Also, you shouldn't be using pin 13 as an input; it's attached to the onboard led and won't read correctly without an external resistor.

edit: You might also want to switch the layout to the below: That way you aren't checking an extra if statement every loop and it gets rid of 2 variables. It also doesn't waste a bunch of time constantly printing.
code:
  if(digitalRead(Mode2) == LOW)
  {
    Serial.println("Low Speed");
    Initializer();
    Animation1Setup();
    relayInterval = 1000;
    fade = 5;
    ear1brightness = 0;  
    ear2brightness = 255;
    while(digitalRead(Mode2) == LOW) //except change this to the appropriate PINB
    {
      RunLights();
      RunAnimation1();
    }    
  }

TheLastManStanding fucked around with this message at 04:17 on Jun 27, 2014

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
thanks for the insights.

I just had thought: perhaps the problem with the screen mapping is that the lcd's library expects ints for variables... I'll do some debugging later, take a closer look.


TheLastManStanding posted:

If you're looking for efficiency, you can start by getting rid of those 3 extra digital reads at the start of your loop and switch all the other ones to PINB. Digital read is hilariously slow and is typically the line that is slowing people's code down the most.

Also, you shouldn't be using pin 13 as an input; it's attached to the onboard led and won't read correctly without an external resistor.

Also, I didn't know about PINB. I understand the 'setup' part, but I'm not sure if I understand what you mean about "switching all the other ones". And it comes down to something I've never really looked too far in to... do I need to tell the Arduino digitalread() to check the pin status, or can I just write if(input == high) etc?

oh yeah, and thanks for noting that about the LED pin... I as planning on moving it, it found it's way over there when I was doing some loving around with pins and never went back to its home.

Fanged Lawn Wormy fucked around with this message at 04:23 on Jun 27, 2014

TheLastManStanding
Jan 14, 2008
Mash Buttons!
Where you define your constants you would instead write them as:
code:
#define Mode1 (1 << 0)  //Pin 8
#define Mode2 (1 << 4)  //Pin 12
#define Mode3 (1 << 5)  //Pin 13
No semicolons after each line.

Then instead of digital write you use:
code:
if( (PINB & Mode1) == 0 ){}
At least I think that works. That's mostly from memory. Check the pins to make sure they match whatever version arduino you're using. Reading the pins directly is not only much faster, but it also allows you to read multiple pins simultaneously and the states can be held in a single variable, which lets you do some pretty cool stuff.

edit: Remembered that you're running the loop when the pin is low, so you need finagle the bit math to work out that way.

TheLastManStanding fucked around with this message at 06:19 on Jun 27, 2014

Sagebrush
Feb 26, 2012

What does digitalRead() do, exactly, that makes it so slow?

Kasan
Dec 24, 2006

Sagebrush posted:

What does digitalRead() do, exactly, that makes it so slow?

Yeah, this. I've never experienced slow code or processing using digitalRead() (or even analogRead())

TheLastManStanding
Jan 14, 2008
Mash Buttons!
The command is multiple lines of code since it has to map a variable to 3 different ports. If you aren't sending a variable to the command then you can just access the port directly instead and you cut out a bunch of lines of code. It doesn't come up much, but if you're doing something that requires writing/reading extremely quickly (such as for an encoder or led display) it starts to matter. There's quite a few pages which talk about it (Such as this one) and libraries (digitalWriteFast) which offer a quicker read/write functions.

As an example of when it's useful, one of his lines of code is:
code:
 digitalWrite(relay, HIGH);
 digitalWrite(ear1, HIGH);
 digitalWrite(ear2, HIGH);
 delay(200);
 digitalWrite(relay, LOW);
 digitalWrite(ear1, LOW);
 digitalWrite(ear2, LOW);
which can be rewritten as:
code:
 PORTD |= B00001110;
 delay(200);
 PORTD ^= B00001110;
In this case speed doesn't matter, but you still benefit as the pins will be set simultaneously, you're using half as many lines of visible code, and substantially less lines of actual code.

TheLastManStanding fucked around with this message at 06:45 on Jun 27, 2014

Economic Sinkhole
Mar 14, 2002
Pillbug
I've got a problem to tackle and I'm not sure if an Arduino is the answer, but I'm hoping for some help. My neighbor has a dog that barks a lot. They leave it outside pretty much all the time and it barks at any sound in the neighborhood at all times of day. I bought this dog bark deterrent and it has done nothing to stop the barking. I suspect because it can't get loud enough but that isn't what I'm trying to do.

I'd like to modify the bark detector to count barks and record the time and date. The detector does trigger when the dog barks, so I think it should be easy to hook in to the LED that goes red or the speaker circuit that emits the deterrent sound. I've never messed with an Arduino and have limited electronics experience, but I think I can make this work with this thread's advice.

I do have a Raspberry Pi, which I think I will need as well, to actually record the bark times. I don't really know where I should start though. How would you go about accomplishing this?

Kasan
Dec 24, 2006
You'd be better off using just the pi since your taking about needing to do some FFTs to compare a real bark to a false positive (like a car backfire or horn).

Alternatively file noise complaints every other day until the owners bring the dog in at night or are forced to give it away. (Or you know. Speak to the neighbors first)

Economic Sinkhole
Mar 14, 2002
Pillbug
Thanks. The deterrent device already filters for dog barks to trigger on, so that's why I want to use it as the switch to count against. Not knowing anything about how to do it, what I imagine doing is tapping into the LED that turns red when the deterrent triggers, then somehow noting the time and date when it happens.

I want to rig this up at least partially so I can see just how much barking is going on and decide if I'm just being overly sensitive or if it really is barking too much. If it really is barking too much, I'd like to be able to go over there and tell them "Your dog barked 568 times yesterday, 230 times after 9pm". Then I could send it to the county or whatever if the don't do anything about it (they won't).

Edit: Or, if it barked like 30 times, then I would know I just need to relax a little.

Economic Sinkhole fucked around with this message at 22:31 on Jun 30, 2014

evilweasel
Aug 24, 2002

Tape a light sensor to the LED with black tape so that only light from the LED can hit the light sensor.

TheLastManStanding
Jan 14, 2008
Mash Buttons!
I'd go with the arduino since it's smaller, cheaper, and much easier to program. You can get a real time clock module, microSD card board, and an optoisolator from sparkfun for around $25 total. They give you example arduino code so it shouldn't be hard to rework it to fit your need.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
I would put a multimeter positive lead on one leg of the LED and the ground lead on the ground of the device's battery. When the bark LED lights up check what voltage is being output by the LED. If it's anything in the range of 2.5-5 volts it should be fine for reading with an Arduino. You could use a Pi too, but be careful that the voltage doesn't go above 3.3 volts when the LED is lit (the Pi can't read a 5 volt signal directly). If the voltage does go to 5 volts you can put a couple resistors in as a voltage divider to knock it down from 5 to 3.3 volts (use large resistors like 10kohm+ so the current draw is small).

Once you have a signal you can read with your board, just run a wire from the LED leg to a digital input on your Arduino/Pi. Read that input state using the digitalRead function to check if it's high (LED is lit) or low (LED is not lit). Make sure to also run a wire from the battery ground to the Arduino/Pi ground so they're both at the same potential.

If you're using an Arduino you could actually power it from the 9V battery of the dog bark detector, but without adding some logic to sleep the Arduino you'll go through the battery in a couple hours. Better to just plug the Arduino into a power outlet if you can.

One thing to be careful of in general though, don't go poking around and measuring voltages if the device has an AC power cord going straight into it. From the Amazon description it sounds like it's powered by a 9 volt battery so you should be fine. However if it's something like a kitchen appliance, etc. that is powered off AC you could probe a line at 120 volts and hurt yourself. I've wanted to tap into my rice cooker by checking when its cook light isn't lit, but that light is actually a small neon bulb that runs at the full 120 volts so it's way too high to mess with directly (using a light sensor taped to the bulb is what I ended up doing).

Sagebrush
Feb 26, 2012

If you just want to record the number of times the dog barked and grab the data once a day or something, so you can say "your dog barked 800 times yesterday" or whatever, all you need is the Arduino. Just increment the EEPROM every time the LED goes on, which you could measure directly if its voltage supply is between maybe 3.5 and 5.5 volts, or if not you could easily do it with an analog read of the pin voltage or a properly calibrated LDR stuck on the LED and wrapped in black electrical tape. You would plug in through USB and download the EEPROM value and reset it at whatever interval you like.

If you wanted to record the exact date and time to make a cool graph to show to the cops, you would need to hook up a clock module. The Arduino's crystal isn't accurate enough to keep time over more than a few hours. Then, since you're storing much more data than just an incrementing counter, you would also need an SD card shield/module of some kind. A little more complex for sure but not out of the question.

If you wanted to be a super cool hacker, I'd say get an ATTiny, wire it into the dog bark detector's 9v power supply with an appropriate divider, patch an ADC pin into the LED's positive leg to read it directly and store in EEPROM, and then wire in a button that you can press to have the ATTiny blink out a count of the last 24 hours' worth of dog barks in binary or morse code or something by hijacking the same LED you're reading. Hold the button down to reset for a new day. Total cost about $1.50 for the Tiny85 and some resistors and solder.

Delta-Wye
Sep 29, 2005
Can you connect the arduino via USB while it's running close to the dog bark detector? Being able to just stream serial data to your PC in real time makes it stupid easy to record timestamps for barks.

sharkytm
Oct 9, 2003

Ba

By

Sharkytm doot doo do doot do doo


Fallen Rib

Delta-Wye posted:

Can you connect the arduino via USB while it's running close to the dog bark detector? Being able to just stream serial data to your PC in real time makes it stupid easy to record timestamps for barks.

WiFi!
You could even set it up to send a tweet every time the dog barks. #MyAnnoyoingNeighborsDogBarksALot is probably available... That would time/date stamp it too.

Amberskin
Dec 22, 2013

We come in peace! Legit!

sharkytm posted:

WiFi!
You could even set it up to send a tweet every time the dog barks. #MyAnnoyoingNeighborsDogBarksALot is probably available... That would time/date stamp it too.

I was about to suggest to fire up an UDP packet using an ethernet or wifi shield, and setting up a listener in one of your home computers, but this tweet idea obviously overrides mine :getin:

Plasmafountain
Jun 17, 2008

1QyZckj6w6gDCLj9H6z3
JZnnjXk8cqKZUt2Dz0WE
dccolIhfcWV42sTxVpOq
LqsEo3y6gyfq6JFlTfrc
nSLaal6DbF574QpkT1z3
BokI1oAkneqoJCYgo8nM
BLF2qeMr6D9U8aNYjPhc
BEgh1iGlE7T4GqnVqC1p
zz4e7RQtcZvUCCUJ9LIR
wCcx4cDqcESJdmCIKSbm

Plasmafountain fucked around with this message at 21:24 on Feb 28, 2023

Economic Sinkhole
Mar 14, 2002
Pillbug

Delta-Wye posted:

Can you connect the arduino via USB while it's running close to the dog bark detector? Being able to just stream serial data to your PC in real time makes it stupid easy to record timestamps for barks.

I could put the Pi out there. The detector hangs in a tree about 20 feet from the house.

Zero Gravitas posted:

Delta's idea is the simplest and easiest. You would only need an arduino, a usb cable, a couple of soldered connections and a serial monitor recording program like Coolterm to record when the LED on your monitor goes high.


I think this is the way for me to go. Hopefully I can get the Pi to monitor the arduino and record the barks that way. Then I can tweet, record, fire flare gun or whatever with the Pi.

JawnV6
Jul 4, 2004

So hot ...
How are you collecting the IMU data?

Seems like you could get away with using the USB as OTG and have the phone take the accel data instead of the other way around.

plasticbugs
Dec 13, 2006

Special Batman and Robin
I just got my first Arduino and I'm already completely stumped. I have an Arduino Yun and I want to hit a web resource and pull down a JSON feed to parse and then have some lights blink based on the data in the feed.

I see that when I run a Process like "curl", the response is a stream of data. I know I can stream that data into the console via one of the IDE's built in examples. But I can't figure out how to get that stream into an object like a string or a dictionary that I can manipulate.

If I try to save the stream to a string by appending each character, the output is truncated, which makes me think I might be hitting a memory limit. The file I'm grabbing is only about 3k.

Here's the code from the "Process" example which shows how to run processes on the Linux side and stream the result back into your Sketch. This example only streams the output to the console:

code:
//This streams the entire file to the console.
  Process p;
  
  p.begin("curl");
  p.addParameter("http://gdata.youtube.com/feeds/api/users/myYouTubePage?v=2&alt=json");
  p.run();

  while (p.available()) {
    char c = p.read();
    Serial.print(c)
  }
I want to save that stream. The following doesn't work at all.
I'm assuming because the stream is asynchronous and the call to print returns instantly:
code:
//This doesn't work, though the docs say that
//stream.readString() returns a string from an input stream.

String json_file;

Process p;
  
  p.begin("curl");
  p.addParameter("http://gdata.youtube.com/feeds/api/users/myYouTubePage?v=2&alt=json");
  p.run();

  while (p.available()) {
  json_file = p.readString();
}

Serial.print(json_file);
code:
// This truncates the data

  while (p.available()) {
  char c = p.read();
  json_data += c;
  }
  
  Serial.print(json_data);
I got the Yun because I thought I could offload some of the work (like curl, JSON parsing, etc.) onto the mini-Linux inside the Yun - and to some extent I can. I like the Yun, but at this point I feel like I would have been better served with a Raspberry Pi - mainly because I feel out of my element relying on Processing. Am I allowed to say that I hate Processing so far?

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
The code in your Arduino sketch is going to run on the ATmega32u4 processor which is the tiny 8 bit microcontroller. Unfortunately there's only 2k of memory, so trying to save a 3k stream of data won't work and is likely why you see it getting cut off.

What you probably want to do is run stuff like python scripts on the Linux processor. Have you connected to the Yun using SSH and played around in its Linux environment yet? If not ssh into it and start poking around Linux. You can write a python script that does all the heavy lifting of talking to web services, interpreting results, etc. Your Arduino sketch can use the process class to call python and pass the path to your script as the first argument so the script will be run. Anything your script prints out can be read by the sketch just like you're reading the output of curl.

There is some learning curve and not as many tutorials/guides for the Yun unfortunately. A Pi isn't a bad place to start, although you'll still probably want to program the Pi with Python or a similar higher level language. The nice thing with the Pi is that there's no weird split between two processors, however there are also some downsides like no analog inputs or realtime control capabilities on the Pi.

plasticbugs
Dec 13, 2006

Special Batman and Robin

mod sassinator posted:

The code in your Arduino sketch is going to run on the ATmega32u4 processor which is the tiny 8 bit microcontroller. Unfortunately there's only 2k of memory, so trying to save a 3k stream of data won't work and is likely why you see it getting cut off.

What you probably want to do is run stuff like python scripts on the Linux processor. Have you connected to the Yun using SSH and played around in its Linux environment yet? If not ssh into it and start poking around Linux. You can write a python script that does all the heavy lifting of talking to web services, interpreting results, etc. Your Arduino sketch can use the process class to call python and pass the path to your script as the first argument so the script will be run. Anything your script prints out can be read by the sketch just like you're reading the output of curl.

There is some learning curve and not as many tutorials/guides for the Yun unfortunately. A Pi isn't a bad place to start, although you'll still probably want to program the Pi with Python or a similar higher level language. The nice thing with the Pi is that there's no weird split between two processors, however there are also some downsides like no analog inputs or realtime control capabilities on the Pi.

Thanks for the help. I didn't realize how little memory was available on the non-linux side.

I have definitely been poking around. I ssh'd in and have installed a bunch of Ruby packages. The Yun can execute basic Ruby scripts and I've figured out how to pass stuff between Sketches and my Ruby scripts. But anything not in the Ruby core library throws an error. So things like parsing JSON or doing fancy stuff with URIs in Ruby is not going to happen. I was attempting to pick up that slack with Ruby, but my hands are definitely tied without use of the Ruby standard library and Ruby gems. I know Ruby really well, but no Python. Looks like I have to learn some Python! No time like the present. :/

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
I would check the Arduino Yun forums here to see what folks say about Ruby: http://forum.arduino.cc/index.php?board=93.0 You might be able to find a package that's been compiled and adds the libraries you need.

I would also look at expanding the Yun's filesystem to use the full SD card so you can install a lot of stuff in the root filesystem: http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace

plasticbugs
Dec 13, 2006

Special Batman and Robin

mod sassinator posted:

I would check the Arduino Yun forums here to see what folks say about Ruby: http://forum.arduino.cc/index.php?board=93.0 You might be able to find a package that's been compiled and adds the libraries you need.

I would also look at expanding the Yun's filesystem to use the full SD card so you can install a lot of stuff in the root filesystem: http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace

I'll definitely do that. I need to get a micro sd card this week. Thanks for the link and all the help!

After banging my head for hours and having the Arduino refuse to load any of Ruby's standard libraries, I decided a sanity check was in order.

I factory resetted my Arduino Yun and methodically reinstalled all the Ruby packages on the OpenWRT side that were available using the package manager. After that, I was finally able to get a few things working properly - most importantly Ruby's net/http library. So I can finally make http requests on the Ruby side!

I guess I'm putting off learning Python for at least another day. I'll check in with a progress update later this week.

Thanks again!

EDIT: Holy poo poo, Ruby gems seems to be working now too. This thing is going to be a lot of fun.

plasticbugs fucked around with this message at 08:25 on Jul 2, 2014

Plasmafountain
Jun 17, 2008

DRQM4YzwLA2hfjXwM4sS
nWNmVgmYHIGOIFwr5AuU
eDoJt7mYVyaNjAY8pXIo
LlyF1BUsQLRqtxRdoKs2
q7rGYththE7WrHimkbyW
s7hBDNGJmCq4HvPMgInI
LYJv7f8aXudQxVJXFmPH
XbfdBa4EUjLkxaSZgXzH
jyEEkTs0gFsdxRRjXtyu
ZBCCg3d1XSn1ot41nkvq

Plasmafountain fucked around with this message at 21:24 on Feb 28, 2023

Adbot
ADBOT LOVES YOU

JawnV6
Jul 4, 2004

So hot ...

Sorry. IMU = Inertial Measurement Unit, a 6dof accel/gyro sensor is the foundation for a real IMU. OTG = On The Go, an extension to the USB spec that allows peripheral devices to act as a host to a limited set of other peripherals.

So my question was, how are you currently collecting the acceleration & gyroscope data? I'm imagining it's onto a PC over a serial connection. You were asking "how do I get GPS off of the phone?" and I'm supposing it's a bit of XYing with that line of thinking. You don't need the GPS data off the phone so much as you need the GPS and accel/gyro data together.

With OTG, you could use the Arduino as a peripheral to your phone, get the accel/gyro data into the phone and do your correction/drift measurement there. That might be a bit of a stretch depending on your experience in other areas, but I wired up an Android handset to an Arduino as a proof of concept for a client. I think this is the guide I used.

e: mixed up android/arduino, i didn't wire two androids together :v:

JawnV6 fucked around with this message at 22:02 on Jul 2, 2014

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