Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / Re: Feasibility of making a mouse with an Arduino? on: April 21, 2013, 12:18:58 am
It is possible to make your own mouse with Arduino code.  I recently completed the build of a new trackball, but it could have been a mouse just as easily.  I used Arduino to code the software and I'm running that code on a Teensy 2.0 from PJRC.com, an Arduino clone with a few twists of its own.  I'm using the Teensy primarily since it will emulate a keyboard and mouse with no effort required.  It is also very small, so it fits up inside the body of the device very easily. 

I'm using an ADNS-9800 laser optical sensor.  I did have to build my own circuit board for it, so that can be a bit of a challenge.  It interfaces over SPI and the Arduino SPI library works just fine with it.  My biggest challenge with using the ADNS-9800 is that I only have a few samples to work from.  I cannot buy them in small quantities from any distributor.  The factory (Pixart) sells them in quantities of 1,000 or more at a time.  I really wish I could find a source for buying just a few at a time and I would offer to sell the circuit board design for folks like you who want to make your own mouse, trackball or robot.
2  Using Arduino / General Electronics / Re: capacitive sensor with no ground on: January 28, 2013, 10:01:39 pm
I too saw this same effect of the sensor not working when on battery verses on the "mains".  I made some slight modifications to the CapacitiveSensor.cpp library file that seems to have fixed this issue.  Essentially, I wanted to drive the circuit to an output set low as to connect it to ground.  This helps to drain the capacitance on each iterative cycle so that each measurement cycle starts from zero.  In addition, I also added a timer to the loop to help allow the discharge be complete before the next measurement.

Code:
int CapacitiveSensor::SenseOneCycle(void)
{
    noInterrupts();
*sOut &= ~sBit;    // set send pin to INPUT     (<<<<<<<<<<<< Change here <<<<<<<<<<<<)
*sOut &= ~sBit;        // set Send Pin Register low

*rReg &= ~rBit;        // set receivePin to input
*rOut &= ~rBit;        // set receivePin Register low to make sure pullups are off

*rReg |= rBit;         // set pin to OUTPUT - pin is now LOW AND OUTPUT
*rReg &= ~rBit;        // set pin to INPUT

*sOut |= sBit;         // set send Pin High
    interrupts();

while ( !(*rIn & rBit)  && (total < CS_Timeout_Millis) ) {  // while receive pin is LOW AND total is positive value
total++;
}

if (total > CS_Timeout_Millis) {
return -2;         //  total variable over timeout
}

// set receive pin HIGH briefly to charge up fully - because the while loop above will exit when pin is ~ 2.5V
    noInterrupts();
*rOut  |= rBit;        // set receive pin HIGH - turns on pullup
*rReg |= rBit;         // set pin to OUTPUT - pin is now HIGH AND OUTPUT
*rReg &= ~rBit;        // set pin to INPUT
*rOut  &= ~rBit;       // turn off pullup
        *sOut |= sBit; // set send pin to OUTPUT     (<<<<<<<<<< change here <<<<<<<<<<<<)
*sOut &= ~sBit;        // set send Pin LOW
    interrupts();

Code:
long CapacitiveSensor::capacitiveSensorRaw(uint8_t samples)
{
total = 0;
if (samples == 0) return 0;
if (error < 0) return -1;                  // bad pin - this appears not to work

for (uint8_t i = 0; i < samples; i++) {    // loop for samples parameter - simple lowpass filter
if (SenseOneCycle() < 0)  return -2;   // variable over timeout
delay(5);                              // (<<<<<<<<<<< Change Here <<<<<<<<<<<<<<<<<<<)
}

return total;
}
3  Using Arduino / Storage / Re: MicroSD: New Card Issues on: October 01, 2012, 05:19:01 pm
Thanks for the help and info.  I'm working through my source code to work with this library instead of the SD.  I have much of the conversion done, but I have a few methods I was using that I'm not sure are the equivalent for the SdFat library.  Is there some documentation available that will show me the methods available?  Specifically, I need equivalent of these:  Create directory, delete file and/or overwrite a file, check if a file is in existence.

-John
4  Using Arduino / Storage / Re: MicroSD: New Card Issues on: October 01, 2012, 02:51:19 pm
I am now getting some positive results to report, but mostly due to my own misunderstanding / mistake.  Your first inclination was correct about setting one of the CRC modes.  My mistake was that when copied the beta library you indicated to the libraries directory, I had renamed the original SdFat folder as "SdFatORIGINAL" before moving the beta copy to the libraries directory.  While observing the verbose output of the compiler, I noticed that, even though I had been choosing examples from the SdFat library, it was compiling from the SdFatORIGINAL directory.  After I completely removed the SdFatORIGINAL directory and re-started the IDE, it started compiling from the right place. 

So, the success is mixed.  The ReadWriteSdFat sketch is able to read and write to the card with the CRC check turned on.  The Bench sketch runs without error, however, never ends, even after 5 minutes.  Once I remove the card from the project and install it into my computer, I see the BENCH.DAT, but no data is in the file. 

Given this, I'm going to dig into how the ReadWriteSdFat sketch is written and try to make those changes to my own sketch to see if I can read and write properly from the card.

If I leave the CRC check turned on, will this continue to be universally compatible with both these cards and other cards, with the speed penalty?  I'm thinking with my relatively light needs, the speed penalty might be OK for this application.

Thanks.

-John
5  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 30, 2012, 10:58:29 pm
I went ahead and just ordered some new cards from a state-side vendor, hoping to put these issues behind me.  Not sure what I'll do with these, but if you get any ideas, let me know.  Maybe I'll just give away my resume on them or send them to family members with pictures on them. 

-John
6  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 30, 2012, 08:48:02 pm
I did try the card in with another microprocessor and card reader that I had soldered up this afternoon, which is my own hardware that is very similar to a Teensy++, however, the results remain the same.  I too don't believe it is an SPI hardware issue as the 2G "expensive" card works every time without fail.  Do you think that there is any remedy that can be made to adapt to this card?  I wouldn't mind to send you one or two or run more tests if that would help. 

I bought these from a distributor, direct from China, and had them shipped to me.  Judging by the manufacturing date that is seen in the tests we have run recently, they are not exactly new.  More than likely, the price was too good to be true and I simply got what I paid for.  A cheap product for a cheap price.  I'm thinking it may be best to seek out another source for cards unless you think you would be able to work with in in some way.  I'm not needing extreme performance as I'm just reading and writing about 100 simple text files that are 24 or 32 bytes long in most cases.  I just needed removable storage for my application and EEPROM isn't so removable.

Thanks again.

-John
7  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 30, 2012, 06:50:36 pm
Thanks for the reply, but unfortunately, the same error still persists if I set USE_SD_CRC to either 1 or 2.  I see a variety of other settings in the SdFatConfig.h file.  Perhaps one of them would help.

-John
8  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 29, 2012, 08:50:33 pm
After formatting one of the cards with SDFormatter v3.1 and running the tests again, here are the results:

:::::::::::::::: Bench :::::::::::::::::::::
Free RAM: 7301
Type is FAT16
error: open failed
SD errorCode: 0X13

::::::::::::: QuickStart :::::::::::::::::::

SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10

Enter the chip select pin number: 20

Card successfully initialized.

Card size: 2055 MB (MB = 1,000,000 bytes)

Volume is FAT16, Cluster size (bytes): 32768

Files found (name date time size):
BENCH.DAT      2000-01-01 01:00:00 0

Success!  Type any character to restart.


:::::::::::::::::: SdInfo :::::::::::::::::

type any character to start

init time: 4 ms

Card type: SD2

Manufacturer ID: 0X0
OEM ID:
Product: APPSD
Version: 3.0
Serial number: 2290649224
Manufacturing date: 10/2010

cardSize: 4014080 (512 byte blocks)
flashEraseSize: 128 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,245,4011595
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT16
blocksPerCluster: 64
clusterCount: 62673
freeClusters: 62673
fatStartBlock: 246
fatCount: 2
blocksPerFat: 245
rootDirStart: 736
dataStartBlock: 768
9  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 29, 2012, 08:34:18 pm
Wow, these look like great tools you have written to really drill down to what the issue might be.  Here is the output of one of the cards using just the default format that comes on them from the factory.  I'm formatting another one with SDFormatter v3.1 and will run the tests again.  It is interesting that these come labeled as 1G cards, but all indications are that they are 2G cards.  Wondering if they are the 2G seconds that were rejected and reformatted as 1G.

::::::::::: SdInfo :::::::::::::::::::::

SdFat version: 20120719

type any character to start

init time: 5 ms

Card type: SD2

Manufacturer ID: 0X0
OEM ID:
Product: APPSD
Version: 3.0
Serial number: 2290649224
Manufacturing date: 10/2010

cardSize: 4014080 (512 byte blocks)
flashEraseSize: 128 blocks
eraseSingleBlock: true

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,245,4013835
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0

Volume is FAT16
blocksPerCluster: 32
clusterCount: 62679
freeClusters: 62643
fatStartBlock: 251
fatCount: 2
blocksPerFat: 245
rootDirStart: 741
dataStartBlock: 773
Data area is not aligned on flash erase boundaries!
Download and use formatter from www.sdcard.org/consumer!



:::::::: QuickStart:::::::::


SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10

Enter the chip select pin number: 20

Card successfully initialized.

Card size: 2055 MB (MB = 1,000,000 bytes)

Volume is FAT16, Cluster size (bytes): 16384

Files found (name date time size):
PWMGR          2000-01-01 01:00:00 0
TEST.TXT       2000-01-01 01:00:00 0

This card should be reformatted for best performance.
Use a cluster size of 32 KB for cards larger than 1 GB.
Only cards larger than 2 GB should be formatted FAT32.
Try reformatting the card.  For best results use
the SdFormatter sketch in SdFat/examples or download
and use SDFormatter from www.sdcard.org/consumer.

Restarting

:::::::::::: SdFormatter::::::::::::::::

Enter the chip select pin number: This sketch can erase and/or format SD/SDHC cards.

Erase uses the card's fast flash erase command.
Flash erase sets all data to 0X00 for most cards
and 0XFF for a few vendor's cards.

Cards larger than 2 GB will be formatted FAT32 and
smaller cards will be formatted FAT16.

Warning, all data on the card will be erased.
Enter 'Y' to continue: Y

Options are:
E - erase the card and skip formatting.
F - erase and then format the card. (recommended)
Q - quick format the card without erase.

Enter option: F
Card Size: 1960 MB, (MB = 1,048,576 bytes)

Erasing
................
All data set to 0x00
Erase done

Formatting
Blocks/Cluster: 64
FAT16
error: write MBR
SD error: 13,b


::::::::::::::::: Bench ::::::::::::::::::::::::

SdFat version: 20120719

type any character to start
Free RAM: 7301
Type is FAT16
error: open failed
SD errorCode: 0X13
10  Using Arduino / Storage / Re: MicroSD: New Card Issues on: September 28, 2012, 11:31:51 pm
As for hardware, I'm currently running my prototype as a Teensy 2.0++, modified for 3.3V operation.  I have an CF adapter with legs soldered on poked into my breadboard, where I wire it directly up to the SPI port on the Teensy++.  It is just straight wired and everything running 3.3V.  I've also tried this on my own hardware board of my own design (a sort of derivative of the Teensy++, but my own twist) that has much the same connectivity, but instead has its own MicroSD push-push slot.

Thanks for checking it out.

John
11  Using Arduino / Storage / MicroSD: New Card Issues on: September 28, 2012, 11:02:33 pm
I have a sketch project that is working well with a 2G MicroSD card that I bought locally for a high price.  After shopping around, I was able to locate a much better price on 1G cards and bought a bunch of them.  When I use the new 1G cards though, they do not seem to work.  The most interesting part is that both cards respond well to the example SD library sketch of "CardInfo" and display the proper parameters and directory readings.  When I attempt to run any sketches (canned examples or my own) that need to open a file and write to the newer 1G card, it fails.  When I say fail, I will see a series of files created in some cases, but they all have zero bytes in size.  Some varieties of the SD libraries simply report an error when attempting to initialize the card.  The exact same sketch works on the 2G card without issue.  I tried a few other varieties of the available SD libraries, such as FAT16.  I also tried formatting the new 1G card with the official SDFormatter utility to ensure I had a good format, but still no luck. The cards do seem to have a FAT16 filesystem on them from the factory. 

Other things I tried:  insert delay(200) statements around the operations that write to the card to simply slow the logic down.  Changed the speed of the compiled project 1MHz, 2MHz, 8MHz & 16MHz.

The new 1G cards do work with a USB adapter on my desktop computer as well as working well in my Android device.  I can read/write/delete to the card with no issues.  My suspicion is that these newer cards do not perform well with an SPI interface, but work fine for MMC mode.  Any thoughts are welcome. 

Thanks.

John

I'm reaching out to see if there are any other options or suggestions to try to get these to work that I've not tried yet.  Perhaps I simply got what I paid for, but I'd like to find a way to use them since I did end up with 100 of them.
12  Using Arduino / General Electronics / Re: Tips on double sided PCBs... on: August 20, 2012, 11:15:33 am
I've had a fair bit of good luck with "mechanical etching" using a CNC router.  Once you get the hang of side-to-side registration, the images line up really well top and bottom.  Of course, you need a CNC router too.  I really hate having to deal with soldering little pieces of wire through the holes to make the vias though.  That is the real downside to making boards at home is no ability to do holes that are plated through.  If you have just a couple of vias, it is worth it, but if you end up with a bunch of them, it is best to just send that off to OSH Park and wait the 2.5-3 weeks for it to arrive in the mail.

Your work looks great though :-)
13  Using Arduino / General Electronics / Re: Dual Power Sources through LDO on: August 20, 2012, 11:10:21 am
Thanks for turning me on to those mosfet switches.  Those would certainly be "ideal", but the cost is quite a bit more than the alternative and I don't think my budget will allow for it.  They are certainly a great product though. 
14  Using Arduino / General Electronics / Re: Dual Power Sources through LDO on: August 20, 2012, 12:16:55 am
Thanks for the tip on the Schottky diodes.  That looks like a nice improvement to the circuit to get a little more out of that battery.  I'm looking at this one:

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00126118.pdf

-John
15  Using Arduino / General Electronics / Re: Tips on double sided PCBs... on: August 19, 2012, 11:58:51 pm
I agree that OSH Park is great and inexpensive.  I use that service often.

As for those boards created at home, you might try experimenting with some soldering paste that will go on the pad below the header before you insert the header and maybe don't squash it all the way down.  The heat from the pin, heated from the underside, may be enough to melt it and make a connection.  I've never tried it, but worth playing with to see if that will work for you.  Be sure to use some low melt point paste like R276 so it is easy to work with. 

-John
Pages: [1] 2