Reduce freeIMU arduino sketch size...?

Asked by rogerlette

Hi Fabio,

First, thanks a lot for this nice freeIMU v0.3.5 board.

I'm playing with it since few days and it's works really well with the processing cube sample you provide. But for my project, I need to read some value and make calculation in the arduino board .
So as written in the title, I need to save some space in the freeIMU code wich is very heavy compare to the size of arduino memory.

I really dont now what I can do to make the code more light ? :
I dont need the barometer, which part of the code could I remove ?
I dont need so much precision (float) for the other sensors (accelerometer&gyro) is there a way to decrease a bit the precision in order to reduce the size ?

Thank you by advance for your help,

Rogerlette

PS (not important if you dont have time) : I cant make work the freeIMU_raw.pde and freeIMU_yaw-pitch_roll.pde sample (only the quaternion works), there is no error, sketch are load in the board but I dont see the value on the serial reader...

Thank you by adavance for your help,

Rogerlette

Question information

Language:
English Edit question
Status:
Solved
For:
FreeIMU Edit question
Assignee:
No assignee Edit question
Solved by:
Fabio Varesano
Solved:
Last query:
Last reply:
Revision history for this message
Fabio Varesano (fabio-varesano) said :
#1

Hi Rogerlette, thanks for stopping by!

1) stop using Wire. You may wanna rewrite the libraries to stop using Wire (the Arduino lib for I2C) and start using http://code.google.com/p/simplo/source/browse/trunk/libraries/fastwire/ .. code will be lighter and faster. I'll gladly help you on this as this is also on my TODO list.

2) No more using the Sensors libs and write adhoc code which does only what you really need.

I don't understand the last question about the serial reader. Remember that Serial ports can be accessible by one application at a time: if processing is using the serial, the arduino monitor won't be able to read from it.

Revision history for this message
rogerlette (rogerlette) said :
#2

Thanks for this quick answer,

I try to just change the "#include <Wire.h" by "#include <Fastwire.h> in the freeIMU_quaternion.pde and all the attach library file.h

But of course, it's not so simple! And I suppose that all the instructions from the FastWire library such as Wire.begin() or Wire.send() ) are different in the Fastwire library. Which mean that I need to change in all the function call by freeIMU_quaternion.pde the old instructions by the new one isn't it ?

If I am write, I'm not sure I will succeed ! But anyway, I will try and inform you here.

And then if I'm still alive after this, I will have a look to your second advice !

Revision history for this message
rogerlette (rogerlette) said :
#3

And another problem ! :-)

In my project (which is a glove GUI) I use two arduino, in the first one there is the FreeIMU board and some sensors (analog and digital input)
And in the second one there is an rfid reader and other sensors.

The problem is that I actually send through I2C the rfid code and sensors values of the second arduino to the first arduino.
Then on the first arduino I took the values from the freeIMU board and others sensors, And finally I send all the information from both arduino on the serial port. So I use several function of the Wire.h library which will probably not be in the Fastwire.h library ??

I'm a little lost... Doctor, what do you advice me to avoid headache on this project ? :-)

Revision history for this message
Best Fabio Varesano (fabio-varesano) said :
#4

The fastwire is a complete rewrite of Wire.. it's not API compatible meaning that the function names are different, so you'll have to understand the code and rewrite according. Browse around the code linked above.. you'll see examples for communicating with some sensors which may help you.

Revision history for this message
rogerlette (rogerlette) said :
#5

Ok thanks for your advices,

I think I will have some works for the next few weeks... :-)

Revision history for this message
rogerlette (rogerlette) said :
#6

Ok I solve the problem, I was just using an old diecimila arduino which have not many space...

I just bought an arduino UNO and all is ok without changing anything !

Thanks for your help Fabio.

Revision history for this message
rogerlette (rogerlette) said :
#7

Thanks Fabio Varesano, that solved my question.