TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (352 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 (136721 times)
  2. FAT32 Library (69928 times)
  3. Network Ethernet Library (55939 times)
  4. USB Device Library (46264 times)
  5. Network WiFi Library (41884 times)
  6. FT800 Library (41168 times)
  7. GSM click (28979 times)
  8. PID Library (26412 times)
  9. mikroSDK (26357 times)
  10. microSD click (25355 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

MP3 Player for Mikromedia plus for STM32F4

0

a modified example of MikroElectronika - continuous playback of the playlist

[Learn More]

16 bit DAC8830 and ATmega128

0

ATmega128, DAC8830 and LCD

[Learn More]

ADC + RTC for Mikromedia for ATmega

0

Mikromedia for ATmega Simple example which demonstrates working with the 4-Channel 12-bit A/D Converter (MCP3204) with SPI Serial Interface. The example shows how to measure analog inputs on Channels 0, 1, 2 and 3 and display the results on TFT. http://youtu.be/cwE1G5faBXc

[Learn More]