Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

Monday, 6 April 2015

ESP8266 wifi module testing with python on local server

ESP8266 wifi module.

As most of you would know is getting famous for its small size, easy to interface, and low cost availability of wifi for internet of things projects. :)

Well I bought this module in form of esp-07. They are all same expect in pin numbers or gpio available out side.

This are powered with 3.3v supply and also interface at 3.3v i/o .

To keep it simple people can get other links how to connect ESP to arduino or to pc directly.
I wanted to test this module to connect to my locally created server, So first I thought I would have to go to linux and create a tcp/ip code with socket API to test, sent from serial over wifi from module and receive on wifi of laptop and print on computer screen by this code. But Python saved me. (not an animal its a language easy to use and learn, learn it, it will help you easy your efforts to test things)


So this was my set up.

I try found a TCP server code in python and modified it to just print what ever it receives from ESP's serial input.

So I opened a tcp server on laptop A with its WLAN IP address and some port number you can use any but don't use dedicated port numbers such as 80 as they are used by other applications on you pc.
once you are done on server side.

setup you ESP module to connect to serial port monitor and connect it with AT commands to you wifi router or access point
now note your laptop A's IP address you used to setup you server.

as you know to connect to the server with TCP, AT command is.
AT+CIPSTART

so as it is shown in espressif wiki for all AT commands 
to connect to server:

AT+CIPSTART="TCP","xxx.xxx.xxx.xxx",xxx

here xxx.xxx.xxx.xxx all xxx are numbers  separated by dot(.)
and xxx is port number you assigned the server.

Once if its connects you get connect response from ESP on serial monitor or you get error on some problem.

if you are connected to Server that is it is connected then, to send data to server requires you to use 
AT command 

AT+CIPSEND

look at how to use it from this link. link to all at commands

here is a screen shot to my test although I made few mistakes giving commands still I have highlight correct once.

Enjoy your time with this new module. I will keep posting more things on it. Currently looking how to get to parse.com with this thing.It will open up new dimensions for me.

also this library could help you.arduin_ESP8266 library

Wednesday, 11 December 2013

CC2540 UART 0 alt1 setup

CC2540 UART 0 alt1 setup Instead of USB for CC2540 USB Dongle
this is setup for testing if the Uart works or not I have not connected arduino i have taken out chip and just used the board to make a UART bridge to test it with Btools.

I am working about 2 Months on a project that is under a professor. Project is a from NIF(National Innovation Foundation).
It is about same as a recently famous Tile Device (lost found or object locator) I call it object locator.
TI is based on similar technology developed based on Bluetooth that is BLE (Bluetooth Low Energy) or BLE 4.0
TI(texas Instruments ) have developed an SoC based on BLE . I am using CC2540 for similar application to Tile.
First the thing I wanted was to setup Dongle to UART so  Icould connect it to UART of Arduino as to make a independent Device from computer. In the Btool I saw the Communication (Rx/Tx Dump) so I had to first do bridging to a FTDI and setup dongle to uart connected to bridge and then test it to BTOOL.
 I wanted to use the same project HosttestRelease but wanted to use dongle as a network processor to Arduino to easily prototype the device to show it to the NIF.

So I had a PC setup for the Embedded Workbench after I used the software in my laptop(to TI people can the ble stack be used with other open source IDE's??) . In the project HostTestRelease,
In HAL>Target>CC2540USB>Config>hal_board_config.h
Line No 336 will be a #defined HAL_UART_ISR 0
set it to 1
just in next line #defined HAL_UART_USB 1
set it to 0

Now I wanted to not have a UART flow control or CTS and RTS cause I wanted to use it with arduino I don't want to waste pins of arduino's

for switching CTS and RTS pin off
go to NPI>npi.h file in that at line 77
there is a #defined NPI_UART_FC TRUE
setting all this will get your UART 0 to work on Dongle's I/O port's First and second pins P0_2(Rx) & P0_3(Tx)

There is one more setting to set the priority to UART 0 but I am not remembering where , I was something that I had to set to 0x00 to use UART 0 and that thing was not defined in the file it was in ISR's Method and was shown as error while compiling if in case u get it please post it in comments and I hope this post will help others cause I was also having trouble for 2 days because of no proper guidance like that in AVR atmel case ... Thank you all.