PDA

View Full Version : Serial WiFi module



Art
- 12th November 2015, 18:04
Hi Guys :)
I ordered a couple of these cheap all in one wifi modules today:
http://www.ebay.com.au/itm/Serial-WiFi-Module-ESP8266-remote-serial-Port-WI-FI-wireless-module-ESP01-/331639206737?hash=item4d373cb351:g:uXQAAOSwm8VU0BG p

I’m wondering has anyone here used them, and perhaps have any code to donate?
I’d like to start with acquiring time from a time server and writing software for the bigger platform to set it’s system clock.
Assuming it’s a pic or Atmel on the board, I guess I’ll find out when it arrives.

Does anyone have another wifi module to suggest for a PBP pic?
There doesn’t appear to be a specific forum section for wifi.
Cheers, Art.

Heckler
- 12th November 2015, 20:03
no time for a lengthy reply right now, Art, but I have played with them a bit.

Check out youtube and search on "allaboutee" and/or "esp8266"


some are working to get a version of BASIC working on them...
http://www.esp8266basic.com/

I'll post more this evening.

Art
- 13th November 2015, 05:57
Nice :) Looking at other threads that were put in here for opening this section,
starting out with zero networking experience is going to be a pain in the bum :D

I aim to get one connected to a serial port of an old Commodore Amiga,
with software on the Amiga side to update it’s system clock from the internet.
Supposing the chip in the module can do the work, and simply send the time to
whatever the big computer is, so long as the wifi module doesn’t have to do anything else.

Heckler
- 13th November 2015, 06:11
Hi Art,

These esp8266 modules are NOT 5V tolerant! you must use 3.3v

I highly recommend one of these... (also available on Tindie) as it makes it much easier to program and has a breadboard friendly header strip to access the pins of the module. Has a spot for the module to plug into it, a 3.3v regulator on board, reset button and jumpers to put it into flash mode, etc

http://www.ebay.com/itm/CP2102-USB-To-UART-converter-Supports-ESP8266-/262000791994?hash=item3d0076d1ba:g:BnQAAOSwBahVAS3 9

Since the pin spacing does not fit a typical breadboard you may need to buy or build one of these...

8093

I've seen some of your prototyping work so should be no problem for you :-)


There are several ways to go as far as programming, first you can choose to use the native OS that comes with them which responds to old school modem like commands that begin with "AT"

or you can load a different OS, for example one that is very popular is NODEMCU and then program in a language called LUA

or you could try the BASIC (I have not)

I have mostly had success with the LUA but I am terrible at anything other than BASIC so it has been a real struggle.

there is a pretty nice tool called ESPLORER...
http://esp8266.ru/esplorer/

to load the NODEMCU OS I have used esp8266flasher.exe
which allows you to flash a different OS like NODEMCU

these little modules are amazing!! some have shown using them at a range of >1000 ft in ideal conditions.

using the LUA language I have been able to read a ds18b20 temp sensor connected directly to the module (with pull up resistor) and generate an email sent directly from the module via my email provider

Lots of possibilities, not enough time (or knowledge)

good luck

HenrikOlsson
- 13th November 2015, 07:30
If you are looking for PBP code to drive them via the "stock" AT commands I did a very short test/example in this post (http://www.picbasic.co.uk/forum/showthread.php?t=19420&p=129711#post129711). And as I'm sure you've figured out by now there's no PIC or AVR on the module. The chip is the ESP8266 which is complete SoC with processor, TCP/IP, Wifi and everything.

/Henrik.

MichelJasmin
- 13th November 2015, 16:17
Some more PBP code: http://www.picbasic.co.uk/forum/showthread.php?t=20178
and a (stupid?) project: http://www.picbasic.co.uk/forum/showthread.php?t=20083

For time service the easy way I found was to put a dead simple web page on my Windows Home Server

default.aspx:


<%
response.write("*" & Format(now, "yyyy-MM-dd HH:mm:ss") & "J")

select case Format(now, "ddd")
case "Sun"
response.write("1")
case "Mon"
response.write("2")
case "Tue"
response.write("3")
case "Wed"
response.write("4")
case "Thu"
response.write("5")
case "Fri"
response.write("6")
case "Sat"
response.write("7")
case else
response.write("0")
end select
response.write("*" & VbCrLf)

'response.write("*" & Format(now, "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 1, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 2, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 3, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 4, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 5, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 6, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")
'response.write("*" & Format(dateadd("d", 7, now), "yyyy-MM-dd HH:mm:ss ddd") & "<BR>")

%>



Web.Config:


<?xml version="1.0"?>
<configuration>
<appSettings/>
<system.web>
<compilation debug="true"/>
<customErrors mode="Off"/>
<authentication mode="Windows"/>
<identity impersonate="true"/>
<httpRuntime enableVersionHeader="false" />
</system.web>
</configuration>



and the response is:

*2015-11-13 10:05:40J6*
The "J" in the response means "Jour" (french word = "day").

If you find de way to call a SNTP server with PBP please share!

Art
- 13th November 2015, 18:45
Thanks for the replies :)
I don’t have too many rock solid goals with it as a project, but getting time will be essential. This is where I can get help from someone who has done time and weather.
It was C++ he used if I recall correctly, and extra pins on the chip were used to drive an LCD to print it on which was pretty cool.

This video was sent to me personally, but I have checked it’s ok to share relating to my projects:
https://www.youtube.com/watch?v=WXX1ZVvJq6E&feature=youtu.be

In fact, the fellow that wrote it wanted to get my LCD graphics working with it, and I shared the code,
but he gave me the impression there is little RAM left on the chip for that.

ps. It looks like that one int he video can take 5V supply, but I got the cheaper one :D

Heckler
- 14th November 2015, 23:02
I forgot to mention that you can also, apparently, use the Arduino IDE to program them in the C-like language that Arduino uses.
(never tried it though)

Here is one way of getting time using the NODEMCU OS and Lua code...
8094

Art
- 15th November 2015, 04:26
Thanks for the extra code. I can go a fair way with just getting the time
and talking serial.
These old Amiga computers, their RTC batteries leaked,
and some leaky batteries damage the RTC as well,
but the system clock still works when the computer is running.
So just a simple thing like telling the computer the time and date
at bootup is very practical.

Heckler
- 15th November 2015, 06:59
Hey Art,

I've been reading quite a bit over at esp8266basic.com and I am actually quite impressed!

I think I am going to give BASIC a try on my esp8266 module.

The command documentation seems to be a bit behind so check out the forum and read the "NEWS" topic as he has announced a couple of new commands there. And ongoing development seems to be quite active.

You now can read an ds18b20 temp sensor ("temp" command). Write to an I2C OLED display, etc.

Fun Stuff!

Art
- 16th November 2015, 12:42
Nice :) I’ll check it out!
Mine have arrived, but now thinking I might as well buy the unit with the supply and USB-serial converter on board
like the unit in the video. Then use the bare ones I have when it comes to use in a project.

Heckler
- 30th November 2015, 06:05
Hi Art,

If you haven't had a chance to check out the ESPBASIC yet... well,

with this simple bit of ESPBASIC code

memclear
cls
button "GetTime" [GetTime]
button "Exit " [Exit]
wait

[GetTime]
print time()
bla = time()

dw = mid(bla,1,3) 'dow
mh = mid(bla,5,3) 'month
dt = mid(bla,9,2) 'date
hh = mid(bla,12,2) 'hour
mm = mid(bla,15,2) 'min
ss = mid(bla,18,2) 'sec
yr = mid(bla,21,4) 'year

print dw
print mh
print dt
print hh
print mm
print ss
print yr
print
print "Heap"
print flashfree() 'how much mem left
wait

[Exit]
end

it will get you the date and time (not sure from where, yet (i have asked)) but it seems to be accurate.
It will spit it out both on a webpage and to the serial port of the ESP module at 9600 baud.

you can modify the espbasic code and use "serialprint" instead of "print" if you just want it to go to the serial port.

it really helps to start a terminal window and connect it to the usb serial port for your module when running the basic as there is a lot of feedback sent to the serial port as well as what ever web page the module sets up.

It should be no problem at all to have your PICBASIC code receive the serial data from the esp module and act on it.
you don't really have to use the web page features of espbasic if you don't want to (other than to get your code into the module and truoble shoot and test it. then depending on how you write your code the module will just interact with your PIC as you desire via the serial port of the module.

I have found the ESPBASIC to truly be easy to learn and interact with because of the unique fact that all your development is via a webpage served up by the module itself.

you can connect to the module acting as an access point or have the module connect to your home wifi and access it's ip address.
it will tell you what ip it gets from your home network via the serial port output as it boots up, so connect up a terminal program to view it.
give it a go and ask questions or send me a pm if you need more help.

Heckler
- 6th December 2015, 04:50
Hi Art,

Just an update on the espbasic.
They have now updated the Network Time function to allow you to specify what ever time zone you want, daylight saving on/off and you can request just the part of the time string you want to access.

http://www.esp8266basic.com/functions-timedate.html

dwight