TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (136552 times)
  2. FAT32 Library (69748 times)
  3. Network Ethernet Library (55850 times)
  4. USB Device Library (46189 times)
  5. Network WiFi Library (41812 times)
  6. FT800 Library (41003 times)
  7. GSM click (28930 times)
  8. PID Library (26386 times)
  9. mikroSDK (26291 times)
  10. microSD click (25303 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: 1921 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

bootloader for ATmega128/1280/1281/1284 16MHz 19200bps

0

a good replacement bootloader Mikroe - very fast bootloader in one minute software programming using the program AVRPROG, fuse bit MCU set boot from address F800. press the reset and start the program AvrProg, for two seconds.

[Learn More]

The 7th 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 PCF8583, DS18B20 and USB UART FT232RL. range of output settings 0...40 volts and charge 0...50A discharger 0...18A. Algorithms: IUoU, IUIoU, IUo, IUIo

[Learn More]

The 8th version of the automatic battery charger/discharger up to 20A up to 20V

0

Programmable synchronous step-down regulator, Based on: MCU ATmega128A, LCD 16x2, Keypad, ADC MCP3204, DAC MCP4921, RTC DS3231, AT24C32, DS18B20, ACS712ELCTR-20A-T, TL494, IR2184 and USB UART CP2102. Algorithms: IUoU, IUIoU

[Learn More]