Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Programming Questions / Re: Concatenate Float w/ a String on: February 13, 2013, 10:11:17 pm
I swapped to a Mega last month. Checking that box is fine by me.

I'd like to point out here that both serial land sdfat have .print and support floats. My original solution was to just use those to do what i wanted.
17  Using Arduino / Networking, Protocols, and Devices / Re: Arduino for AT commands on: January 30, 2013, 08:31:43 pm
Hooray for a fellow AT command guy.

I absolutely hate the OK responses and waiting for them but sure this is possible.

I have had mixed success using string.trim() to remove the control characters. Most of the time im actually using substrings to find parameters within a response.

Something that might help us a bit more is the overall end goal of your sketch. I see that you are having trouble waiting for OKs to appear which is a constant problem you will face and as such the end goal might help us to provide something that will work later down the line when you are sending any number of commands.

If you search for waitFor and SM5100B you will find numerous implementations of a function that should allow for a better implementation.

18  Using Arduino / Project Guidance / Re: GPS shield connected to Arduino UNO on: January 22, 2013, 11:04:30 am
Can you upload other example sketches to the arduino without problems? try the blink example sketch.

I usually get the error you are getting when i'm trying to upload my code through something that is not an arduino.
19  Using Arduino / Project Guidance / Re: Detecting an Individual Entering and Existing a Room on: January 20, 2013, 07:10:07 pm
Quote
colleague and trigger a sound upon him entering his office,

Who else would enter his office whilst the electronics are setup?
20  Using Arduino / Project Guidance / Re: Detecting an Individual Entering and Existing a Room on: January 20, 2013, 06:44:49 pm
Wow, tad rude there smiley-sad.

Any number of sensors can be used to do this. Here are some ideas that should prompt some searching.

Detect when the door is open. Burgalar alarms use these magnetic reed switches to do this.
Detect proximity to an area. some sort of distance sensor.

Pads on the floor. (this can literally be as simple as two bits of tinfoil that connect when they are pushed together.
21  Using Arduino / Project Guidance / Re: Where to go from here :S on: January 20, 2013, 06:41:18 pm
If you look at my code i use F extensively. Strings are not the problem and they are usually removed from my code.
22  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Mega and Slave Select Quick Question :D? on: January 19, 2013, 01:02:41 pm
Oh wow that looks like it'll work i'll find a uk supplies and get on it.

Looks like i'll need a spool of wire too smiley-grin.
23  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Mega and Slave Select Quick Question :D? on: January 19, 2013, 12:53:04 pm
Fantastic for the support. Using a protoboard might be tricky though especially for the top row of digital pins :'(. I'll see if an autotracer for a PCB can handle the crazyness that is that row D:
24  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Mega and Slave Select Quick Question :D? on: January 19, 2013, 12:40:07 pm
That's a shame, I'm wondering if an adapter style shield would be possible? Similar to the go between sheild but more hard traced. It would move the SPI traces back to their original position along with perhaps the ic2 pins and perhaps bring one of the hardware UARTS to pins 2 and 3 seeing as every shield and their dog use them as a software serial(GPS,Cellular etc). I could even then shift the digital pins that are now present in the old SPI places over to the new SPI places so they are not lost.

What do you think?
25  Using Arduino / Project Guidance / Re: Where to go from here :S on: January 19, 2013, 12:35:18 pm
I've done some further maths with memory usage but I don't see how it helps my problem. As shown in my previous post without even initialising any classes i only have 350 left for initializing them if i were to use an UNO

I've got a CAN Bus to implement and a lot of logic to get cellular stuff working. Added to that i'm also using tinygps' float functions which is all adding up to far too much memory for the UNO. Hence the purchase of a mega. I cant squish down tinygps because its tiny. I trust the sdfatlib devs have squashed that as tight as possible too and as said before I cannot reduce the memory of advanced mathematics I do not understand.

Can we shift talk to solutions in enabling UNO shields to be compatible with a mega's slightly altered pin layout?
26  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Mega and Slave Select Quick Question :D? on: January 19, 2013, 12:26:59 pm
Fantastic, Does anyone know the logic as to why the SPI pins were moved in the mega.

I'm guessing it was the layout of the pins on the actual microcontroller combined with its size that made it hard to get them back to their old places ?

The statement on its product page about most UNO shields being compatible was misleading :'(
27  Using Arduino / Project Guidance / Re: Where to go from here :S on: January 18, 2013, 11:30:22 pm
Many thanks peter, You convinced me to look at my code again and I found a memory leak and fixed it although by my maths i think there still some stuff floating around.

I've rectified my code to include some ram usage output:
Code:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <SdFat.h>
#include <GPSFilter.h>

int freeRam();
void setup()
{
  Serial.begin(115200);
  Serial.println("Initial RAM");
  Serial.println(freeRam());
  TinyGPS gps;
  Serial.println(F("RAM After tinygps"));
  Serial.println(freeRam());
  SdFat sd;
  Serial.println(F("RAM after sdfat"));
  Serial.println(freeRam());
  SdFile sdout;
  Serial.println(F("RAM after SDFILE"));
  Serial.println(freeRam());
  GPSFilter f(1);
  Serial.println(F("RAM After GPS Filter"));
  Serial.println(freeRam());
}
void loop(){
 
}
int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

I ran this on my mega just to give a full output:
Code:
Initial RAM
6350
RAM After tinygps
6350
RAM after sdfat
6350
RAM after SDFILE
6350
RAM After GPS Filter
5590

Now for some maths, 8KB of SRAM on a mega so after file inclusion i have 6350 left, so 1650 used for library inclusion and 350 remaining SRAM if i use an UNO.

Now Your going to tell me my filter is huge smiley-sad and understand this however i'd really rather not part with it. It works nicely.
28  Using Arduino / Networking, Protocols, and Devices / Arduino Mega and Slave Select Quick Question :D? on: January 18, 2013, 08:20:09 pm
Hello,

Can any of the digital pins on the Mega be used for Slave Select. i see 53 listed on the page.

Im coming from an UNO background where i've used 8,9 and 10 as SS and would like to keep it that way but just wanted to check that there were no restrictions when hoping over to a mega.

The only reason I ask is i've had to relocate the other SPI pins MOSI etc over to the 5x mega equivelants. smiley-sad

29  Using Arduino / Project Guidance / Re: Where to go from here :S on: January 18, 2013, 05:45:17 pm
Im not entirely sure you read my post sorry if that sounds rude.

I have shields for the UNO that use specific pins i now have a mega and no additional components. They do not go anywhere near the other hardware serial ports. I would use them if i could. This would require purchasing boards that do not exist or making my own with all my components on it which is something I am not ready to do.
30  Using Arduino / Project Guidance / Where to go from here :S on: January 18, 2013, 05:35:00 pm
I've come to a huge dilemma with my project which is causing a lot of problems.

This is purely theoretical so little code is going to be provided.

I started the project with an UNO R3 and got together a few shields.

GPS Shield from sparkfun uses pin 2 and 3 for a software serial connection
Cellular Shield from sparkfun uses pin 2 and 3 I can easily distinguish between both of them in the code do not worry
CAN Bus shield from sparkfun which eats most of the pins on the digital side of the UNO including pins 2 and 3

At this point i grabbed a go between shield to shift pins 2 and 3 ABOVE the go between to pins 4 and 5 which CAN bus does not touch. All good.

Now im running out of SRAM due to the libraries im using:
sdfatlib(The more up to date one than the one in standard distribution)
tinygps
A slightly modified gps kalman filter i edited(https://github.com/rfox90/ikalman)

I have proved the SRAM issue using this:
Code:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <SdFat.h>
#include <GPSFilter.h>


void setup()
{
  Serial.begin(115200);
  Serial.println(F("Blah"));
  TinyGPS gps;
  Serial.println(F("Blah2"));
  SdFat sd;
  Serial.println(F("Blah3"));
  SdFile sdout;
  Serial.println(F("Blah4"));
  GPSFilter f(1);
  Serial.println(F("Blah5"));
}
void loop(){
}
It never prints Blah5 and just hangs.

So like an idiot i went and bought a mega because it has more SRAM. The above code works there and as does the filter.Now here comes my problems:
  • Software serial does not work on pins 2 and 3 or 4 and 5 (http://arduino.cc/en/Reference/SoftwareSerial)
  • SPI pins have moved(Why the hell did they get moved?) I fixed this using sdfatlibs software spi but really hate doing so :'(
So now im staring at pin layouts and shields lieing on my desk wondering what exactly to do.

I haven't noticed any speed problems with software spi im only really doing .5sec line writes to one open file during the sketch though.

So mostly its the software serial issue.

For some fast reference the product pages are below:
https://www.sparkfun.com/products/10039 - CAN Bus
https://www.sparkfun.com/products/10710 - GPS
https://www.sparkfun.com/products/9607 - Cellular

The only thing i can think of is designing a shield that essentially swaps around the pins a bit similar to the go between but hard traced as a go between for the mega would be huge.

Obviously the end goal with any project is to get it all down to one board so I'm not sure i want to redesign all my shields onto one board at this stage either.

What do you think ?

Also where would be the best place to suggest the addition of a cautionary note on the mega's page about the SPI relocation?
Pages: 1 [2] 3 4