TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137028 times)
  2. FAT32 Library (70152 times)
  3. Network Ethernet Library (56032 times)
  4. USB Device Library (46355 times)
  5. Network WiFi Library (41970 times)
  6. FT800 Library (41297 times)
  7. GSM click (29071 times)
  8. mikroSDK (26509 times)
  9. PID Library (26452 times)
  10. microSD click (25436 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: 1925 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

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]

MP3 Player for Mikromedia plus for STM32F4

0

a modified example of MikroElectronika - continuous playback of the playlist

[Learn More]

Bootloader for ATmega1284 20MHz 19200bps

0

fast bootloader for ATmega1284 20MHz 19200bps via UART0, programming using the program AVRPROG, press the reset and start the program AvrProg, for two seconds. FUSE bit set boot from address 0xF800, BOOTSZ0 = 1, BOOTSZ1 = 0.

[Learn More]