Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:16 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : 4 $ WiFi Serial Transceiver Module

     Page 3 of 7    
Author Message
mindrobots
Newbie

Joined: 21/05/2014
Location: United States
Posts: 32
Posted: 06:01am 02 Oct 2014
Copy link to clipboard 
Print this post

Don't forget, you can join the PropellerPowered IRC chat even if you don't have your Micromite and ESP8622 talking together.........yet
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 01:19pm 02 Oct 2014
Copy link to clipboard 
Print this post

Hello again OBC... I loaded the code for your full featured IRC and seems to work well using uMite with TeraTerm. I used the IP address and it seemed to log in correctly. The only thing is that I get this...

BronedB!~BronedB@NewNet-DD7729D8.adsl.alicedsl.de PRIVMSG #PROPELLERPOWERED : 05:07:23

about every 10 seconds. Not sure what this is.... Any ideas?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 01:32pm 02 Oct 2014
Copy link to clipboard 
Print this post

  Oldbitcollector said  
The chat takes place on Saturday nights, 9pm EDT. irc.newnet.net #propellerpowered


What time is that in the rest of the world?
I am guessing that you are UTC -4

Jim
UTC +10 going to daylight saving time in a few days...

VK7JH
MMedit
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:59pm 02 Oct 2014
Copy link to clipboard 
Print this post

OBC, I did a AT+RST on my ESP and relaunched your IRC VT100 and all looked better. Seems to log on correctly... I get


:irc.newnet.ludd.ltu.se NOTICE AUTH :*** Looking up your hostname...
irc.newnet.ludd.ltu.se NOTICE AUTH :*** Found your hostname
irc.newnet.ludd.ltu.se NOTICE AUTH :*** No ident response; username prefixed with ~

*** LOGGED INTO CHANNEL: #propellerpowered ***

and then get

<BronedB> 06:42:54

every 9 or 10 seconds.

When I type 'my message, it shows up like I think it should (never used irc). Hopefully all is well....

To change my identity here, do I change the IRCNICK$ or the IRCNAME$?

Thanks again

Edited by viscomjim 2014-10-04
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 04:58pm 02 Oct 2014
Copy link to clipboard 
Print this post

iam so sorry , i fall into sleep and forget to kill my little Testprogramm which sends time all 5000 loops.
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 04:59pm 02 Oct 2014
Copy link to clipboard 
Print this post

change your Nick
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:55pm 03 Oct 2014
Copy link to clipboard 
Print this post

@plasma, could you explain how you did that?


edit...

the 5000 loop thing, I mean

Edited by viscomjim 2014-10-05
 
Ray B
Senior Member

Joined: 16/02/2007
Location: Australia
Posts: 219
Posted: 10:39pm 04 Oct 2014
Copy link to clipboard 
Print this post

Following is a link with an example of how to use the ESP8266 with an arduino but the important thing is to understand how the html/cmd instructions are required to drive things.
http://www.instructables.com/howto/ESP8266/

Also read the comments at the end of the instructable on issues like reflashing the units & power requirements.

Enjoy
RayB from Perth WA
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 09:50am 05 Oct 2014
Copy link to clipboard 
Print this post

little speedtest for
esp8266 and micromite & glb

the modul and the micromite together.

mode3 , tcpserver on port8080, micromite prints the incoming bytes to teraterm.
the black window is the glbasic windows which sends some bytes to the tcpserver.

sending is without pause but the result lags sometimes.

Edited by plasma 2014-10-06
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 11:45pm 05 Oct 2014
Copy link to clipboard 
Print this post

Hi ,

How to claculate the time and date from a ntp
Server package ?

I connect an ntp server to get the right time and date.
The ntp server sends some bytes but what should i do
To calculate the time or date?
Anyone knows or has a solution?
Thx
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 12:10am 06 Oct 2014
Copy link to clipboard 
Print this post

It may be simpler to attach a GPS module and get the data from that. However if you want some light reading on NTP then try these links. Good luck.
http://en.wikipedia.org/wiki/Network_Time_Protocol
http://tools.ietf.org/html/rfc5905
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 02:46am 06 Oct 2014
Copy link to clipboard 
Print this post

Hi Plasma, here is an article where instead of using the NTP service, which seems to be a pain, he did it a different way using his own server, I think.... hope it helps a bit.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 06:38am 07 Oct 2014
Copy link to clipboard 
Print this post

I am trying to emulate this project using the uMite and the esp8266. I have gotten everything to work and am successfully getting the data back from openweathermap.org.

However, the lucky arduino folks have a library that parses the json data for them and they just have to pick and choose what they want to read.

Here is what a typical return from openweathermap.org looks like as one long string...

{"coord":{"lon":-0.13,"lat":51.51},"sys":{"type":1,"id":5091 ,"message":0.1227,"country":"GB","sunrise":1412662312,"sunse t":1412702671},"weather":[{"id":521,"main":"Rain","description":"proximity shower rain","icon":"09d"}],"base":"cmc stations","main":{"temp":287.01,"pressure":998,"humidity":47 ,"temp_min":285.15,"temp_max":288.15},"wind":{"speed":7.2,"d eg":240},"clouds":{"all":40},"dt":1412696773,"id":2643743,"n ame":"London","cod":200}


I copied and pasted this into this and you can see how things are broken out.

My difficulty is this... As this is one long string, I can't set it to a variable name as it is longer than 255 characters. I am only able to display this because I am reading the comm port and displaying one byte at a time. What can I possibly do to "parse" the information I want to pull from this and assign it to a variable, numerical or string, ie...

country$="GB"
sunrise=1412662312
pressure=998
humidity=47
main$="Rain"
description$="proximity shower rain"
icon$="09d"
name$="London"

etc, etc...

A challenge indeed. If anyone needs the code that I am using to get this far, I can post it once I make it pretty, but it does work well.Edited by viscomjim 2014-10-08
 
Oldbitcollector

Senior Member

Joined: 16/05/2014
Location: United States
Posts: 172
Posted: 06:51am 07 Oct 2014
Copy link to clipboard 
Print this post

It almost looks like you could count the colons and know where you are in the string. I did this with the IRC client and it's working well.

8th colon is GB between " marks, 9th is sunrise.. and so forth..

Is this format consistent?
My Propeller/Micromite mini-computer project.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 07:25am 07 Oct 2014
Copy link to clipboard 
Print this post

OBC, I will take a look at different locations and see if the data comes in consistently. Thanks for the reply....
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 07:25am 07 Oct 2014
Copy link to clipboard 
Print this post

First i would choose another format, like XML.
http://api.openweathermap.org/data/2.5/weather?q=London&mode =xml

You could then use an array of strings and fill each string.
Do a detection for a "<" and a ">"
Every time you see a ">" you increase the index in the array.
Then ignore characters until you have a "<".
Then append each character to the indexed string.

Once the array is filled you can parse it line by line and extract the parts you need.
Each string will start with a node name so it is an easy test.

If you want to keep the json you can do something similar by detecting a "{" and a "}". I would also detect an opening " and use a , or } to end a line.
You would then get an array of strings that is very similar to the output of the online json parser.

Edited by TZAdvantage 2014-10-08
Microblocks. Build with logic.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 08:02am 07 Oct 2014
Copy link to clipboard 
Print this post

I will have to take a look at the xml format to see what it looks like when I get home. That sounds like it might be doable. I will also try the json one as you recommended to see if I can pull that off. Thanks for the advice!!!
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 07:35pm 08 Oct 2014
Copy link to clipboard 
Print this post

Hi ,
Viscomjim can you show me the source ?

 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 12:23am 09 Oct 2014
Copy link to clipboard 
Print this post

Hi Plasma, since this post I have switched to www.wunderground.com for the weather data. Here is my new code for that one. Please see that my API key is included in this program. You are welcome to try it a few times as it is good for 500 reads a day up to 10 per minute. However, if you decide to use this more, just get your own key. It is easy and free to sign up and get one. You will also notice my zip code in the api request (Z$). Go to www.wunderground.com and look at the api stuff they have there. It will explain all the cool things you can request.

Still working on a way to get the useful data out of the json return. I looked at the way Geoff is getting data out of the com port buffer from his GPS clock project and suspect that this might be a good way to attack this as there is a lot of data coming back, more that 256 limit on a string. Also notice the rx buffer has been increased to 4096 due to this.

Anyway here is the code, have fun making a weather station.

SERVER$="23.0.88.120"
PORTX$="80"

Open "Com1:115200, 4096" As #1
FLUSHBUF

PRINT #1,"AT+CWMODE=3"
PAUSE 100
GETSTRINGLONG

PRINT #1,"AT+CIPMUX=0"
PAUSE 100
GETSTRINGLONG

Print #1,"AT+CIPSTART="+Chr$(34)+"TCP"+Chr$(34)+","+Chr$(34)+SERVE R$+Chr$(34)+","+PORTX$
PRINT "AT+CIPSTART NOW"
PAUSE 1000
GETSTRINGLONG

Z$="GET /api/2b4e1c4572808d14/conditions/q/33773.json HTTP/1.1"+chr$(13)+chr$(10)+"Host: api.wunderground.com"+chr$(13)+chr$(10)
OUTPUTX Z$
PAUSE 1000
GETSTRINGLONG

Print #1,"AT+CIPCLOSE"
PAUSE 100
GETSTRINGLONG

END


Sub OUTPUTX (OUT$)
Print #1,"AT+CIPSEND=0"+Str$(Len(OUT$)+2)
Pause 200
Print #1,OUT$
PRINT OUT$
Pause 100
END SUB

'**********GETSTRINGLONG************
SUB GETSTRINGLONG
PAUSE 200
PRINT "BYTES IN LOC = ";LOC(#1)
C$=""
DO
C$=Input$(1,#1)
char = Asc(C$)
If char >31 Then Print C$;
If char =13 Then Print " "
LOOP WHILE LOC(#1)<>0
END SUB

SUB FLUSHBUF
DO:A$=INPUT$(1,#1):LOOP WHILE LOC(#1) <> 0
END SUB


EDIT...

There seems to be some extra spaces in a couple of lines in the code. I tried to edit but it won't update so look out for that...

This assumes that you already got your esp8266 connected to your wifi, as it remembers this connection after a power cycle, I don't do it again in this program. If you need info on how to get it going, Oldbitcollector did a wonderful instructable to show you how to do that, and it works great. HERE is the link to that information. I also posted some info in propellerpowered HERE on page 6.Edited by viscomjim 2014-10-10
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 03:17am 09 Oct 2014
Copy link to clipboard 
Print this post

In the 11th line of code, the one with AT+CIPSTART, there is extra space at Print and #1 and also in the word "SERVE R$" should be "SERVER$". Don't know why that happened during copy and paste.

Add a weather station to your project for $5.00 and some code. YEAH!!!Edited by viscomjim 2014-10-10
 
     Page 3 of 7    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025