Arduino project

I want to transfer data from sd card which is attached to arduino to mobile phone using Bluetooth . How should i try to do that , i am new to arduino

You break the problem down into multiple steps:

  • Write an Arduino program to open the SD card, and read the contents, writing them to the serial monitor to learn how to read from a SD card;
  • Write an Arduino program to open up a bluetooth connection, and write data to your phone (how you do it, depends on what bluetooth device you have);
  • Combine the two programs.

I dont want to use serial monitor , this complete hardware would be put somewhere without pc access and when i bring my cell phone near the hardware the data from sd card should be sent to mobile phone

Can somebody help me i am just a beginner

DushyantSahoo: I dont want to use serial monitor , this complete hardware would be put somewhere without pc access and when i bring my cell phone near the hardware the data from sd card should be sent to mobile phone

That's like refusing to pour a foundation because you want to build a skyscraper.

If you can't successfully get Arduino to write contents of SD card to the serial monitor....you'll never be able to figure out how to send it over Bluetooth.

So, start with reading the SD card to the serial monitor. Once you have that figured out, move to the next step.

I dont want to use serial monitor

MM and 1CD didn't mean that the serial monitor would become part of your solution, but rather it's a waypoint along your learning journey.

DushyantSahoo: I dont want to use serial monitor , this complete hardware would be put somewhere without pc access and when i bring my cell phone near the hardware the data from sd card should be sent to mobile phone

Just to be clear, by serial monitor, I don't mean hooking up a VT100 to the serial lines. Instead on most of the Arduinos and other similar processors, you can use the USB line you program the chip with, and in the IDE in the upper left hand corner is the icon for the serial monitor. This opens up another window that connects you to the Arduino. After doing a Serial.begin (9600) in the setup function, you can do Serial.print or Serial.println functions to print out strings and numbers. At different points in the program, you can print out different things to see how the program is working.

As JimboZA and 1ChicagoDave amplified, what I meant in general in programming things don't spring out of your head in one burst, that works completely. It does happen from time to time, particularly with insane deadlines and massive amounts of coffee, but that only happens when you have fully mastered things.

So, instead as I said, you break things down into smaller pieces, where each step will eventually get you to where you want to be.

So in the first step, you need to worry about reading a file from a SD card. First you procure the parts, which involves research as to whether it is easy to hook up to your system, and the cost/benefit of this choice over another (such as do I buy a cheaper part from China and then wait 2-3 weeks for it to come, do I pay a little more from Adafruit and get it in 4 days, or do I pay even more and get it today at my local Radio Shack). After you get the device, you need to attach the wires (which you should learn a bit of which wires to connect and whether to solder them in or else you might slag the SD card reader you just bought). Once you have it hooked up, then you need to learn how to read from the card. There are various guides out there, but you might need to modify them (for example, what pin is it connected to). In order to show that you've read the right information, you want to want to print it somewhere. While you are debugging the program, using the serial monitor is a great way to make sure your program is working correctly. You add print statements at key points to see what it is doing. In the professional world, we have various types of debuggers that can stop the code at a particular point, look at things, and possibly change them. Unfortunately in the Arduino world, you typically don't have debugger support, so you need to do it with print statements. BTW, this is the way I started debugging programs, many years ago when I had my program on a deck of IBM punch cards, and I gave them to the machine operator, who would run the program and give me the results the next morning after the program was run overnight.

When you understand how to read from a SD card, you go on to the next step, and that is connecting your bluetooth device. Once again, you write simple programs to show that you can get the pieces to work. One note, you didn't mention WHICH mobile phone you have. Android phones can typically deal with Bluetooth 2.1 devices which are fairly cheap. However, Apple phones can only deal with Bluetooth 4.0 devices, which at present, tend to be harder to find, and more expensive. Except for maybe the very newest Android phones, I don't believe Android phones can communicate with Bluetooth 4.0 devices, so you need to know what you want to connect with before looking for devices.

Then once you have the two parts, you need to put them together. In the initial stages, I would still think you would want something like a serial monitor, but you could also use things like lighting LEDs. A lot of electronics for instance has a flashing LED pattern when it wants to communicate something is wrong. At the very end of the design cycle, then you remove the debug aids, possibly moving it to custom built boards, etc.

Now, given you want to transfer a whole file, you probably have added to the complexity, since you have to deal with flow control, making sure the phone gets the bytes properly, and without error, possibly resending parts that got lost in transmission. In addition, it may be harder to do, since the typical Arduino bluetooth device only executes a serial port, and you would need to run some app on the phone that takes data from the serial port and writes it to its flash memory or SD card. There are alternative methods where the Arduino might emulate a different type of device, such as a remote disk, but then you need to go past the simple/cheap bluetooth serial ports, and do more of the bluetooth communication.

It can be done, the question whether the project in its entirety can be done by you at present. The question is how motivated are you? It will be a lot of work, as you have to learn how to do things. When you went into the first grade math class, you didn't learn how to do calculus on the first day. No, you learned numbers and how to add/subtract. Later, you learned multiplication, division, and fractions. Then you learned algebra and geometry. Only then did you have enough background knowledge to learn calculus. The same idea goes for both the programming and the electronics side of creating things with Arduinos.

If you don't know programming, it might be simpler for your first project to involve less parts.

For example, when I got my bluetooth card, I whipped up a simple program that when the bluetooth device sent an 'a', the Arduino turned on the first LED, when the bluetooth device sent a 'b', the Arduino turned on a second LED, when the bluetooth device sent an 'A', the Arduino turned off the first LED, and when the bluetooth device sent a 'B', it turned off the second LED. I used an Android app (Bluetooth Controller) that I can configure 9 buttons to each send specific text ('a', 'b', 'A', 'B', etc.) which the Arduino then uses to do actions.

I should mention, you can get cheaper embedded processors these days than Arduino Unos (or my current choice Teensy 3.0), such as the Adafruit Trinket/Gemma or the Digistump Digispark that are based on the ATtiny85's which are smaller, and have less memory. One of the things these chips don't have is full serial monitor support, which it makes it harder to debug. Again, once you are an ace at programming Arduinos, you might not need the serial monitor for debugging, but it can make it a lot easier.

If you are going to learn how to do things, you need to learn how to approach big system design:

  • Figure out how to research things, so you know what type of things are needed before doing the design, and what types of limitations you might have;
  • Figure out how to break large projects into smaller tasks, but not so small that you lose the forest due to the trees;
  • Figure out how to debug things when it doesn't work as expected, how to put in markers so you can figure out how the program flows;
  • Figure out how to combine things back into a larger project.

Very nice explanation from MM there (except that the monitor icon is top-right not top-left 8), and it's also in the Tools menu and ctrl-shift-m as a shortcut, btw). If you are literally brand new to Arduino, my suggestion is to put your project on the back-burner for a while (only a day or two) while you work through some tutorials.

Then also have a dig around the Playground, where you will likely find suggestions and code (certainly snippets, and who knows, maybe almost complete solutions).

Also, when you buy components from outfits like Pololu and Adafruit, you get loads of help in the form of good user guides, tutorials and code. I just did some work yesterday on my Zumo robot, and realised that all the major parts except the Uno are from Pololu: the robot itself, the motor driver board, a voltage reg board, and two Wixels. Everything is top-notch quality and well supported with documentation.

It's great to have a project in mind as you learn of course.....

JimboZA: Very nice explanation from MM there (except that the monitor icon is top-right not top-left 8)

Sorry about that.

JimboZA: Also, when you buy components from outfits like Pololu and Adafruit, you get loads of help in the form of good user guides, tutorials and code. I just did some work yesterday on my Zumo robot, and realised that all the major parts except the Uno are from Pololu: the robot itself, the motor driver board, a voltage reg board, and two Wixels. Everything is top-notch quality and well supported with documentation.

I tend to go in waves, and right now, Adafruit is where I've been spending my money (neopixels, and a 1.5" monitor with RCA input). But pololu.com is also a good company, as is robotshop.com, sparkfun.com. I like yourdunio.com for its intro tutorials, and I just wish they shipped more components from the USA rather than China due to my being impatient.

JimboZA: It's great to have a project in mind as you learn of course.....

Yep. The important thing to realize is, it may take some time to get to your ultimate goal. My icon photo is of me with one of my steampunk cameras taken a few years ago. It is a modern camera (the camera in the photo is an Olympus E-3, though I have upgrade now to E-5), and I built a wooden shell to go around it, made to resemble the bellows cameras press photographers used in the 1930's (Speed Graphics). In tackling the project, I needed to learn woodworking, and slowly acquire both the skill and the tools to do it, and one of the minor side projects with that is using a telegraph key to fire the camera. I've now spent maybe 4 years working on variations on a theme, with maybe 5 or 6 setups, and every time I go to an event, something is different. I am now tackling more complex projects since I learned the techniques on earlier build. It is important to have an end goal, but you have to get from where you are to where you want to be in smaller steps. I tend to think you don't learn as much if you only tackle projects that are just minor extensions of where you are. You only really learn when you challenge yourself trying to get past your current limitations.

And note, failure is important. We all fail. Those of us that succeed get back up and learn from the failure and continue on. I've run into some people that at the first failure, say I'm out of here, on to the next thing. Bear in mind, when Thomas Edison was figuring out what worked best for the filiment in the early light bulbs, he went through thousands of tests until he found the right substance that would be cheap enough to make and last long enough to be commercially viable.

Nice addition at the end, MM. Reminds me of a few of my favorite quotes -

“I have not failed, I have just found 10,000 ways that don't work.” "There is no failure except in no longer trying."

? Albert Einstein

"Success is not built on success. It's built on failure. It's built on frustration. Sometimes its built on catastrophe."

— Sumner Redstone

This is very helpful & encouraging thread. I wonder if the O/P has seen the rest of it...?