Sending Data from Arduino to Android using Bluetooth - arduino

I am trying to do a project based on arduino and Android in which I want to use ultrasonic sensors and Bluetooth module hc-05 . I want to detect any obstacle using ultrasonic and send it's distance to Android app using Bluetooth. I am completely new to arduino and have never used it before . How could I connect both the Bluetooth and ultrasonic sensor to arduino uno board without using breadboard? Is it possible to connect both of them without using breadboard and just the jumper wires?

You can connect the Bluetooth Module and Ultrasonic Sensor with jumper wires directly to the Arduino.
Depending upon the Ultrasonic Sensor you are interfacing, there must be a library or a sample code. You can tweak the code to get the distance in your desired format or variable.
As far as the Bluetooth is concerned, you can operate it at 3.3v or 5v depending upon the module you use. Most of the Bluetooth module support both 3.3v and 5v - as they have voltage regulators on their break out. I have used these and they work on 3.3v as well as 5v
For instance, check the Bluetooth HC - 05 Module in the below link :
http://www.amazon.in/Verve-VTA009-Bluetooth-Module-HC-05/dp/B00S15XTG8?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=7a58e842-4c10-40bf-a48f-339edef372a7
For implementing the Bluetooth communication, prefer using the Software Serial. If you connect the Bluetooth HC 05's Rx and Tx to the Arduino's Hardware UART Pins, there can be unpredictable results. I have experienced that using HC05 with Software Serial is reliable. Additionally, you can use the Serial Monitor to debug your code at the same time. I mean, you can send the same data on Software Serial and the Serial port and check if things are as desired.
You can implement, the HC-05 Software Serial at 9600 baudrate. 9600 is the default baudrate on most HC 05 Modules.
For developing the Arduino code and testing it, you can use a terminal client like PuTTY on you computer. You need to establish a bluetooth connection between your computer and HC 05.

HC-05 runs at 3.3V, make sure you do level conversion from 5V to 3.3V using a zener diode. Or buy a level converter if you are new to electronics. If you don't, there is a good chance you will blow up the HC-05. If you could add a photo we can see if its already done on the Bluetooth module, then you need not worry about level conversion
HC-05 is basically a wireless serial port over bluetooh. On arduino create a software serial post using the library SoftwareSerial and send the sensor data to that serial port
There are libraries available for popular HC-SR04 ultrasonic sensor, if that is the sensor you are using.
For testing on android many app are availables like Bluetooh Terminal, you can receive the data sent from arduino.
Yes the whole project can be done without breadboard using connecting wires.

Related

Control Arduino Pins via ESP8266 Webserver

I want to program a simple Webserver with an ESP8266 but I want to connect the ESP8266 to an Arduino Mega. I want to connect a LED and a Sensor to the Arduino and control the LED and read the sensor data via the ESP8266 Webserver.
I am a beginner and dont want too complex solutions. It's just a simple school project.
For the Webpage I am sending just some HTML Code, I do not use Blynk or anything like that.
My question is how can I connect the ESP8266 to the Arduino and control it's pins?
There is a million ways to connect an ESP to an Arduino.
Without any shields or perihperals you can basically use any wired bus that does not require transceivers.
For example I2C or SPI.
With shields or peripherals you can use CAN, LIN, RS232, Ethernet, WIFI, Bluetooth, radio, optical and audio transmission... The list is endless.
You can of course read a sensor with the ESP so an Arduino Mega is not really necessary.

Use the Arduino Nano's serial interface to communicate with ESP8266 -- currently hangs

I have designed a ledstrip driver capable of receiving commands over UDP-IP. I initially worked with an Arduino MEGA, and currently I'm in the process of deploying the code in an Arduino NANO.
The Arduino NANO only has one hardware serial interface, unlike the MEGA, which has several. This forces me to disable the usual debugging through one of the Serial ports (by sending strings to the computer) and to reserve the one and only serial interface for the ESP8266. In short, I am connecting the ESP8266 to the TX and RX pins in the NANO.
I am aware that I could use the softwareserial.h library, but I'd like to avoid it if possible.
The following function sets up the Wifi object:
void wifi_setup(){
// Initialize serial for ESP module
Serial.begin(9600);
// Initialize ESP module
WiFi.init(&Serial); /* GETS STUCK HERE */
...
}
The problem is: the microcontroller gets stuck in the Wifi.init() function and never abandons it.
I am aware that the serial interface is connected to the USB port, and am suspicious this might be a problem. However, I have tried giving power to the NANO through the VIN pin instead of through the USB port, and it hasn't worked.
What am I doing wrong?
The best solution will be to write separate code for ESP8266 and Arduino Nano - or even only for ESP8266 (NodeMCU to make it easy). It will be much easier. But if you really want to do it in your way, i think ESP uses 115200 baud, and you've set it to 9600.

SIM900 module not responding on hardware COM port

I've got my sim900 module working with arduino by using their software serial library, however, I want to eliminate arduino from the equation and have serial communication directly to sim900 module.
I'm using putty as my terminal emulator. It's serial is configured to COM1 19200 8 N 1 the same as device manager configuration for this port.
I connect straight from hardware serial on my PCs motherboard into serial-to-ttl interface board which connects to sim900 module. The board has 4 pins - VCC GND TX RX. They're all connected to my sim900 hardware serial as follows: VCC=5V GND=GND TX=TX RX=RX (Yes I know that it's always actually TX=RX and RX=TX, but when I connect it that way my interface board doesn't blink any led to indicate a transfer whereas it does when I connect TX=TX and RX=RX). The switch on the module is set to hardware serial pins as well.
So the only thing that happens when I send AT commands such as AT or ATI and press enter is that puttys cursor comes back to the beginning of command that I typed. No response.
I'm thinking that I'm not doing something that the arduinos software serial port is doing when it sends commands to sim900.
Can anyone help please ? It's literally been days of trying different configurations with no results.
In that time besides getting sim900 working with arduino software serial I verified that the hardware serial port on my motherboard is working correctly and the interface board is working correctly as well.

Is it possible to use both external power jack and USB port with Arduino?

I have the Arduino UNO board and I want to know if it is possible to use both the USB connection (for exchanging data) and the external jack to power supply it.
I will use the following cable: http://ecx.images-amazon.com/images/I/41OMXaj5cPL.SY355.jpg with a AC-DC 5V adaptor in order to power supply the Arduino. However, I want to use also the USB connection in order to send some data from the computer.
Both will be connected at the same time.
In short, I want the Arduino to be able to run even if the computer is OFF and whenever I open the computer to send data to Arduino from USB connection.
Is this possible? Will the Arduino Uno board support it?
Yes. From the official Arduino website:
Power
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.
External DC power will override USB power if the Arduino detects it. [Source]
as other said, it is absolutely possible to have both usb and power jack plugged in.
but be aware that if you shut down your computer and turn it on after, when reading the usb port you'll restart the Arduino and might loose important data.
yeah both of them can be used. If you want to upload the code in arduino then simply use the usb cable otherwise keep it on adapter. it wont harm the device.
What I personally do is, I keep on plugging the adapter and remove the usb once I am done with uploading and then test it as normally the usb cable is quite small and I normally work on robots so I need long wires.
if you want just plugs it in, it's ok but Arduino board will chose one and usb has priority to other power source.
********* Very important :*****
if you are controlling other circuits, that are connected to an external power supply, with your Arduino and connecting it to your PC's usb, Arduino will have potential difference and it will cause current flow that will damage your PC and Arduino board. if you want to do such thing, you have to shield your Arduino board from your other circuits that you want to control and they have external power source. this could happen with optocouplers for digital ports, non signal analog ports with shield relays, and complex analog circuits for analog signals

Is it possible to use Arduino 2560's serial/USB communication without Arduino bootloader?

I have an Arduino 2560 and would like to send serial data to my PC. However, I am currently not using the Arduino Bootloader because I wanted to use a program that I wrote for an Atmega644 before (as far as I understood, one has to use the Arduino language when using the Bootloader?).
Does anyone know if what I am trying to do is possible with reasonable effort?
Connection to PC via 2560's serial0 does not depend on bootloader (if you plan connection when main program is running). You need 16u2 running to bridge 5V serial UART to USB or you can of course use any other option (e.g. MAX232 or so) to convert 5V UART to USB or RS232. But in case of RS232 double check baud rate error because of 16MHz crystal for particular baudrate.
2560 bootloader just implements firmware flash.

Resources