-->
Page 1 of 3

Automated car preheating timer.

PostPosted: Tue Jan 19, 2016 11:01 am
by Jokkepappa
I made myself timer for preheating car during these freezing winter days. Code is anything but optimized at this point and it lacks feature to schedule heating but it's coming in future update. Also i'm planning to add 0.96" OLED display in to the case for viewing remaining time.

I made blogpost with more detailed information and pictures and here is the code for version 0.3. (Will most likely rewrite whole thing when the language evolves and gets more commands.

Blogpost you can read Here!

Code: Select allcls 
 state = Off 
 po 13, 0 
 po 14, 0 
 heatingTime = 0 
 heatingTimeMin = 0 
 humanTime = 0 
 interrupt 12, [phyButton] 
 timer 1000, [timerSec] 
 css ulkoasu.css 
 wprint |<meta name="viewport" content="width=device-width, initial-scale=1" />| 
 wprint |<meta http-equiv='refresh' content='5;URL=/input?'></head>| 
 wprint |<center><b>| 
 wprint "Heater: " 
 wprint htmlvar(state) 
 wprint "<br> Heating time left: " 
 wprint htmlvar(humanTime) 
 wprint "<br><br>" 
 button "On for 2H" [onTwoH] 
 wprint "<br><br>" 
 button "On for 1H 30min" [onOneHalf] 
 wprint "<br><br>" 
 button "On for 1H" [onOneH] 
 wprint "<br><br>" 
 button "On for 30min" [onHalf] 
 wprint "<br><br>" 
 button "Off" [turnOff] 
 wprint "<br><br>" 
 wait 
   
 [onTwoH] 
 heatingTime = 7200 
 goto [turnOn] 
 wait 
   
 [onOneHalf] 
 heatingTime = 5400 
 goto [turnOn] 
 wait 
   
 [onOneH] 
 heatingTime = 3600 
 goto [turnOn] 
 wait 
   
 [onHalf] 
 heatingTime = 1800 
 goto [turnOn] 
 wait 
   
 [turnOn] 
 po 13, 1 
 po 14, 1 
 state = On 
 wait 
   
 [turnOff] 
 po 13, 0 
 po 14, 0 
 state = Off 
 heatingTime = 0 
 interrupt 12, [phyButton] 
 wait 
   
 [phyButton] 
 interrupt 12 
 plusheatingTime = heatingTime + 1800 
 if plusheatingTime < 7200 then goto [addTime] 
 if plusheatingTime > 7200 then goto [turnOff] 
 wait 
   
 [addTime] 
 heatingTime = heatingTime + 1800 
 goto [blinkLed] 
 wait 
   
 [blinkLed] 
 blinkTimes = heatingTime / 1800 
 blinkTimes = left(blinkTimes,1) 
 for x = 1 to blinkTimes 
 po 14, 0 
 delay 100 
 po 14, 1 
 next x 
 interrupt 12, [phyButton] 
 goto [turnOn] 
 wait 
   
 [timerSec] 
 plusheatingTime = 0 
 heatingTime = heatingTime - 1 
 heatingTimeMin = heatingTime / 60 
 if heatingTime > 3600 then heatingTimeMin = heatingTimeMin - 60 
 let heatingTimeMin = left(heatingTimeMin,2) 
 let heatingTimeMin = replace(heatingTimeMin,".","") 
 if heatingTime > 3600 then humanTime = "1h " 
 if heatingTime > 3600 then humanTime = humanTime & heatingTimeMin 
 if heatingTime > 3600 then humanTime = humanTime & "min" 
 if heatingTimeMin <= 0 then heatingTimeMin = 0 
 if heatingTime < 3600 then humanTime = heatingTimeMin & "min" 
 if heatingTime <= 0 then goto [turnOff] 
 wait 


-Jokke

Re: Automated car preheating timer.

PostPosted: Tue Jan 19, 2016 11:17 am
by Mmiscool
This is awesome. I sent a link to your blog in to hack a day. I am glad to see some very use full things getting made using basic.

:-)

Thanks for sharing.

Re: Automated car preheating timer.

PostPosted: Tue Jan 19, 2016 11:26 am
by Jokkepappa
You're welcome. And Thanks.

I Still have couple ideas i will try making in the future. Currently my desk light also uses ESP-07 module runnig basic. Will propably make another topic/blogpost about it in the future when i get to make pictures.

Totally love the flexibility and convenience of the espbasic. Keep up the awesome work.

Quick question, do we get AND/OR/NAND options for IF at some point in the future? Would be totally usefull when messing with times.

Re: Automated car preheating timer.

PostPosted: Sun Jan 24, 2016 1:00 am
by forlotto
Totally new application but I know what you are talking about winterizing your car is very important when you start to get high north above the equator there are even some days when the winterizing doesn't even allow for your car to get warm enough to start oddly I've seen it happen and have been stuck because of the extreme chills.

But indeed the cold weather can be brutal on a vehicle and keeping the upper and lower halves of the motor lubricated are equally important.

I would have never thought of this one but think of the applications companies that have trucks sitting they could automate the charging of them during these cold times and keep things warmed safely this thing would pay for itself easily if it costed a couple hundred bucks even in just a few weeks worth of man hours. The thing that companies do not realize if you can do this you also free up time for that employee to either do a better job or preform another task related to the job they are doing which could allow them to get on the road sooner and get your shipment delivered and it will keep them happier for not having to run out and brave the cold as well.

Automation within reason will make the world a better place so as long as we use it for help for employment rather than replacing employment it should not have a negative impact on society. In order for the gears of society to keep on turning we need to keep employment and staff at current levels and use these automation ideas for growth and employee satisfaction rather than employee elimination.

This is a great idea the things that our minds miss is amazing I cannot even begin to dream up all of the possibles for espbasic but I know my mind swells each time I see another project it seems the tunnel of my vision gets wider and wider a rather interesting application and it would apply to many many people and even different applications that are similar that I am sure that neither I nor you are currently aware or thinking of at the current time!

Thanks,

-forlotto