This is an old revision of the document!


DS18B20

DS18B20 are small true temperature sensors. You can find them easily on ebay for a couple of $.

Default settings:

By default the bugOne use PD5 for this sensors. You can tweak this in devices/onewire.h

#define OW_PIN  PD5
#define OW_IN   PIND
#define OW_OUT  PORTD
#define OW_DDR  DDRD

The default setting for power supply is parasite. Just power the device through a 4.7k pull-up on pin DQ. You can change this in devices/ds18x20.c

int8_t ds18x20_read(struct packet_t *packet) {
    uint16_t temperature;
    uart_putstr_P(PSTR("ds18x20 read\r\n"));
    DS18X20_start_meas(DS18X20_POWER_PARASITE,NULL);
    _delay_ms(DS18B20_TCONV_12BIT);   
    DS18X20_read_decicelsius_single(DS18B20_FAMILY_CODE, &temperature);

    return set_data_int16(packet, temperature);
}
devices/ds18b20.1419435611.txt.gz · Last modified: 2014/12/24 16:40 by jkx
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0