Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 17:56 02 May 2024 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 : Server Room Temperature Logger

     Page 1 of 2    
Author Message
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:49pm 13 Nov 2014
Copy link to clipboard 
Print this post

Hi
Here is a little project I have been working to monitor the temperature in our server room at work. We hardly ever go in there so I thought we better keep an eye on the cooling.
I chose to display the temperature and some other info on a 20x4 LCD this will mounted in the server rack. Should a fault occur the Micromite will send an email to me every 4th cycle (this is a user setting). I am using 15 minutes at present so i get an email every hour. The temperatures are uploaded to www.thingspeak.com every 15mins. To use this you will need to create a free account @ www.thingspeak.com and put your api key in the relevant place. To connect to the internet I am using an ESP8266 Wireless module these are really cheap and easy to use. Put your Wireless SSID and password in the relevant place if your connection is successful the terminal and LCD will display the assigned IP address.
Sample screen shots below. The shown temperatures are not the server room temperatures they are my outside my window and the test bench :)
The date and time are from the returned connection string the thingspeak.com sends back the temperature sensors are DS18B20's
Please take a look and post here if you see any dumb mistakes or things that could be done better.









' Configuration constants
TimeZone = 12.0 ' hours from GMT (+ or -)

UseDST = 1 ' set to 1 to enable daylight saving time (DST) adjust
dms = 10 ' the month that DST starts
dhs = 3 ' the hour that DST starts
dme = 4 ' the month that DST ends
dhe = 2 ' the hour that DST ends
UPDateTime = 15 ' Update Frequency in Minutes
IntUpper = 25 ' Internal Temp Upper Alarm
IntLower = 15 ' Internal Temp Lower Alarm
ExtUpper = 22 ' External Temp Upper Alarm
ExtLower = 10 ' External Temp Lower Alarm
Lcount=11
BodyLines=2

'arrays
Dim Line$(LCount)
Dim Body$(BodyLines)
Dim md(12), Months$(12)
Data 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
Data Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
For i = 1 To 12: Read md(i): Next i
For I = 1 To 12: Read Months$(I) : Next I

Line$(1)="helo aol.com" 'Use what you like here
Line$(2)="mail from: Monitor@aol.com" 'Sending address
Line$(3)="rcpt to: youremail@email.com" 'To Adress
Line$(4)="data" 'Start the data content
Line$(5)="from:Monitor@aol.com" 'The next 3 Lines are to avoid a Bad header
Line$(6)="to:youremail@email.com" 'To Adress
Line$(7)="Subject:Temperature Monitor"+Chr$(13)+Chr$(10)
Line$(8)="Server Room Temperature Status" 'Body
Body$(1)="Rack Temperature="
Body$(2)="Room Temperature="
Line$(11)=Chr$(13)+Chr$(10)+"." 'End of Data

SetPin 14,DOUT 'WifI Reset pin

PWM 2, 1800, 5, 20 'Adjust Freqency for contrast adjustment
LCD Init 2, 3, 4, 5, 6, 7 'Setup the LCD for display


SSID$ = "SSID HERE" 'name of wireless access point To connect To
PASS$ = "Wireless KEY" 'wifi password
Port$ = "80"
DST$ = "184.106.153.149" 'api.thingspeak.com
HST$ = "/HOST:api.thingspeak.com HTTP/1.1" 'api.thingspeak.com
GET$ = "GET /update?api_key=XXXXXXXXXXXXXXXX&field1=" 'Put your own key here
GET2$ = "&field2="
ESR$ = "192.168.0.2" 'Mail servers IP

Memory
Reset

Open "COM1:115200, 1024" As #1 'ESP module must be set to same rate

Print #1, "AT+CWMODE=1"
Pause 1000

Print #1, "AT+CIPMUX=0" ' Set Single connection
Pause 2000

ConnectToWiFi:
Print #1,"AT+CWJAP="+Chr$(34)+SSID$+Chr$(34)+","+Chr$(34)+PASS$+Ch r$(34)
LCD 1, 1, "Connecting to "
LCD 2, 1, SSID$
Pause 8000 'give it time to connect
Getstringlong
Flushbuf

Print #1, "AT+CIFSR"
Pause 1000
Line Input #1,IP$ ' Ignore this one
Line Input #1,IP$ ' Ignore this one
Line Input #1,IP$
LCD CLEAR
LCD 4, 1, IP$
Print IP$


PushTemp:
Flushbuf
Print #1, "AT+CIPSTART="+Chr$(34)+"TCP"+Chr$(34)+","+Chr$(34)+DST$+Chr $(34)+","+"80"
Pause 2000

For I = 0 To 4
Line Input #1,TD$
Print "Line Number ";I,TD$
Next I

If TD$<>"Linked" Then
LCD 3, 1, "HTTP Post Error "
GoTo ConnectToWiFi
EndIf

I=1000 'Ensure 1st Read
GoSub Readtemp 'Read Temperature

HTTP Get$+T1$+Get2$+T2$+HST$ 'Send Data to thingspeak.com
Pause 1000

For I = 0 To 9
Line Input #1,TD$
Next I

Print #1,"AT+CIPCLOSE"
Pause 1000

GoSub TimeDate
LCD 3, 1,"Last Update "+Time$

Test ' Check alarm

Timer=0
Do While Timer < ((UPDateTime*1000)*60)
LCD 1, 1,"Ext "+T1$+Chr$(223)+"C"
LCD 2, 1,"Int "+T2$+Chr$(223)+"C"
LCD 1, 12, Time$
LCD 2, 12, Left$(Date$,3)+Mnth$+"-"+Right$(Date$,2)
Loop

LCD 1, 12, "Updating"
GoSub ReadTemp 'Read the Temp Sensors

GoTo PushTemp

Sub Test
If Val(T1$) > ExtUpper Then Alarm=1 'If T1 greater than set
If Val(T1$) < ExtLower Then Alarm=1 'If T1 less than set
If Val(T2$) > IntUpper Then Alarm=1 'If T2 greater than set
If Val(T2$) < IntLower Then Alarm=1 'If T2 less than set

If Alarm <> 1 Then Exit Sub 'No Alarm Exit

If Mailcount < 1 Then SendEmail
If Mailcount > 3 Then SendEmail

Mailcount=Mailcount+1
If MailCount > 3 Then Mailcount=0

End Sub

Sub HTTP output$
Print #1,"AT+CIPSEND="+Str$(Len(output$)+4)
Delay
Print #1,output$;
Delay
Print #1,Chr$(13)+Chr$(10);
Delay
Print #1,Chr$(13)+Chr$(10);
Delay
End Sub

Sub Reset
Pin(14)=0 ' Reset Module Disabled
Pause 500
Pin(14)=1 ' Reset Module Enabled
Pause 1500
End Sub

Sub FLUSHBUF
Do:A$=Input$(1,#1):Loop While Loc(#1) <> 0
End Sub

Sub SendEmail
Print "SendEmail"
Flushbuf
Print #1, "AT+CIPSTART="+Chr$(34)+"TCP"+Chr$(34)+","+Chr$(34)+ESR$+Chr $(34)+",25" '
Pause 2000

For I = 0 To 4
Line Input #1,TD$
Print "Line Number ";I,TD$
Next I

If TD$<>"Linked" Then
LCD 3, 1, "Email Send Error "
GoTo ConnectToWiFi
EndIf

Line$(9)=Body$(1)+T1$+" C"
Line$(10)=Body$(2)+T2$+" C"

For I = 1 To LCount
Print #1,"AT+CIPSEND="+Str$(Len(Line$(I))+2)
Delay
Print #1,Line$(I)+Chr$(13)+Chr$(10);
Delay
Getstringlong
Next I
Print #1, "AT+CIPCLOSE"
Emailcount=Emailcount+1 'Increment Email sent counter
End Sub

Sub Delay
Pause 500
End Sub

'**********GETSTRINGLONG************
Sub GETSTRINGLONG
'Pause 200
C$=""
Do
C$=Input$(1,#1)
char = Asc(C$)
If char >31 Then Print C$; 'printable characters
If char =10 Then Print " " 'linefeed
EndIf
Loop While Loc(#1)<>0
End Sub


TimeDate:
' first extract the date/time from the returned html
year = Val(Mid$(TD$, 21, 2))
Mnth$ = Mid$(TD$, 15, 3)
day = Val(Mid$(TD$, 12, 2))
hour = Val(Mid$(TD$, 24, 2))
min = Val(Mid$(TD$, 27, 2))
sec = Val(Mid$(TD$, 30, 2))


'Lookup Month
I=1
Do While Mnth$<>Months$(I)
I=I+1
If I >12 Then Return
Loop
month=I


mins = GetMins(year, month, day, hour, min)
mins = mins + TimeZone * 60 ' adjust for the timezone
If UseDST Then ' if we observe daylight saving
If mins < GetDST(year, dme, dhe) Or mins > GetDST(year, dms, dhs) Then
mins = mins + 60 ' adjust for AWST DST
EndIf
EndIf


' finally convert the minutes back into the current date/time
Line1$ = GetDate$(mins)
Line2$ = GetTime$(mins)

' display the date and time for this second
Print "Date ";Line1$
Print "Time ";Line2$

Time$=Line2$
Date$=Mid$(Line1$,6,2)+"-"+Str$(I)+"-"+Right$(Line1$,2)

Return

ReadTemp:
I=I+1
If I < 1000 Then Return
EndIf
Tmp= DS18B20(18) 'DS18B20 on pin 18
T1$ = Str$(Tmp) 'Str$(DS18B20(14)
If Int(Val(T1$)) < 10 Then T1$ = " " + T1$
T1$=Left$(T1$,2)+"."+ Str$(Int((Tmp-Int(Tmp))*10))
Print T1$

Tmp= DS18B20(17) 'DS18B20 on pin 17
T2$ = Str$(Tmp) 'Str$(DS18B20(14)
If Int(Val(T2$)) < 10 Then T2$ = " " + T2$
T2$=Left$(T2$,2)+"."+ Str$(Int((Tmp-Int(Tmp))*10))
Print T2$

I=0
Return
' Below code from Geoff Graham's GPS Clock
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''
' calculate the minutes since midnight 1st Jan 2014
Function GetMins(yr, mth, day, hr, min)
GetMins = (yr - 14) * (365 * 24 * 60) + ((yr - 13) \ 4) * (24 * 60)
GetMins = GetMins + (md(mth) * (24 * 60))
GetMins = GetMins + ((day - 1) * (24 * 60))
GetMins = GetMins + (hr * 60)
GetMins = GetMins + min
If (yr - 16) Mod 4 = 0 And mth > 2 Then GetMins = GetMins + (24 * 60)
End Function


' convert minutes back into the time (as a string)
Function GetTime$(minutes)
Local hr, min, am$
am$ = "AM"
hr = (minutes \ 60) Mod 24
'If hr > 12 Then am$ = "PM" : hr = hr - 12
'If hr = 0 Then hr = 12
min = minutes Mod 60
GetTime$ = Str$(hr) + ":"
GetTime$ = GetTime$ + Right$("0" + Str$(min), 2) + ":"
GetTime$ = GetTime$ + Right$("0" + Str$(sec), 2) + " " ' + am$
GetTime$=" " + GetTime$
End Function


' convert minutes back into the date (as a string)
Function GetDate$(minutes)
Local yr, mth, day, mths$, days$
mths$ = " JanFebMarAprMayJunJulAugSepOctNovDec"
days$ = "SunMonTueWedThuFriSat"
For yr = 14 To 99
If minutes < GetMins(yr + 1, 1, 1, 0, 0) Then Exit For
Next yr
For mth = 1 To 12
If minutes < GetMins(yr, mth, 1, 0, 0) Then Exit For
Next mth
mth = mth - 1
day = ((minutes - GetMins(yr, mth, 1, 0, 0)) \ (24 * 60)) + 1
GetDate$ = Mid$(days$, ((((minutes \ (24 * 60)) + 3) Mod 7) * 3) + 1,3)+" "
GetDate$ = GetDate$ + Right$(" " + Str$(day), 2)
GetDate$ = GetDate$ + "-" + Mid$(mths$,mth*3,3) + "-" + Str$(yr + 2000)
End Function


' get the minutes that DST will start or end in a month
Function GetDST(yr, mth, hr)
Local d, m
m = GetMins(yr, mth, 1, hr, 0)
d = ((m \ (24 * 60)) + 3) Mod 7
GetDST = m + (((7 - d) Mod 7) * 24 * 60)
End Function




I have used code from this forum and Geoff's GPS clock so thanks for sharing

Regards
Jman
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 11:33pm 13 Nov 2014
Copy link to clipboard 
Print this post

@Jman,

Just had a quick scan - what another brilliant little use the MicroMite has been put to

Going to study this another day when I have more time . . .

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 12:29am 14 Nov 2014
Copy link to clipboard 
Print this post

Clever boy.

Nice idea, too.

Purely out of interest, does your server room use "Active cooling" - a heat-pump set on cool and left to run all year long, basically....

I have been in more then one large server rooms, and they tend to use air-conditioning to pump cold air into the room to keep all the equipment cool. People might not realize just how much heat, a well stocked server room can generate!
Smoke makes things work. When the smoke gets out, it stops!
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 01:46am 14 Nov 2014
Copy link to clipboard 
Print this post

Great stuff JMan - I've got a mate who asked me if if he could remotely monitor how his heating system was going in different zones of a building of serviced offices he owns. Not sure how he'd change the control settings remotely if there was a problem but I guess he could ring someone up in the building to do it manually!

Greg
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:28am 14 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman, This is very cool. I always wanted to try the thingspeak site and now I have a reason!!! Great work!
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:34am 14 Nov 2014
Copy link to clipboard 
Print this post

  Grogster said  
Purely out of interest, does your server room use "Active cooling" - a heat-pump set on cool and left to run all year long, basically....



Hi G

Our server room uses "Active Cooling" ie a Heat Pump set to cooling only and runs all year long. If the cooling stops the room gets real hot to the point were the server fans are going flat out and are so loud you cant hear yourself think in there :)

Jman
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:00pm 14 Nov 2014
Copy link to clipboard 
Print this post

After reviewing this code, alls I can say is AWESOME job Jman!!! Thanks! You are helping my cause in converting my die hard arduino buddies towards the uMite light. I love having the last laugh when the arduino crowd can't figure out why their downloaded library doesn't do exactly what they think it should. When I can show them code like this, they wonder why they laughed at my using "basic" from the get go, yet all my embedded projects work way before theirs do. It's a big hats off to Geoff and his efforts and folks like you that constantly prove that its not the language or the popularity of the platform, it boils down to making things work, and understanding why it works, without having to depend on "libraries". This is what its all about.
Sorry for the rambling, but damn, this is good stuff, especially when code like this opens up so many doors!!!
Thanks again!!!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 05:15pm 14 Nov 2014
Copy link to clipboard 
Print this post

Here, here!

MMBASIC is, IMHO, a very mature and powerful language these days.
I've lost track of what has acutally come and gone in the language over the years, but when I first started with MMBASIC, it was with the black-and-white Maximite as published in Silicon Chip magazine, as I am sure, it was with many.

Comparing the current version of MMBASIC with the version of MMBASIC on the original B/W Maximite - they are quite impressively different languages, yet they are all called MMBASIC!

I'm delighted to read of how some of your Arduino chums have been converted.
Not that I have anything against Arduino - far from it. It is all just a matter of personal choice.

BUT - if you can convert current Arduino users to the Micromite, that surely speaks volumes on how flexible MMBASIC and the MicroMite/Maximite is.

For BASIC-based PIC systems, I would have to rate the top three as:

1) MMBASIC
2) PICAXE BASIC
3) GREAT COW BASIC

No disrespect to any of the others out there, these are just the first three I thought of while typing this right now, and sorted in order of my own preference.
Smoke makes things work. When the smoke gets out, it stops!
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 10:32pm 15 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman, quick question... how did you derive the mail server ip address
ESR$ = "192.168.0.2" 'Mail servers IP
Thanks!!!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 01:00am 16 Nov 2014
Copy link to clipboard 
Print this post

That IP address is class C which is normally used for internal networks with a max of 254 addresses.
The router/gateway is probably 192.168.0.1 and one of the servers available on the internal network is a mail server with 192.168.0.2


Microblocks. Build with logic.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 03:54am 16 Nov 2014
Copy link to clipboard 
Print this post

Excellent work Jman..!!

I love it how you are very willing to show and share your programs with everyone here..!! It sure is a BIG help to dumbasses like myself who are still trying to get the hang of it..

You ROCK bro..!!
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:39am 16 Nov 2014
Copy link to clipboard 
Print this post

  viscomjim said   Hi Jman, quick question... how did you derive the mail server ip ress
ESR$ = "192.168.0.2" 'Mail servers IP
Thanks!!!


Hi
192.168.0.2 just happens to be my internal mail servers ip address
You can use any vaild mail servers ip address normally this would be
your ISP's mail server. Instead of a IP address you should be able to
use your ISP's mail server name "mail.myisp.com"

Regards
Jman

 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 01:46pm 16 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman, Thanks for that. Since I do not have my own mail server, I tried to figure out how to send an email using my hosting company's mail server. My website and mail is hosted by Godaddy. This was a bit trickier than I thought but after a bit of hair loss it worked. I have a feeling that a lot of commercial web and email host may use this method also. My code is not the greatest but it works and of course is just a basis for being able to use the uMite to send an email using your current email server. There are a lot of "getstringlong" and delays built in, but most of them are just to be able to watch what is happening, especially in the "sendemail" sub.

The thing with godaddy's imap mail server is that you have to log in using your email address and password. The way you have to present your credentials is in an base 64 encoded format. What happens is when you issue the "AUTH LOGIN" line, it responds with a weird code, and if you translate it from base64 encoding, you will see that it is actually asking for your username and password. So what I did is take my email address "jim@viscomgraphics.com" and put it here and I got amltQHZpc2NvbWdyYXBoaWNzLmNvbQ==, I did the same with my password. If you put your encoded email address in line$(3) and encoded password in line$(4), it will work just fine.

Of course, you can make it send what ever you want in the body and subject etc., just like Jman did with his awesome code earlier in this thread. Give it a whirl...

Lcount=13

Dim Line$(LCount)

Line$(1) = "helo smtpout.secureserver.net" 'GODADDY WEBMAIL SERVER"
LINE$(2) = "AUTH LOGIN" 'LOG IN
Line$(3) = "XXXXXXXXXXXXXXXXXXXXXXX" 'BASE64 YOU@YOURMAIL.COM
Line$(4) = "XXXXXXXXX" 'BASE64 YOURPASSWORD
Line$(5) = "MAIL FROM: YOU@YOURMAIL.COM"
Line$(6) = "RCPT TO: HIM@HISMAIL.COM" 'To Adress
Line$(7) = "DATA" 'WANT TO SEND DATA
Line$(8) = "TO: HIM@HISMAIL.COM" 'TO EMAIL ADDRESS
LINE$(9) = "FROM: YOU@YOURMAIL.COM" 'FROM YOU
LINE$(10) = "SUBJECT: MESSAGE FROM JIM'S uMITE" 'SUBJECT LINE
LINE$(11) = "THIS IS A TEST FROM UMITE" 'BODY LINE 1
LINE$(12) = "HAVE A NICE DAY" 'BODY LINE 2
Line$(13) = "." 'End of Data

SSID$ = "jim's Wi-Fi Network" 'name of wireless access point To connect To
PASS$ = "Zak12341" 'wifi password 'Mail servers IP
ESR$ = "SMTPOUT.SECURESERVER.NET"

Open "COM1:230400, 1024" As #1 'ESP module must be set to same rate
FLUSHBUF

Print #1, "AT+CWMODE=1" 'SET ESP8266 AS STATION
Pause 1000
GETSTRINGLONG

Print #1, "AT+CIPMUX=0" ' Set Single connection
Pause 2000
GETSTRINGLONG

ConnectToWiFi:
Print #1,"AT+CWJAP="+Chr$(34)+SSID$+Chr$(34)+","+Chr$(34)+PASS$+Ch r$(34)
PRINT "Connecting to ";SSID$
Pause 8000 'give it time to connect
GETSTRINGLONG
FLUSHBUF

Print #1, "AT+CIFSR" 'GET IP ADDRESS
Pause 2000
Line Input #1,IP$:PRINT"CIFSR 1 = ";IP$ ' Ignore this one
Line Input #1,IP$:PRINT"CIFSR 2 = ";IP$ ' Ignore this one
Line Input #1,IP$:PRINT"CIFSR 3 = ";IP$
Print "CONNECTED TO "+SSID$+" AT IP ADDRESS: ";IP$
SENDEMAIL
END

'**********GETSTRINGLONG************
Sub GETSTRINGLONG
C$=""
Do
C$=Input$(1,#1)
char = Asc(C$)
If char >31 Then Print C$; 'printable characters
If char =10 Then Print " " 'linefeed
EndIf
Loop While Loc(#1)<>0
End Sub

'**********FLUSHBUFFER************
Sub FLUSHBUF
Do:A$=Input$(1,#1):Loop While Loc(#1) <> 0
End Sub

'**********SEND EMAIL************
Sub SENDEMAIL
Print "SendEmail"
Flushbuf
PRINT "DOING CIPSTART NOW"
Print #1, "AT+CIPSTART="+Chr$(34)+"TCP"+Chr$(34)+","+Chr$(34)+ESR$+Chr $(34)+",80"
Pause 2000
For I = 0 To 4
Line Input #1,TD$
Print "Line Number ";I,TD$
Next I
If TD$<>"Linked" Then
PRINT "UNIT DID NOT LINK"
GOTO CONNECTTOWIFI
ENDIF
PRINT "UNIT LINKED TO ";ESR$
PAUSE 500
FLUSHBUF
For I = 1 To LCount
Print #1,"AT+CIPSEND="+Str$(Len(Line$(I))+2)
Delay
Print #1,Line$(I)+Chr$(13)+Chr$(10);
Delay
Getstringlong
Next I
DELAY
GETSTRINGLONG
Print #1, "AT+CIPCLOSE"
DELAY
GETSTRINGLONG
END SUB

SUB DELAY
PAUSE 1000
END SUB
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5910
Posted: 04:41pm 16 Nov 2014
Copy link to clipboard 
Print this post

@viscomjim
SUB GETSTRINGLONG has 2 one line IF's followed by a superfluous ENDIF

'**********GETSTRINGLONG************
Sub GETSTRINGLONG
C$=""
Do
C$=Input$(1,#1)
char = Asc(C$)
If char >31 Then Print C$; 'printable characters
If char =10 Then Print " " 'linefeed
EndIf '!!!!! this shouldn't be here
Loop While Loc(#1)<>0
End Sub


Jim

VK7JH
MMedit   MMBasic Help
 
viscomjim
Guru

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

Thank you kind sir. You are absolutely correct!!! Fixed.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 05:04pm 18 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman,

Quick question... are you using this
PWM 2, 1800, 5, 20 'Adjust Freqency for contrast adjustment

directly connected from the uMite to the LCD pin 3 to adjust the contrast instead of the usual 10k pot from ground to +5v? If so, does the 3.3v output work ok for that?
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:43pm 18 Nov 2014
Copy link to clipboard 
Print this post

  viscomjim said   Hi Jman,

Quick question... are you using this
PWM 2, 1800, 5, 20 'Adjust Freqency for contrast adjustment

directly connected from the uMite to the LCD pin 3 to adjust the contrast instead of the usual 10k pot from ground to +5v? If so, does the 3.3v output work ok for that?


Well spotted
This way I can run the LCD from 3.3v and still get good contrast
take a look at this 3.3v Contrast

Let me know how you get on

Jman
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 10:44pm 18 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman, this is quite a cool way to do that and I will implement this on a future 3.3v only project. I am assuming the backlight works ok with 3.3v also? And as Grogster mentioned this can also be pwm'ed for brightness, assuming you are driving a transistor of some kind?

Since I have to use 5v for another component, I can still run 5v to the display. Will this contrast also work as a direct connection (without the caps and diodes)to a pwm pin that's at 3.3v?

@Grogster, you mentioned the pwm for controlling brightness in the linked thread. Do you have a description of the circuit and the code you used for this?

Thanks again for all your help. I am having fun sending emails from the uMite to my IMAP email that goes to my phone and computers. I showed this to a friend and his office wants this to monitor a few sensors and email about 8 different people every 20 minutes the status of the sensors. They were quoted a ridiculous amount of money for this and can't believe I can do it for "half the price", hehehe.

I am now working on sending the uMite an email and making it do stuff and sending an email back that it succeeded or failed. The smtp part works very well, now working on polling an imap and by reading the subject line, the uMite will know that the data is for it. I will post code when done.Edited by viscomjim 2014-11-20
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:04pm 18 Nov 2014
Copy link to clipboard 
Print this post

@viscomjim

This the code I use for the Backlight


Sub SetBrightness ' Sub To Brightness
PWM 2, 1000, (100-Brightness)
End Sub


And connected like this



If you run the LCD on 5v you can give this a try for the contrast
(Untested a UMite but tested on 16f88)

You might have to adjust the resistor values.

Really keen to see the email code it's great to share

Jman


 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 11:35pm 18 Nov 2014
Copy link to clipboard 
Print this post

Hi Jman, thanks for that. Could you clarify the values of the resistors you used in the contrast (16f88) divider circuit? To small for these eyes.
 
     Page 1 of 2    
Print this page
© JAQ Software 2024