Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: if / else function one time button on: July 10, 2013, 11:02:25 pm
You could be more precise! I think you want the "break;" statement to exit a loop or the "return;" statement to exit a function.
2  Using Arduino / Programming Questions / FreeSix IMU library Patch for ITG3200/ADXL345 on: July 10, 2013, 10:02:17 pm
Hi everybody, I made a project where I need to stabilize a camera. It looks like a platform with a linear actuator at one end for changing the pitch of the platform.
To achieve this I got an ITG3200/ADXL345 breakout board from Sparkfun (https://www.sparkfun.com/products/10121)
Here is what the program does:

1-Get the angle of the Y axis of the IMU (using FreeSixIMU library, which calculates the absolute angle with the acc and gyroscope data)
2-Pass it through a function to determine how much juice I need to send over the motor and in which direction to keep the platform stable
3-Output this value to a Polulu motor controller

I achieved all the above easily, but I got stuck with one issue:
I use only one measured axis (X) of the IMU. Whenever I put the IMU sensor at an angle (say 45 degrees X) and I rotate it along the Z axis, the value read by the X axis (which is at 45 degrees) is not 45 degrees anymore.

I made this animation to show which angle I want to read. But in practice, the value changes and goes from -45 to 0 to 45 degrees when it spins on Z axis. I want the reading to always be -45 like in the video.

http://www.youtube.com/v/lE7fyLNbIQk?hl=en_US&version=3

I tried to modify the FreeSix IMU library to delete every references to the Z axis, which I don't need in the project, but I don't have much knowledge of the formulas used. Here are the basic lines of the library, it seems to use a quaternion system, which I don't fully understand :
(FreeSixIMU.cpp)
Code:
void FreeSixIMU::getEuler(float * angles) {
float q[4]; // quaternion
  getQ(q);
  angles[0] = atan2(2 * q[1] * q[2] - 2 * q[0] * q[3], 2 * q[0]*q[0] + 2 * q[1] * q[1] - 1) * 180/M_PI; // psi
  angles[1] = -asin(2 * q[1] * q[3] + 2 * q[0] * q[2]) * 180/M_PI; // theta
  angles[2] = atan2(2 * q[2] * q[3] - 2 * q[0] * q[1], 2 * q[0] * q[0] + 2 * q[3] * q[3] - 1) * 180/M_PI; // phi
}

Where angles[0] corresponds to Z axis,
angles[1] to X axis and
angles[2] to Y axis.

The entire library is avalaible at: http://code.bildr.org/project/6dof/Arduino and for download at http://code.bildr.org/download/985.zip.

What I want is someone who could patch the library for me so it would exclude Z axis when measuring angle. It would apply to X and Y measurements. I need to get it working as soon as possible, so I am willing to pay 15$ paypal to whoever will supply me a working patched library.

If you have additional questions, feel free to ask me!

Thank you very much for your time!
Charles
3  Using Arduino / Project Guidance / Re: What to use for a Light Barrier ? on: October 08, 2012, 07:23:20 pm
This is a red laser, it's only the casing that is purple. Also, you can just buy them from a dollar store or whatever... I think that the photoresistor you got is perfect, there is still a difference between a laser beam shining on it and the ambient room light. If you didn't know, a photoresistor just changes the resistance of the current that passes through it depending on the lightning. So if you plug it in +5 volts, and measure the current that is exiting on the other side, by hooking it up to an Analog Input, you can get the quantity of light that is shining of it with digitalRead() function, which outputs a number from 0 (0v of 5v, lot of resistance = lot of light), to 1023 (5v of 5v, no resistance = no light at all) so you can set a threshold, so it takes a lot of light to trigger. To pull this value off,  you can either:

-Hook up a pot that sets that threshold, so you turn it until it only detects the light from the laser beam, ideal if you plan to take it to different places, with more or less lightning for easy adjustment

or,

-Hardcode that value in your code, so it's kind of "permanent" (until you change it in the program). To do so, you send the photoresistor values thru serial and you listen to them while playing around to write down your values.
4  Using Arduino / Project Guidance / Re: What to use for a Light Barrier ? on: October 07, 2012, 09:43:15 pm
This system just recognizes motion by reflected ir waves on the subject, and for the laser, any cheap laser pointer would do, example: http://www.ebay.com/itm/Mini-LED-Flash-light-Torch-Keychain-Laser-Pen-PURPL-/190732252540?pt=US_Laser_Pointers&hash=item2c6887357c
You just need a laser pointer and a photoresistor hooked up to an Analog Input and +5v, where you can set the threshold for the ambient light in your program. If you need any help for the program I can help you. But your best bet remains the reed switches, if it's not a big deal to put screws on your door frame...
http://www.ebay.com/itm/White-Door-Window-Contacts-Magnetic-Reed-Switch-Sensor-/350611210023?pt=LH_DefaultDomain_0&hash=item51a20e7f27
5  Using Arduino / Project Guidance / Re: What to use for a Light Barrier ? on: October 06, 2012, 10:21:07 pm
I dont't think that Ultrasounds are your best bet, I would rather use a laser (any cheap 1$ laser is good) or, simpler, a door magnetic reed switch.
6  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 02, 2012, 03:22:29 pm
If anyone wonders how to identify keypad pins, I got started there: http://arduino.cc/playground/Main/KeypadTutorial#Identify
7  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 01, 2012, 08:40:28 pm
Now, I plan on having 19 N Channel mosfets, gate wired to my arduino, collector to a com and source to a pin on the keypad, so I would just have to trigger two outputs simultaneously to connect them, like a keypress.

My only concern is: is there a two-way flow capability on the drain-source when voltage is applied to gate (is it acting like a diode, the current can only go from d to s ? or it can go from s to d too?) ? I don't know that much on transistors, so a little help would be appreciated. Thanks!

EDIT: Got my answer, it acts like a diode.
8  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 01, 2012, 05:10:15 pm
Here's what I got for the "pinout":
9  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 01, 2012, 01:54:14 pm
can Analog inputs serve as outputs?

Yes, or with some diodes and charlieplexing, or with a serial->parallel chip smiley-grin

I don't think I am advanced enough for that...

can Analog inputs serve as outputs?

Yes, all the I/O pins can be used as normal (i.e. non-PMW) digital inputs and outputs on all Arduino boards.  Sorry for not specifying that in my initial reply.

That's nice to know, so I could have a 20th pin that controls the servo to cut the paper, and use for example pin 19 and 20 to control the sevo. That seems good, thanks for your help!
10  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 01, 2012, 01:34:10 pm
can Analog inputs serve as outputs?
11  Using Arduino / Project Guidance / Re: Dymo LetraTag XR Interfacing w/ Leonardo on: October 01, 2012, 01:08:03 pm
ok, thanks for your reply, so I could note which keypress affect which pins, and build an array, buy 19 octocouplers and wire them to each pin and a com, when I activate two simultaneously, they get in contact and simulate the key. But how could I have 19 inputs on my leonardo? Charles

PS: I could also wire the thermal head and the stepper motor to the arduino like you said, which is a good idea, but I will be fine with only the default chip to handle the font and everything
12  Using Arduino / Project Guidance / Dymo LetraTag XR Interfacing w/ Leonardo on: September 30, 2012, 10:44:07 pm
Hi, my name is Charles, I am a 15 years old guy who loves electronics. I own an Arduino Leonardo board, and I got the idea to interface it with a Dymo LetraTag XR label printer that I found for 20 bucks. So here is the main idea:

1-Connect the keypad with the Arduino,
2-Have software to make arduino issue keypresses to the LetraTag (for example: "H E L L O PRINT SHIFT+DELETE")
3-I'll have a little servo to push the blade to cut the paper, but that's not the deal now

Here's my problem: I don't know anything about interfacing matrix keyboard and programming a clock to scan presses and etc....
So, If anyone has done that with a similar keyboard, or anyone that knows the principe and could explain it to me, You are welcome!

Thanks, Charles

Here are pictures of the device and the keypad:
http://i.imgur.com/O3wCe.jpg
http://i.imgur.com/bDyAa.jpg
http://i.imgur.com/lhWHO.jpg
Pages: [1]