![]() |
Forum Index : Microcontroller and PC projects : 4 $ WiFi Serial Transceiver Module
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
mindrobots Newbie ![]() Joined: 21/05/2014 Location: United StatesPosts: 32 |
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 StatesPosts: 925 |
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: AustraliaPosts: 6283 |
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 StatesPosts: 925 |
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 |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
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: GermanyPosts: 437 |
change your Nick |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
@plasma, could you explain how you did that? edit... the 5000 loop thing, I mean |
||||
Ray B Senior Member ![]() Joined: 16/02/2007 Location: AustraliaPosts: 219 |
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: GermanyPosts: 437 |
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. |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
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: AustraliaPosts: 935 |
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 StatesPosts: 925 |
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 StatesPosts: 925 |
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. |
||||
Oldbitcollector![]() Senior Member ![]() Joined: 16/05/2014 Location: United StatesPosts: 172 |
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 StatesPosts: 925 |
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: ThailandPosts: 2209 |
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. Microblocks. Build with logic. |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
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: GermanyPosts: 437 |
Hi , Viscomjim can you show me the source ? |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
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. |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
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!!! |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |