By utilizing a single data line for communication and choosing this type of conversion (1-Wire to UART), you will perform efficient and reliable data transfer without additional wiring
A
A
Hardware Overview
How does it work?
UART 1-Wire Click is based on the DS2480B, a serial to the 1-Wire® driver from Analog Devices. This IC is designed to interface the UART with the 1-Wire® bus directly. It performs data conversion using independent data rates for both interfaces, allowing standard and overdrive communication speeds. Internal timing generators of the DS2480B IC are continuously synchronized with the incoming UART data, which is typically driven by a high-precision crystal oscillator of the host microcontroller (MCU). This allows time-critical 1-Wire® signals to be generated by the DS2480B, significantly reducing the processing load from the host MCU. Many physical parameters of the UART and 1-Wire® buses can be fine-tuned so that the UART 1-Wire click can be accommodated to any UART/RS232 to 1-Wire® signal conversion application. The DS2480B IC can be observed as a complex state machine. UART commands can configure it, so the IC must parse the
incoming data before conversion. The device can be operated in two main operating modes: Command Mode and Data Mode. The Command Mode is the default state after the Power ON event. This mode allows the configuration parameters to be set. However, the DS2480B IC must be initialized before any operation: the 1-Wire® bus reset command should be sent over the TXD line at a fixed rate of 9600 bps. This is used only to calibrate the internal timing generators without performing any action on the 1-Wire® bus. After the initialization, the DS2480B IC can be used normally. The Data Mode converts bytes received at the TXD line into their equivalent 1-Wire® waveforms and reports the responses back to the host MCU through the RXD line. The datasheet of the DS2480B IC illustrates the operating principles of this IC by using the state transition diagram. Along with several examples at the end of the datasheet, it represents a useful starting point for application
development. However, the included mikroSDK-compatible library offers functions that simplify firmware development even more. The DS2480B requires 5V for both the power supply and logic levels. Considering that most MCUs use 3.3V logic levels for UART communication, a level translator had to be added. UART 1-Wire click uses the TXB0106, a bi-directional level translator IC, by Texas Instruments. This IC allows reliable logic voltage level translation, allowing the Click board™ to be used with a wide range of MCUs that use 3.3V logic levels on their UART lines. The 1-Wire® bus can be accessed over the screw terminal on the Click board™. Due to the nature of most 1-Wire® applications, the signal line of the 1-Wire® bus is protected by the DS9503, an integrated ESD Protection Diode with resistors. This IC is specifically designed to be used as Electrostatic Discharge (ESD) protection in 1-Wire® applications.
Features overview
Development board
EasyAVR v7 is the seventh generation of AVR development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 16-bit AVR microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyAVR v7 allows you to connect accessory boards, sensors, and custom electronics more
efficiently than ever. Each part of the EasyAVR v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-12V AC or 9-15V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B)
connector. Communication options such as USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets which cover a wide range of 16-bit AVR MCUs. EasyAVR v7 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
64
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
4096
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for UART 1-Wire Click driver.
Key functions:
uart1wire_write_command
- This function sends an 8-bit command to the click module.uart1wire_read_temperature
- This function reads the temperature from DALLAS one wire temperature sensors.uart1wire_reset
- This function sends a reset pulse signal.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief UART1Wire Click example
*
* # Description
* This example reads and processes data from UART 1-Wire clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger.
*
* ## Application Task
* Reads the temperature data from DALLAS temperature sensors and logs the results
* on the USB UART every second.
*
* @note
* Connect only DQ and GND pins to the UART 1-Wire click connector.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "uart1wire.h"
#include "string.h"
// ------------------------------------------------------------------ VARIABLES
static uart1wire_t uart1wire;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
uart1wire_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
uart1wire_cfg_setup( &cfg );
UART1WIRE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
uart1wire_init( &uart1wire, &cfg );
Delay_ms( 100 );
}
void application_task ( void )
{
float temp_f;
uint8_t res_flag;
res_flag = uart1wire_read_temperature ( &uart1wire, &temp_f, UART1WIRE_TEMP_SENSOR_RESOLUTION_9BIT );
if ( res_flag == UART1WIRE_OK )
{
log_printf( &logger, " * Temperature: %.2f C\r\n", temp_f );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms( 1000 );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END