303WIFILC01

All that relates to the H/W
Post Reply
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

303WIFILC01

Post by Fernando Perez »

I have received a couple of 303WIFILC01 modules like the ones that Electroguard mentioned in their entry [Local Link Removed for Guests] .
I have read the library for arduino created by Maarten Pennings and I have tried to adapt it to Annex.
I still have a lot of work to do, I think that the huge tables that Maarten uses can be simplified, since with 7-segment modules we won't use more than 10 numbers and a few characters, but I wanted to tell you that the 303WIFILC01 is perfectly usable with Annex.

https://youtube.com/shorts/KZh0BYxIIec?feature=share

Code: [Local Link Removed for Guests]

' 303WIFILC01
colon = 4
noDot = 0

dim font(127)
for i = 0 to 127
  READ font(i)
next i  

dim remap(255)
for i = 0 to 255
  READ remap(i)
next i
  
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA &B00000000,&B00101000,&B00100010,&B01100011,&B01001001,&B00100100,&B01111110,&B00000010,&B00111001,&B00001111,&B00000001,&B01000010,&B00001100,&B01000000,&B00010000,&B01010010
DATA &B00111111,&B00000110,&B01011011,&B01001111,&B01100110,&B01101101,&B01111101,&B00000111,&B01111111,&B01101111,&B00001001,&B00001010,&B01011000,&B01001000,&B01001100,&B01001011
DATA &B00111011,&B01110111,&B01111100,&B00111001,&B01011110,&B01111001,&B01110001,&B00111101,&B01110110,&B00110000,&B00011110,&B01110101,&B00111100,&B01010101,&B00110111,&B00111111
DATA &B01110011,&B01101011,&B00110011,&B01101101,&B01111000,&B00111110,&B01110010,&B01101010,&B00110110,&B01101110,&B01011011,&B00111001,&B01100100,&B00001111,&B00100011,&B00001000
DATA &B00100000,&B01011111,&B01111100,&B01011000,&B01011110,&B01111011,&B01110001,&B01101111,&B01110100,&B00000101,&B00001101,&B01110101,&B00111000,&B01010101,&B01010100,&B01011100
DATA &B01110011,&B01100111,&B01010000,&B01101101,&B01111000,&B00011100,&B01110010,&B01101010,&B00010100,&B00101110,&B01011011,&B01000110,&B00000110,&B01110000,&B01000001,&B01011101 

DATA &H00,&H20,&H80,&HA0,&H04,&H24,&H84,&HA4,&H08,&H28,&H88,&HA8,&H0C,&H2C,&H8C,&HAC
DATA &H10,&H30,&H90,&HB0,&H14,&H34,&H94,&HB4,&H18,&H38,&H98,&HB8,&H1C,&H3C,&H9C,&HBC
DATA &H40,&H60,&HC0,&HE0,&H44,&H64,&HC4,&HE4,&H48,&H68,&HC8,&HE8,&H4C,&H6C,&HCC,&HEC
DATA &H50,&H70,&HD0,&HF0,&H54,&H74,&HD4,&HF4,&H58,&H78,&HD8,&HF8,&H5C,&H7C,&HDC,&HFC
DATA &H02,&H22,&H82,&HA2,&H06,&H26,&H86,&HA6,&H0A,&H2A,&H8A,&HAA,&H0E,&H2E,&H8E,&HAE
DATA &H12,&H32,&H92,&HB2,&H16,&H36,&H96,&HB6,&H1A,&H3A,&H9A,&HBA,&H1E,&H3E,&H9E,&HBE
DATA &H42,&H62,&HC2,&HE2,&H46,&H66,&HC6,&HE6,&H4A,&H6A,&HCA,&HEA,&H4E,&H6E,&HCE,&HEE
DATA &H52,&H72,&HD2,&HF2,&H56,&H76,&HD6,&HF6,&H5A,&H7A,&HDA,&HFA,&H5E,&H7E,&HDE,&HFE
DATA &H01,&H21,&H81,&HA1,&H05,&H25,&H85,&HA5,&H09,&H29,&H89,&HA9,&H0D,&H2D,&H8D,&HAD
DATA &H11,&H31,&H91,&HB1,&H15,&H35,&H95,&HB5,&H19,&H39,&H99,&HB9,&H1D,&H3D,&H9D,&HBD
DATA &H41,&H61,&HC1,&HE1,&H45,&H65,&HC5,&HE5,&H49,&H69,&HC9,&HE9,&H4D,&H6D,&HCD,&HED
DATA &H51,&H71,&HD1,&HF1,&H55,&H75,&HD5,&HF5,&H59,&H79,&HD9,&HF9,&H5D,&H7D,&HDD,&HFD
DATA &H03,&H23,&H83,&HA3,&H07,&H27,&H87,&HA7,&H0B,&H2B,&H8B,&HAB,&H0F,&H2F,&H8F,&HAF
DATA &H13,&H33,&H93,&HB3,&H17,&H37,&H97,&HB7,&H1B,&H3B,&H9B,&HBB,&H1F,&H3F,&H9F,&HBF
DATA &H43,&H63,&HC3,&HE3,&H47,&H67,&HC7,&HE7,&H4B,&H6B,&HCB,&HEB,&H4F,&H6F,&HCF,&HEF
DATA &H53,&H73,&HD3,&HF3,&H57,&H77,&HD7,&HF7,&H5B,&H7B,&HDB,&HFB,&H5F,&H7F,&HDF,&HFF

i2c.setup 13, 12    ' SDA and SCL connections on the 303WIFILC01 board

' brightness 1 to 8: 1 = min, 8 = max
brightness = 3
TM_init brightness 

while 1
  hour$ = left$(time$,2) + mid$(time$, 4, 2)
  TM_show hour$, colon
  pause 1000
  TM_show hour$, noDot
  pause 1000
wend  

END

' ----------------------
SUB i2cWrite(address, value)
  i2c.begin address
  i2c.write value
  i2c.end
END SUB

' ----------------------
SUB TM_init(brightness)
  if brightness = 8 then
    value = 1
  else  
    value = 16*brightness + 1  
  endif
 
  i2cWrite &H24, value
END SUB
  
' ----------------------
SUB TM_show(line$, dots)
LOCAL i, address, s$
LOCAL v1, v2, v3, v4, v5

  for i = 1 to 4
    s$ = mid$(line$, i, 1)
    v1 = asc(s$) AND &H7F
    v2 = asc(s$) AND &H80
    v3 = font(v1)
    v4 = v3 OR v2
    if (dots AND (1 << i) ) then v4 = v4 OR &H80      
    v5 = remap(v4)

    i2cWrite &H33+i, v5
  next i

END SUB
User avatar
Electroguard
Posts: 846
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 272 times
Been thanked: 320 times

Re: 303WIFILC01

Post by Electroguard »

Good job Fernando, the 0.8" display is a much nicer clock than the 0.56" display, and is even better now I'll be able to run my smartclock script to show time for 10 secs, then inside temp, outside temp, humidity and atmospheric pressure each for 3 secs, then back to time.

The huge tables are already included in the Annex TM1637 drivers, and maybe one day the TM1650 will also be able to access them, so no point duplicating them unless needing to use the TM alpha-numeric font (which I use on my TM1637 smartclocks to also scroll text reminders such as appointments and birthdays ticker-tape style, but that's more of a novelty than a necessity).

So thanks, cos now that you've already done drivers to make the display actually work, I can order a few more with some confidence.
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

Re: 303WIFILC01

Post by Fernando Perez »

Robin, when displaying numbers other than time, note that dot 2 is hardware redirected to the colon dot, so it's not possible to turn it on.
I am using dot 3 for temperatures, leaving a blank space to the left.
For atmospheric pressure, I use dot 1 for measurements greater than 999 hPa.
Add this to the code:

Code: [Local Link Removed for Guests]

' Dot display control
noDot = 0
dot1  = 2
colon = 4
dot3  = 8
User avatar
Electroguard
Posts: 846
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 272 times
Been thanked: 320 times

Re: 303WIFILC01

Post by Electroguard »

Thanks for the heads up Fernando.
On the TM1637s I was using the : colon as a dot (which didn't exist) so internal temp = eg: 23:5C and eg: 9:3c for external temp... so Capital C for inside and small c for outside. The colons don't flash when they are used as decimal points, only when displaying time.
So have you got Upper C and lower c defined ?
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 times

Re: 303WIFILC01

Post by Fernando Perez »

So have you got Upper C and lower c defined ?
Robin, I don't quite understand your question. What does it mean?

I have managed to reduce the size of the code if I limit myself to using numbers from zero to nine and white space.
Actually, it's the only thing I'm going to use it for, so I'm satisfied.

Code: [Local Link Removed for Guests]

' 303WIFILC01 (ESP8266) - Tested on Annex 1.44.2
' 
' Dot display control
noDot=0 : dot1=2 : dot3=8 : colon=4

' numbers from zero to nine, blank space and minus sign
dim font(11) = 252, 132, 186, 174, 198, 110, 126, 164, 254, 238, 0, 2

' SDA and SCL on the 303WIFILC01
i2c.setup 13, 12    

' brightness from 1 to 8 (1=min, 8=max)
brightness = 3
TM_init brightness 


' ********  DEMO  ********
TM_show " 226", dot3  ' Temperature
pause 5000
TM_show "1022", dot1  ' Pressure
pause 5000
TM_show " -84", dot3  ' Negative temperature
pause 5000

while 1  ' Clock
  hour$ = left$(time$,2) + mid$(time$, 4, 2)
  TM_show hour$, colon
  pause 1000
  TM_show hour$, noDot
  pause 1000
wend  

END

' ----------------------
SUB TM_init(brightness)
LOCAL value
  value = (16 * brightness) + 1  
  if brightness = 8 then value = 1
  i2cWrite &H24, value
END SUB
  
' ----------------------
SUB TM_show(line$, dots)
LOCAL i, value, remap

  for i = 1 to 4
    value = asc(mid$(line$, i, 1)) - 48  ' 0 = ascii 48
    if value = -16 then value = 10       ' blank space
    if value = -3 then value = 11        ' minus sign


    remap = font(value)

    select case dots
      case colon
        if i = 2 then remap = remap +1
      case dot1
        if i = 1 then remap = remap + 1
      case dot3
        if i = 3 then remap = remap +1
    end select
      
    i2cWrite &H33 + i, remap
  next i  

END SUB

' ----------------------
SUB i2cWrite(address, value)
  i2c.begin address
  i2c.write value
  i2c.end
END SUB

Post Reply