Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Re: ADXL345 Reliable (Double)Tap Detection on: March 19, 2014, 12:56:43 am
Problem Solved!

For anyone else who is using this library and having similar problems, I had to make a tweak in order to achieve what I was after. If I'm not overlooking something, it would seem that the problem I was having was related to reading the interrupt source registers. The datasheet wasn't crystal clear on this point, but it would seem that reading any bit from the interrupt source register will clear all the source bits, but just the one you read. So in my case, what was happening was when I checked the single-tap interrupt source bit, it cleared the double-tap interrupt source bit as well.

My solution to this was to add a library function which returns the entire byte of data from the interrupt source register. I placed the following at line 1366 of ADXL345.cpp

Code:
/** Get ENTIRE INTERRUPT SOURCE REGISTER
 * @return Interrupt source register
 * @see ADXL345_RA_INT_SOURCE
 */
uint8_t ADXL345::getIntSource() {
    I2Cdev::readByte(devAddr, ADXL345_RA_INT_SOURCE, buffer);
    return buffer[0];
}

Add the appropriate prototype defs to the .h file. Then, call this function to return all 8 bits of the interrupt register at once. No more accidental clearing!

I then used this operation to differentiate between single and double taps, where accel is an ADXL345 instance, and tapType is a boolean where true = double-tap and false = single-tap

Code:
if(accel.getIntSource() & (1<<5))tapType=1;
    else tapType=0;

I hope this can help someone. Please let me know if you have questions in the future!
2  Using Arduino / Sensors / Re: What can I do with these IR sensor results?? on: March 17, 2014, 12:21:58 pm
Post your code. It looks like your dump output has two components: the IR key code, and the start/stop of the detection. I think a switch statement would be a good starting point.

If you can write a switch on the key codes, you can easily add forward/reverse/left/right commands. And if you pair that with the start/stop portion, your switch statement will be able to cancel each of the commands you write. That would be a good start, I would think.
3  Using Arduino / Sensors / ADXL345 Reliable (Double)Tap Detection - SOLVED on: March 17, 2014, 12:14:44 pm
Hi everyone!

Lately I've been experimenting with the ADXL345 accelerometer from Analog Devices. I'm using Jeff Rowberg's i2cdevlib library for the 345 https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/ADXL345.

I'm trying to use the 345 for tap and double-tap detection, but I've noticed that the results are very inconsistent. I can usually detect a singular tap, although when I try continuously tapping (once every 5-10 seconds), I notice it will miss taps occasionally. Double-taps are a complete gamble. Sometimes, it will register nothing. Other times, it registers two single-taps. Yet, other times, I'll get a single-tap followed by a double-tap.

What I'm curious about is if anyone else has had this issue and was able to get a consistent detection/differentiation between tap events. I have tried adjusting tap thresholds, latency, etc. I can post code if need be.

Thanks for any input!
4  Using Arduino / Project Guidance / Re: ADXL345's Interrupt problem on: March 16, 2014, 06:32:15 pm
Is that your complete sketch code? Just looking for the interrupt target "sample" function...
5  Using Arduino / Project Guidance / Re: Please help - Getting ADXL345 accel's to log to an SD card. on: March 16, 2014, 06:16:56 pm
Perhaps using I2C could help resolve some conflicts. The ADXL345 supports I2C so you could get it off the SPI bus, and it's rather easy to implement. Checkout Jeff Rowberg's i2cdevlib on github https://github.com/jrowberg/i2cdevlib
6  Using Arduino / Microcontrollers / Re: Hot Spare/Heartbeat Synched Backup on: March 05, 2014, 09:17:27 am
Alright. Like I said, I didn't want to argue the merits of redundancy. I'm well aware of the limitations of RAID (which was only an example) and stacking power supplies (which are practically an industry standard in enterprise grade switches). If you look at it from a slightly broader perspective, perhaps, you see that every system in some way has a level of limitation and adds a layer of complexity.

It's easy to start sounding preachy or antagonistic, Paul__B, but I'm going to chalk that up as a pitfall of asynchronous communication. I've got plenty of experience with redundant network and server equipment, which is what piqued my curiosity in the first place. We could go around and around on this if nobody wants to talk about the actual topic of the thread, but I think all our times will be better spent elsewhere.

I'm curious if anyone has tried this or could offer any insight as to the best approach (if it's even possible!)

It doesn't sound like many people have had cause to investigate backup/failover/redundant systems with their Arduino projects, but if I learn anything I'll make sure I pass it along.

Thanks again to all!
7  Using Arduino / Microcontrollers / Re: Hot Spare/Heartbeat Synched Backup on: March 04, 2014, 11:34:43 pm
Robin,

You make many valid points. It makes me think of "Minority Report" (having a 3rd perspective as a tie breaker).

I'll grant everyone that it may seem like a very major undertaking with very little return, given all that can be done to prevent a hardware failure in the first place. And, I'm not planning on using it any time soon for that very reason. I only think it's something that shouldn't be completely dismissed if in fact it is possible. There is a reason people RAID their hard drives or have redundant power supplies in medical monitoring equipment. Failures can and do happen. Once you've dealt with all that you can to prevent a failure, it's only natural to look at what you can do next.

Again, I understand it might complicate what would otherwise be a simple system. I certainly don't want to spark an all-out debate about the virtues of redundancy. I was just curious about what others' experiences were when it came to this topic. Again, thanks for the advice and insight!
8  Using Arduino / Programming Questions / Re: Serial TTY Communication via Shell Script? on: March 04, 2014, 02:20:23 pm
I can't say for certain, but looking at the python script, I am curious about Line #34 and the Serial.readline() function. Do you know if the .readline() function actually waits for available data? If it's assuming data is ready on the tty port, and continues processing regardless, that could be a pitfall right there.
9  Using Arduino / Motors, Mechanics, and Power / Re: controlling 10A DC Motor using Arduino UNO on: March 04, 2014, 12:03:15 pm
Actually, you wouldn't really need a transistor to control a relay. Most hobbyist grade relays will operate at +5V, which is perfect for toggling with any Uno pin. A relay is probably the way to go, though.

As far as the ATX PSU is concerned. Amps = Watts / Volts
So, not taking into account the actual power management systems and the other rails of the PSU, a 300 watt ATX power supply could easily source > 10 amps, hardly what I'd call a large PSU.
10  Using Arduino / Programming Questions / Re: Serial TTY Communication via Shell Script? on: March 04, 2014, 11:49:30 am
You'd want to double check that your code is not blocking. The Arduino can only do one thing at a time, of course, so when it reaches the point where it reads the serial buffer, it grabs everything that has been buffered all at once, then begins to process the commands it has received. Once it finishes those commands, I'd assume that it loops around and checks the buffer again and grabs whatever is available.

I'd suggest sending all the commands to the Arduino at once, saving them to an SD card or something, and then letting it play out the entire CNC process, rather than trying to pass commands real time. That is, unless you're trying to have real time response from commands you're manually putting into the CLI.
11  Using Arduino / Displays / Re: Round LCD and Driver Help on: February 23, 2014, 02:05:48 pm
Did anyone ever have any luck driving one of these displays?

I never did get them to initialize. It looked like the UTFT library could be a viable resource, but for all the pins you have to dedicate to that specific model, I decided to go with a conventional rectangular display. There do appear to be a couple SPI capable round TFT displays out there, but for now, I'm sticking with tried and true hardware.
12  Using Arduino / Microcontrollers / Re: Hot Spare/Heartbeat Synched Backup on: February 23, 2014, 01:57:02 pm
Thanks to everyone for their opinions. I guess this only reinforces what I already know, but all knowledge is useful knowledge.
13  Using Arduino / Sensors / Re: Problem with MMA8452Q Accelorometer on: February 06, 2014, 08:47:49 pm
I know that this is an old thread, but I thought it would be worth clearing up the questionable output data.

Reviewing the code jahnavi was using, it's clear that Nate from SparkFun was thinking in terms of m/s2, that is to say, meters per second. On line 52, the acceleration is converted from units of G to units of m/s2. This is a pretty typical unit for measuring acceleration due to gravity.

So, the results jahnavi got with the sketch are not all that unreasonable. The vertical axis seems to hover around 9.4 m/s2, which is only 4% deviation from an expected 9.8 m/s2. The other two measurements are a little harder to explain. It could be due to lack of calibration, or setting the Accelerometer on an uneven surface.

I hope that my revival of this thread can help somebody! Thanks
14  Using Arduino / Microcontrollers / Hot Spare/Heartbeat Synched Backup on: February 03, 2014, 12:43:47 pm
I have an idea I'd like to try, but it's doubtful I'm the first to think of it. That is why I'd like to see if anyone has tried to:

Set up two Arduinos (of any model) or bare ATMega chips side-by-side, sharing all inputs between both, except for one. Put one Arduino into a loop or low-power mode, and use an interrupt to wake it if the other one fails or gets locked up at which point it would take over the duties of the first Arduino. Whether a "heartbeat" or an interrupt would be better, I do not know. But I'm curious if anyone has tried this or could offer any insight as to the best approach (if it's even possible!)

Looking forward to comments, Thanks!

Peter
15  Using Arduino / Displays / Re: HD44780 with Due on: August 17, 2013, 02:30:58 pm
Thanks, everyone, for the input. My main question, though, was in regard to whether the Due had any known issues with the LiquidCrystal library.

In any case, the issue turns out to not have been related to the Due, the library, or my wiring. Apparently, the LCD itself is connected to the board by nothing more than flush contact between some exposed pads. In my case, the contacts were not making good contact. The solution, it turns out, was to apply a little extra downward force on the retaining bracket and bend the mounting tabs on the rear of the board to hold it in place.

Again, thanks for the loads of replies!
Pages: [1] 2