How many Software Serial can use with arduino nano, uno and leonardo? - bluetooth

I am trying to use multiple serial ports with this arduino models.
I am planning to use 1 ESP8266 module and 1 Hm-10 BLE module.
I want to connect webserver via ESP. But I have to send my ssid and wifi password to esp.
For this situation I planned write a android application that sends ssid and pass to our arduino and esp module.
Is it possible?
Best Regards.

I've done some research about this and I only found two answers at the moment:
Native Arduino's Serial Ports + 1: Using the library SoftwareSerial (https://www.arduino.cc/en/Reference/SoftwareSerial) to add a "second" serial to listen. So you can use common Arduino's serial ports and other custom defined digital pins (2 pins) to simulate a native Arduino's serial port. An example using BT with ESP8266 can be found here: http://www.instructables.com/id/Arduino-Dual-Controlled-RC-Car-Bluetooth-and-WiFi/step2/The-Connection/
As many devices as suported by your hardware configuration/specifications: Using the same serial port to control several devices with the same baud rates and then you must choose which one you want to listen at a time. With some code you can wait for a variable to be setted (with BLE) and when it's done change to listen just the other (ESP8266).
There is an example combining this two answers that may help you looking for the example "Two Port Receive" in the link I provided before about SoftwareSerial library.

Related

Arduino HC-05 Master/Slave

I am trying to be able to click a button on a tablet i have, and it sends a message to a master Arduino. The master Arduino then sends a message of to 4 slave devices, which switches on a relay. So far I have already been able to connect a HC-05 to an android and switch a relay on from that same Arduino but, now i need to expand it. I have about 10 HC-05 modules and i would like to use just them. Any help will be appreciated. I currently have pinched parts of the code from this website.
http://www.instructables.com/id/Remotely-Control-LED-using-HC-05-Bluetooth-Arduino/?ALLSTEPS
Thanks
Ben
I recommend looking into AT commands for the HC-05. They will allow you to set the connected device and send information to that specific device (which would permit the switching between slaves). I also go through basic switching with the HC-05, a relay, and an Arduino Uno on my blog.
https://engineersportal.com/blog/2017/11/15/bluetooth-home-automation-light-bulb-switch-using-an-hc-05-a-relay-and-arduino

Can I connect 2 RFID card readers to one arduino?

I am looking for connecting to ADAFRUIT RFID PN532 readers to one arduino,
I think its possible since I2C was for that, but how can i modify the code (Which is already in RFID ADAFRUIT LIBRARY) two access through the both readers at one instance ?
No, you can't connect two Adafruit PN532 shields on the same I2C bus. The problem is that you can't change the peripheral address of the PN532. Thus, both PN532 NFC chips would respond to the same address and you can't control which of the two shields you communicate with.
However, you may be able to separate the two boards
by using an I2C multiplexer that switches between the two boards, or
by using the SPI option of the PN532 shields. In SPI mode you have an additional chip-select PIN that you could wire to separate PINs of the Adruino. You could then address a specific PN532 shield using those chip-select lines. However, you would need to port the PN532 library to SPI communication.

Ethernet + Serial port in Linux

I want to implement a driver in Linux, that has a Ethernet stack but the data going out on hardware will be a serial port. Basically, I want to register my serial port as a Ethernet driver. Does anyone have any idea if this is possible?
I want to be able to push IPv6 and/or UDP packets out of the serial port and in a similar way receive the packets via a serial port and pass it up the Ethernet stack.
I do not want to use the solution of serial-to-ethernet convertors(external hardware that convert a serial port to a ethernet port) but have that in my PC itself.
I tried PPP over the serial port and it works well. I am also told that I can do FTP, HTTP etc using the PPP. Reference to this - http://www.faqs.org/docs/Linux-HOWTO/Serial-Laplink-HOWTO.html
I have tried to hack the code from a RealTek Ethernet driver with a serial driver but not able to gain much success. Rather I do not know the stack of either to actually do anything meaningful. Any advice, guidance or tutorials would be helpful.
Thanks
Aditya
You need to get back to de basics on networking, the way I understand you question is: "I have a serial port and I want to use is an Ethernet link". Sorry to crush your dreams but you don't have the real hardware to do so, I'll elaborate on it.
A serial connection is a physical connection that requires 3 wires (at least) tx, rx and ground. On the logical side you have an IC that coverts binary data into signals that are represented by discrete voltage ranges.
Ethernet is a layer 2 protocol, the layer 1 is provided by the technology used to transmit the signals (coax, up, fiber etc.) As you might see by now, you need a different set of hardware to convert the logical Ethernet frames into a stream of digital numbers, in fact this is call framing.
Since Ethernet has been an easy to use protocol it has been implemented as e preferred protocol for many network operators, of course one of the biggest is PPPoE where you have a PPP session over an Ethernet link. Of course this won't work with your example neither since you're trying the opposite.
If you're just learning and have all the time in the world you can attempt to write your own Ethernet framer over serial lines. This means you need to implement IEEE802.3 into the driver and then you need to serialize the data to push it as a stream of bits over the serial line. Of course note the following drawbacks:
Your driver won't be able to fully support Ethernet, you need some support at hardware level to implement some signaling (example, auto negotiation, CSMA/CD, etc)
You driver will be pretty much useless unless you back in time where 115.2kbps is top speed in data transfers
IMHO there are more exciting projects that you can pick up in the networking field for device drivers. You can for example attempt to buy a NIC and develop the device driver for it from scratch and you can optimize certain areas. Finally, remember that most of the Ethernet implementations are now done in hardware so you don't have to do anything but filling a few registers on the MAC and voila!
SLIP and PPP do already what you want.

Firmata over Bluetooth on Arduino?

I have Firmata working fine on an Arduino Uno, communicating over cable USB to Processing.
I want to get rid of the cable, and run the connection over Bluetooth transport (with a BlueSMIRF module). I am unclear on what I need to do to Firmata to tell it to use the BT module rather than the (unconnected) USB cable interface. In particular, do I need to hack Firmata itself to add initialization code which is
specific to the BT module I'm using, or
more generally, needed to tell Firmata to use a port other than the cabled USB?
Thanks
D
I am NOT very good in Firmata, but as i know, Firmata (on arduino) uses 'Serial' (pin 0 and 1, also aka as TX,RX) to communication with the Host. So, if u want to use a BT module to replace your USB cable on the arduino, hack the Firmata to use other pins, other connect the BT to pin 0 and 1.
You have to upload standard firmata with baud rate changed to 9600 inside the ino file (or test with other speed rate) and then connect BTooth TX>Rx(uno RX) and the bt RX>Tx(uno TX) as said in the previous post ,testing it with arduinoCommander worked like a charm!Arduino uno rx tx are pin0 and pin 1.also have it powered not from usb pc but external source cause having the BT ontop while on usb could mess up thing (in general disconnect the ground from BT module while uploading sketches).
All you have to do is make sure the USB is connected only when you are uploading your sketches to the arduino and then have the BlueSMIRF connected when you are ready to actually run the Arduino code. This way they will both use the default hardware serial port and you should not have to modify any code.
You could try and use SoftwareSerial.h in the Arduino to emulate another serial port but I have found that to be problematic.
Just connect Bluetooth to the Rx Tx pin and upload same standard firmata. Then pass command over bluetooth which you were passing over usb cable....it wil work.

Serial communication via scilab on linux

I am trying to use scilab for a project and I need to pass on some values to a robot via a serial port.
I had done this successfully on Matlab. I have ported almost everything to Scilab now but I don't know how to pass those parameter through serial port.
On the Sclilab site there are some modules, but they only work under Windows
http://atoms.scilab.org/
I am the maintainer for the Serial Communication toolbox in Scilab. This works on Linux as well. You can find it here: http://atoms.scilab.org/toolboxes/serial. This is fairly easy to use- it has functions to establish communication with the serial port, to read from and write to the serial port, and to terminate communication with the serial port. Please let me know about any feedback or questions you may have. Thanks.

Resources