TOP Contributors

  1. MIKROE (2752 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139073 times)
  2. FAT32 Library (71595 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27894 times)
  9. PID Library (26859 times)
  10. microSD click (26130 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
Example

DC Fan speed control on ATtiny13 and DS18B20

Rating:

5

Author: Roman Toropov

Last Updated: 2016-02-19

Package Version: 1.0.0.0

Example: 1.0.0.0

Category: Motor Control

Downloaded: 1945 times

Followed by: 3 users

License: MIT license  

Control of fan speed depending on the temperature

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DC Fan speed control on ATtiny13 and DS18B20" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DC Fan speed control on ATtiny13 and DS18B20" changes.

Do you want to report abuse regarding "DC Fan speed control on ATtiny13 and DS18B20".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Example Blog

cxema

cxema

scheme

View full image
PCB

PCB

45x35 mm radio part and wiring on one side

View full image

// Roman Toropov
// Termostat source

char duty;
unsigned int temp2write;

void main() {

   DDB0_bit = 1;
   PWM1_Init(_PWM1_FAST_MODE, _PWM1_PRESCALER_1, _PWM1_NON_INVERTED, 0);

  do {
    Ow_Reset(&PORTB, 2);                         // Onewire reset signal
    Ow_Write(&PORTB, 2, 0xCC);                   // Issue command SKIP_ROM
    Ow_Write(&PORTB, 2, 0x44);                   // Issue command CONVERT_T
    Delay_us(120);

    Ow_Reset(&PORTB, 2);
    Ow_Write(&PORTB, 2, 0xCC);                   // Issue command SKIP_ROM
    Ow_Write(&PORTB, 2, 0xBE);                   // Issue command READ_SCRATCHPAD

    temp2write =  Ow_Read(&PORTB, 2);
    temp2write = (Ow_Read(&PORTB, 2) << 8) + temp2write;

  temp2write = temp2write >> 4 ;

// degrees Celsius in decimal form, natural number

  if (temp2write > 37) { duty = (temp2write - 37) * 5 + 20; }

  if (temp2write > 45) { duty = 255; }
  if (temp2write < 38) { duty = 0; }

  PWM1_Set_Duty(duty);

  Delay_ms(3000);

  } while (1);

}

ALSO FROM THIS AUTHOR

Recording time in RTC Click with Mikromedia for ATmega

0

Cyrillic graphical interface for recording the date and time in RTC PCF8583, + adjust the backlight TFT save in eeprom MCU :) + picture, graphic, Cyrillic koi8 fonts in *.RES-file from SD-card. http://youtu.be/mCCeKzurVi4

[Learn More]

eeprom AT24C32

0

read and write char, int, long, float

[Learn More]

The 10th version of the automatic battery Charger/discharger up to 40v up to 50A

0

Programmable synchronous step-down regulator, Based on: ATmega1284 with LCD 4x20, Keypad 4x4, ADC MCP3204, DAC 2*DAC8830 and MCP4921, ACS758xCB-050B, TL494, IR2184, RTC DS3231, DS18B20 and USB UART FT232RL. Algorithms: IUoU, IUIoU, IUo, IUIo graphs: http://www.jgdarden.com/batteryfaq/carfaq9.htm#algorithms

[Learn More]