UART Over IP - How to? - networking

For a student project we have a device with a serial port (UART) wich communicate with a computer by wire.
As we want to make this system wireless (Device can be far far away from the computer), we had the idea to make the device communicate over IP ;
:
Device Serial port ==> UART/RJ45 converter ? ====> Router ===>Modem
Our question is mainly on the UART RJ45 converter. Does such device exist ? we saw some like this :
http://www.ecnmag.com/product-releases/2008/12/embedded-lan-module-connects-10/100baset-lans
But then how to adress the remote computer ? we would like to copy all traffic from the device and send it back to a specified port on our computer.
We also thought about changing the firmware of the router to OpenWRT to achieve this
Thanks in advance

... You could just get a raspberry Pi, which runs Linux and gives you low level access to a set of IO pins. Or use an Arduino with the Ethernet module. All of which are readily available and easy to procure. The Arduino and Ethernet modules are for sale at just about every Radio Shack these days.
Unless you have a need to communicate at speeds greater than around 100kbps, the above solutions should work fine.
Edit:
Note that there are Serial libraries available for the Pi:
https://projects.drogon.net/raspberry-pi/wiringpi/serial-library/

Finally I found a good solution thanks to you guys.
I ordered an Rasperry Pi which have IO pins as Wing Tang Wong said, including a set of Rx Tx pin functionning at 3,3v.
Our device work at 5v, so we are going to use a logical converter.
On the RPi we are going to use the ser2net package wich translate a serial input to a TCP/IP network signal ;)
Job done !
Thanks again

Related

ESP8266 connection to a Arduino Nano

I am trying to connect a WiFi module (ESP8266) to a "funduino" development board (Arduino Nano) but I have no success. Since I tried so much schematics I've found on the internet about the connection between them two, I kindly ask here if is anyone who succeed in "pairing" this two devices.
I am asking for the schematic and a functional source code.
Regards
The ESP-01 by default comes with nonOS SDK bootloader that communicated via AT commands, you can find the complete command set from Expressif here. This is designed for an MCU (like Arduino Nano) to use it purely as an WiFi module rather than using it as a stand-alone MCU (for which it will require NodeMCU SDK).
If you ever upload an Arduino sketch up to the ESP-01, it will erase the AT Command firmware.
Assuming your ESP-01 is still having the AT Command firmware. What #Ben provided is a sketch that allows you to type AT commands via the Serial Monitor to internact with the ESP-01, it is manual, and good for testing if ESP-01 is working (you type AT and press return on Serial Monitor, the ESP-01 will ack with Ok) but not practical as a real application. The minimum commands required to established an WiFi connection with ESP-01 is listed below.
AT+CIPMUX=1 - Enable single (0) or multiple connection (1) to the web server.
Multiple connection is a good option if you are repeatedly sending
out or reading data from the Internet.
AT+CWMODE=3 - Set WiFi mode: 1 is station mode (ESP8266 is client), 2 is AP mode
(ESP8266 acts like a WiFi router where your phone or PC can connect),
3 is AP+station mode (make the ESP8266 do both)
AT+CWJAP=“<your-ssid>”,”<your-pw>” - Connect to your WiFi. Provide your SSID name
and password inside the double qoutes.
AT+CIFSR - This returns the IP address of the module, indicating that it has
successfully connected to your WiFi router.
Once the WiFi connection is established, you can further communicate with the ESP-01 via the connection, like accessing a website for example:
AT+CIPSTART=0,"TCP", "www.example.com","80” - Start TCP or UDP connection. The
0 is the id of the connection.
AT+CIPSEND=0,16 - Command to tell the module data is ready to be sent. 0 is the
connection id, and 16 is the length of the data to be sent.
After this command, the ESP8266 will reply with the “>”
character to tell us that it will be waiting for the data to be
sent. If successful, the module will reply with “SEND OK”
GET / HTTP/1.1 - Send the http header, and other data, etc...
You can write your own sketch to automate those AT commands for interacting with with ESP-01 once you understand the AT commands required for establish a WiFi connection.
Here are two resources that I personally found extremely useful for doing more than connecting to WiFi.
STM32-ESP-01 Web Server - although this is for interfacing with STM32, the main difference is the pin assignment, so you should be able to port to Arduino easily.
MQTT via ESP-01
As for hardware interface, please noted that what #Ben provided is correct in principle, but you need to be aware that the ESP-01(ESP8266 to be precise) is a 3V3 MCU, so the connection is depended on what kind of host board you are using. If you are using Arduino Uno/Nano, both are having a 5V MCU, you will need a voltage divider (two resistors to drop the voltage to 3v3 before connecting to ESP-01) or a level shifter chip at least for the ESP-01 Rx pin to avoid the potential damage to the ESP-01.

How to connect Arduino with Internet?

I have gone through several links online but I have not found any appropriate solution to it. I am wondering if there is a way to connect an Arduino with WiFi without using any shield or any other external hardware. My laptop is connected to WiFi and the arduino board is connected to the laptop with an USB cable. I want to access/run the data for the Arduino using WiFi. Is there a way to do it?
Hope my query makes a sense.
Thanks.
Let's restate your question for clarity - you want to share the laptop's Internet connection (e.g. via WiFi) with the Arduino connected to the laptop with a USB cable, with no additional hardware?
Assuming I restated it correctly, the Arduino's USB connection provides a virtual "serial port" for communication. This means you can use an "IP over serial" solution for Internet access. One such common and widely supported solution is PPP.
However, programing the Arduino with IP over PPP stack requires significant amount of memory and is probably an overkill for whatever it is you're trying to do.
You're probably better off designing a custom-tailored protocol for the serial communication between the Arduino and a small gateway program you can program and run on the laptop.
If you're bent on a complex solution that provides full Internet access to the Arduino, the steps to achieve what you're after are:
Program the Arduino with a TCP/IP over PPP protocol stack, running on the serial port. You'll probably need an Arduino MEGA.
Setup the laptop to be a PPP endpoint on the Arduino's serial port. For a Windows machine you can refer to this page for information on how to do that.
Once the PPP link is up, you can setup the laptop's OS to share Internet access to the PPP link.

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

Implementing I2C slave with FT201XB via USB

I've been trying to test a FT201XQ USB-I2C breakout board: UMFT201XB-01, so I can connect it to a master device such as an Arduino and sniff what that device is sending through I2C.
To see the output of the slave device I have successfully configured a Virtual COM PORT by installing the D2XX drivers provided by ftdchip.com. I can open the serial port through puTTY and everything seems fine in that regard.
Then, i've loaded the "master_writer" example on my Arduino, which sends 1 byte at a time to an address (0x22 is specified in the UM201XB-01 datasheet as the default address).
Nothing seems to happen in the COM port that i've earlier opened. Do I need to configure/program the FTDI device in some way? In that case, how can I do it, in a general way?
UMFT201XB-01 board http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UMFT201_220_230XB.pdf
Thank you in advance, and sorry if this is a "noob" question : P

Programming Arduino's from a centralized location

I have 16 Arduinos that are in very tight spaces and hard to get to when I need to reprogram them with my FTDI cable. I would like to have or create some sort of centralized place where I can connect my FTDI cable, make some sort of selection (switch of some sort), which will then connect the pins my cable is on to the selected arduino.
Does anyone have any thoughts on how this can be accomplished? I've toyed with transistors, but that takes a lot of them and didn't quite work.
Are there any premade solutions that are out there that I have yet to find?
Thanks very much!
Here is a thought! TCP to Serial.
Sound complicated.
Not really.
Note from AVRDUDE's manual the following
For programmers that attach to a serial port using some kind of higher
level protocol (as opposed to bit-bang style programmers), port can be
specified as net:host:port. In this case, instead of trying to open a
local device, a TCP network connection to (TCP) port on host is
established. The remote endpoint is assumed to be a terminal or
console server that connects the network stream to a local serial port
where the actual programmer has been attached to. The port is assumed
to be properly configured, for example using a transparent 8-bit data
connection without parity at 115200 Baud for a STK500.
With this, One could place your Arduino's behind your choice of TCP to Serial Server. Which is available in several forms. Cisco has a gang TS (but that is expensive, unless used). lantronix (and others have single end point devices. But then for Linux, there is "Net2Ser" which can serve up all your ttyS (aka Serial/COM ports).
With the later you could use a raspberry or TP-Link TL-WR703N (
In the latest IDE 1.5.6r2 add one entry for each TCP-to-Serial Port to ./Arduino/hardware/arduino/avr/programmers.txt file. While replacing the IP and Port with corresponding values.
TCP2001.name=TCP 2001
TCP2001.communication=serial
TCP2001.protocol=stk500v1
TCP2001.program.protocol=stk500v1
TCP2001.program.tool=avrdude
TCP2001.program.extra_params=-Pnet:192.168.1.100:2001
TCP2002.name=TCP 2002
TCP2002.communication=serial
TCP2002.protocol=stk500v1
TCP2002.program.protocol=stk500v1
TCP2002.program.tool=avrdude
TCP2002.program.extra_params=-Pnet:192.168.1.100:2002
...
Additionally change "protocol" to "upload.protocol" the following line in ./Arduino/hardware/arduino/avr/platform.txt
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
to
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{upload.protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
With this you can use "Upload Using Programmer" with the selected programmer to send over TCP, rather then use the Upload.
That all said, it will only work on Linux.
avrdude: ser_open(): network connects are currently notimplemented for Win32 environments

Resources