Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Weatherstation
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog
View previous topic :: View next topic  
Author Message
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5006
Location: Holland

blank.gif
PostPosted: Mon Jan 25, 2016 10:15 am    Post subject: Reply with quote

Hi Ben,

Great work Ben! Thanks for sharing. Nice fonts are included Very Happy

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Jan 25, 2016 5:25 pm    Post subject: esp8266 shield Reply with quote

We found all hardware to build the weatherstation. At CE Chinese Electronics.



Display, ESP8266 shield for Arduino Uno or Mega, a connector with long pins and an Arduino Mega 2560.



This is the ESP8266 shield.



With a FT232 breakout board you can connect your PC to the RX and TX of the ESP8266.
TX from FT232 to RX of the ESP8266 shield, RX from FT232 to TX of the ESP8266 shield.
That way you can upload the nodemcu weather firmware in the shield.
Press USER and RST to start the bootloader and upload the weather file for the nodemcu
The Arduino Mega is used to power the ESP8266 shield. RX and TX are still not connected.



Made a small PCB with the BC517 darlington and the two resistors for the reset of the nodemcu

On this Esp8266 board serial port 1 is used to exchange information from the esp8266 to the Arduino Mega.
You will have to power the Arduino Mega through its power-jack, or like we did to test, use an Accu-pack.
The ESP8266 can not drive to Arduno Mega RXD and the CH340/FT232 to the outside world (the USB-connector)

On the ESP8266 only the RXD switch is put to ON.



Because COM1 / serial port 0 /RXD is used, we had to change the Bascom-AVR software a bit, using only one COM-port instead of two.

Have fun
Ben Zijlstra
Theo Kleijn

Edit: one typo in the bas-file. Have uploaded a new bas-file. Typo at location Humidity / Pressure.


Last edited by bzijlstra on Fri Jan 29, 2016 3:01 pm; edited 2 times in total
Back to top
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Mon Jan 25, 2016 5:40 pm    Post subject: Reply with quote

That dual row connector with long pins is a real good catch. Can you supply a link ? "CE Chinese Electronics" didn't make much sense for the browser Confused

Nice work !

Nard

_________________
Bascom AVR ver 2.0.8.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Jan 25, 2016 5:51 pm    Post subject: CE - Chinese Electronics... Reply with quote

The long pin double row is a connector for the Raspberry...

And with CE Chinese Electronics I mean banggood. On a lot of their boards a CE sign.

Have fun
Ben Zijlstra
Theo Kleijn
Back to top
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Wed Jan 27, 2016 6:05 pm    Post subject: Reply with quote

Thanks Ben ! I ordered a few: it will save me a lot of time, next time I use one.

For an earlier project I removed the header of the GLCD and replaced it with the one attached. Comes from Banggood as well.

Nard

_________________
Bascom AVR ver 2.0.8.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Jan 27, 2016 6:26 pm    Post subject: Dual row pin... Reply with quote

Oke. With the Raspberry duo row pin connectors I am using, you don't even have to solder them. Just plug and play. Four pins extra.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Jan 31, 2016 8:39 pm    Post subject: Reply with quote

If you want the windbearing in characters, instead of degrees add this to the code

Code:
Dim Nsew_value As Single
Dim Nsew As String * 4

Call Lcd_text( "Windbearing:" , 5 , 272 , 2 , Crimson , Black , 1)
Nsew_value = Val(info(8))
Select Case Nsew_value
      Case 0 To 11.25 : Nsew = "N"
      Case 11.26 To 33.76 : Nsew = "NNE"
      Case 33.77 To 56.27 : Nsew = "NE"
      Case 56.28 To 78.78 : Nsew = "ENE"
      Case 78.79 To 101.29 : Nsew = "E"
      Case 101.3 To 123.8 : Nsew = "ESE"
      Case 123.9 To 146.4 : Nsew = "SE"
      Case 146.5 To 169 : Nsew = "SSE"
      Case 169.1 To 191.6 : Nsew = "S"
      Case 191.7 To 214.2 : Nsew = "SSW"
      Case 214.3 To 236.8 : Nsew = "SW"
      Case 236.9 To 259.4 : Nsew = "WSW"
      Case 259.5 To 282 : Nsew = "W"
      Case 282.1 To 304.6 : Nsew = "WNW"
      Case 304.7 To 327.2 : Nsew = "NW"
      Case 327.3 To 349.8 : Nsew = "NNW"
      Case 349.9 To 360 : Nsew = "N"
End Select

Tempstring = Nsew
Windbearing = Space(4)
Templen = 5 - Len(tempstring)
Mid(windbearing , Templen) = Tempstring
Call Lcd_text(windbearing , 200 , 256 , 1 , Yellow , Black , 1)
 


Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Tue Feb 09, 2016 4:05 pm    Post subject: Finishing touch.... Reply with quote

Have made a case for the weatherstation. Sources can be found at

http://www.thingiverse.com/thing:1328045










Have fun
Ben Zijlstra


Last edited by bzijlstra on Thu Feb 11, 2016 3:09 pm; edited 1 time in total
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5006
Location: Holland

blank.gif
PostPosted: Wed Feb 10, 2016 10:03 am    Post subject: Reply with quote

great work. A project deserves a good case. It looks just great now.
_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Feb 17, 2016 1:13 am    Post subject: Different colors and locations on display Reply with quote

We made a version of the weatherstation with two different locations, "HOUSE" and "BOAT". Alternate displaying them on the display.
Blue seems to be a nice background for the display with the weatherinfo at the boat, and a black background at the house.

Because of the 65535 colors you can choose of, it is difficult to make a set of matching colors. So we used an adapted colorpicker, published here before



This is one of the screens we designed



We did want to use the same set of icons, with the black background, so copied the subroutine for displaying BGC-images, and made a small change.
The background of the icons will have the same color as the background of the complete display.

Code:

'*******************************************************************************
' Lcd show BGC File  X Start  Y Start
' Important that you first RESTORE the image before calling this sub
'*******************************************************************************
Sub Lcd_show_bgc_spec(byval Xoffset As Word , Byval Yoffset As Word)
   Local Ysize As Byte , Xsize As Byte
   Local Imagesize As Word
   Local L As Word , Pixel As Byte ,
   Local Pixelword As Word , Prevpixel As Word , Repeat As Byte
   Local X1size As Word , Y1size As Word , Yss As Word

   Read Ysize                                               'Read the first 4 bytes from the BGC, this contains info about the image
   Read Xsize
   Read Imagesize                                           'Byte 3&4 contains the image size
   X1size = Xsize + Xoffset
   Y1size = Ysize + Yoffset
   Decr X1size

   Call Lcd_set_window(xoffset , Yoffset , X1size , Y1size)
   Rs_disp = 1
   Do
      Read Pixel                                            'Read the value for the pixel
      If Pixel = &HAA Then                                  'BGC file is rle coded &HAA represents this, the byte after &HAA is the number of times that the byte before &HAA wil be repeated
         Read Repeat                                        'Byte after &HAA contains the number of times to repeat
         Repeat = Repeat - 1
         For L = 1 To Repeat                                'Loop the repeat
           ' Data_disp = Rgb16_high
           ' Data_disp_low = Rgb16_low
            !cBI Port_wr, Wrpin                             'Port_wr, Wrpin                                'WR Pin
            !SBI Port_wr, Wrpin                             'Port_wr, Wrpin
            Decr Imagesize                                  'Decrease the bytes still to be processed
         Next L                                             'Next repeat loop
      Else
         Rgb16 = 0
         If Pixel = &H00 Then
            Rgb16_low = Low(background_color)
            Rgb16_high = High(background_color)
         Else
            If Pixel.0 = 1 Then Rgb16_low = Rgb16_low Or 10    'Blue
            If Pixel.1 = 1 Then Rgb16_low = Rgb16_low Or 21
            If Pixel.2 = 1 Then Rgb16 = Rgb16 Or 288           'Green
            If Pixel.3 = 1 Then Rgb16 = Rgb16 Or 576
            If Pixel.4 = 1 Then Rgb16 = Rgb16 Or 1152
            If Pixel.5 = 1 Then Rgb16_high = Rgb16_high Or 32  'Red
            If Pixel.6 = 1 Then Rgb16_high = Rgb16_high Or 72
            If Pixel.7 = 1 Then Rgb16_high = Rgb16_high Or 144
         End If
         Data_disp = Rgb16_high
         Data_disp_low = Rgb16_low
         !cBI Port_wr, Wrpin                                'Port_wr, Wrpin                                'WR Pin
         !SBI Port_wr, Wrpin                                'Port_wr, Wrpin
         Decr Imagesize
      End If
   Loop Until Imagesize = 0                                 'Do until all bytes are processed
End Sub


Notice this part in the code

If Pixel = &H00 Then
Rgb16_low = Low(background_color)
Rgb16_high = High(background_color)

So the same set of icons can be used, the background color of the icons will match the background color of the display.

The code for the ESP8266 with more than one location will be published later on. We have added a Keyword LOCATION and in the main code the proper display colors are used for this location (blue for boat).

Colors all depend on the color of the casing you use, here some pictures of the weatherstation in a white casing.





Have fun
Ben Zijlstra
Theo Klein
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1192
Location: SYDNEY

australia.gif
PostPosted: Wed Feb 17, 2016 4:00 am    Post subject: Reply with quote

Nice Case Ben!

How much of a roll does it take to make a case like that?
Have been thinking about 3D printing but have no idea of what it will cost to make cases like that
so if I know how much you used I can get a good idea of costs.

Regards Paul
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Feb 17, 2016 8:52 am    Post subject: Cost casing Reply with quote

Hi Paul

The case has three parts. Bottom, middle and top.
Total weight is 83 grams. A roll of filament is between 20 and 25 euro for 1000 grams.
Costs for the case is 2,75 euro.

It takes 4,5 hours to print.

Am using a DIY 3d printer for two years now.
Prusa I3. Costs about 450 euros.
The blue case has been made with it.
The white case has been made on an Ultimaker 2, extra fine, taking double time, but the result is very nice.

For design I use freeware OpenScad and to 3d print I use freeware Cura.

My 3d printer is almost every day printing while I am programming in Bascom.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Plons

Bascom Member



Joined: 24 May 2005
Posts: 434
Location: Hilversum - The Netherlands

netherlands.gif
PostPosted: Wed Feb 17, 2016 11:53 am    Post subject: Reply with quote

This project re-defines home-made Smile
Very nice work, Ben.

_________________
Bascom AVR ver 2.0.8.1
ProtectedParallelPortProgrammingDongle: http://www.aplomb.nl/TechStuff/PPPD/PPPD%20English.html
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel"
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Feb 21, 2016 2:49 pm    Post subject: Finishing project... Reply with quote

We got to put an end to this project and go to the next project...

We have send a complete weatherstation to Mark Alberts, for all his work he is doing for Bascom-AVR and Bascom-8051



This one has a laser cut frontpanel with text and a laser cut foil to make it more clear. 2 mm oversized, looks nice.

Got some small tips and tricks

Now in the call to eventcaster.nl V1 is used. If you got your esp8266 programmed, try V2. You will get the weatherforcast with moonphase, sun up and sun down, the forecasts from yesterday, today and the next 5 days. Lots of extra information.

You can also have more than one location on your display. You can get forecasts of more locations. By adding some lines in the esp8266 software.

If you need help, just drop a question here...

Oke. Have fun
Ben Zijlstra
Theo Kleijn
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1192
Location: SYDNEY

australia.gif
PostPosted: Mon Feb 22, 2016 9:32 am    Post subject: Reply with quote

Very Nice and great gift well deserved
I would have also put "The home of Bascom" on the bottom

Regards Paul
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM Project Blog All times are GMT + 1 Hour
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum