<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>USB Archives - CyberBlogSpot</title>
	<atom:link href="https://cyberblogspot.com/tag/usb/feed/" rel="self" type="application/rss+xml" />
	<link>https://cyberblogspot.com/tag/usb/</link>
	<description>Not just another blogspot site</description>
	<lastBuildDate>Tue, 24 Jan 2023 07:18:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>

<image>
	<url>https://cyberblogspot.com/wp-content/uploads/2018/08/cropped-iphone-iphone3gs-32x32.jpg</url>
	<title>USB Archives - CyberBlogSpot</title>
	<link>https://cyberblogspot.com/tag/usb/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Enable Serial Monitor on Digispark ATtiny85</title>
		<link>https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/</link>
					<comments>https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 18 Jan 2023 01:14:31 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino IDE]]></category>
		<category><![CDATA[ATtiny85]]></category>
		<category><![CDATA[CH304]]></category>
		<category><![CDATA[COM Port]]></category>
		<category><![CDATA[CP2104]]></category>
		<category><![CDATA[Digispark]]></category>
		<category><![CDATA[Digispark ATtiny85]]></category>
		<category><![CDATA[Digispark ATtiny85 Development Board]]></category>
		<category><![CDATA[FTDI]]></category>
		<category><![CDATA[PL2303]]></category>
		<category><![CDATA[Serial Monitor]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[USB Interface]]></category>
		<category><![CDATA[USB-to-Serial Converter]]></category>
		<category><![CDATA[USB-to-Serial TTL Converter]]></category>
		<category><![CDATA[USB-to-UART Converter]]></category>
		<guid isPermaLink="false">https://cyberblogspot.com/?p=5739</guid>

					<description><![CDATA[<p>The Serial Monitor in Arduino IDE is an indispensable tool for debugging purposes. However, although a Digispark ATtiny85 development board has a USB interface, the Serial Monitor does not work with it. The main reason is that the USB interface in the Digispark board is not a serial COM port. The second reason is that&#8230;&#160;<a href="https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/" rel="bookmark">Read More &#187;<span class="screen-reader-text">How to Enable Serial Monitor on Digispark ATtiny85</span></a></p>
<p>The post <a href="https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/">How to Enable Serial Monitor on Digispark ATtiny85</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The Serial Monitor in Arduino IDE is an indispensable tool for debugging purposes.  However, although a Digispark ATtiny85 development board has a USB interface, the Serial Monitor does not work with it.  The main reason is that the USB interface in the Digispark board is not a serial COM port.  The second reason is that the ATtiny85 chip does not have a UART port.  And third, the Digispark board lacks a UART to USB bridge circuitry to translate UART signals to USB signals.  In this article, we will take a look at how to enable the Serial Monitor when using a Digispark ATtiny85 development board.</p>



<p>To enable the Arduino IDE Serial Monitor on a Digispark ATtiny85 board, connect a USB-to-Serial converter.  Then use the SoftwareSerial library in the Arduino IDE to create a UART port on the ATtiny85 chip.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-fritzing-bb.png"><img fetchpriority="high" decoding="async" width="802" height="542" src="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-fritzing-bb.png" alt="Picture of Fritzing breadboard diagram showing how to connect the Digispark ATtiny85 board to a USB to serial converter to enable the serial monitor when working with Digispark ATtiny85" class="wp-image-5845" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-fritzing-bb.png 802w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-fritzing-bb-300x203.png 300w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-fritzing-bb-768x519.png 768w" sizes="(max-width: 802px) 100vw, 802px" /></a><figcaption class="wp-element-caption">Figure 1.  Fritzing Breadboard Diagram of Digispark ATtiny85 with a USB-to-Serial Converter</figcaption></figure></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="has-text-align-center">For Digispark ATtiny85 pinout guide, kindly see <a href="https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/" target="_blank" rel="noreferrer noopener">Digispark ATtiny85 Pinout and Configuration</a>.</p>
</blockquote>



<p></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter.png"><img decoding="async" width="1002" height="477" src="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter.png" alt="Schematic diagram for connecting the Digispark ATtiny85 board to a USB to UART converter to enable the serial monitor of the Arduino IDE." class="wp-image-5754" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter.png 1002w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-300x143.png 300w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-usb-to-serial-converter-768x366.png 768w" sizes="(max-width: 1002px) 100vw, 1002px" /></a><figcaption class="wp-element-caption">Figure 2.  Schematic Diagram of Digispark ATtiny85 and USB-to-Serial Converter Connection </figcaption></figure></div>


<p></p>



<h2 class="wp-block-heading">Step by Step Guide For Serial Monitor</h2>



<p><strong>STEP 1 &#8211; Connect a USB-to-Serial Converter</strong></p>



<p>First, connect a USB-to-serial converter to the Digispark ATtiny85 board as shown in Figure 1 and Figure 2.  </p>



<p>There are many inexpensive USB-to-serial converters on the Internet.  Examples of USB-to-serial converters are shown below in Figure 3.  These converters are sometimes referred to as USB-to-serial TTL converters or USB-to-UART converters.  Also, the converters use a variety of chips, hence, they may be referred to by their chip names.  Some of the popular USB-to-serial chip names that you may encounter are FTDI, CP2104, CH304, and PL2303.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/usb-to-serial-converters-jpg.webp"><img decoding="async" width="502" height="402" src="https://cyberblogspot.com/wp-content/uploads/2023/01/usb-to-serial-converters-jpg.webp" alt="Picture of the different types of USB-to-serial converter used for activating the serial monitor on Digispark ATtiny85 when working with Arduino IDE" class="wp-image-5849" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/usb-to-serial-converters-jpg.webp 502w, https://cyberblogspot.com/wp-content/uploads/2023/01/usb-to-serial-converters-300x240.webp 300w" sizes="(max-width: 502px) 100vw, 502px" /></a><figcaption class="wp-element-caption">Figure 3.  USB-to-Serial Converters</figcaption></figure></div>


<p></p>



<p><strong>STEP 2 &#8211; Install the USB-to-Serial Converter Device Driver</strong></p>



<p>Download and install the device driver for your USB-to-serial converter.  Because USB-to-serial converters use different chips, you need to search the internet for the device driver for your particular USB-to-serial converter.</p>



<p>You can do a quick test if you have the right device driver installed.  Open the Arduino IDE and go to the Tools/Port menu.  You should see an additional port instead on only COM1 on the Serial Ports list when you plug in your USB-to-serial converter.  Please see Figure 4.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/arduino-ide-serial-port-list.png"><img loading="lazy" decoding="async" width="802" height="520" src="https://cyberblogspot.com/wp-content/uploads/2023/01/arduino-ide-serial-port-list.png" alt="Screenshot of the Arduino IDE showing the serial COM ports list." class="wp-image-5851" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/arduino-ide-serial-port-list.png 802w, https://cyberblogspot.com/wp-content/uploads/2023/01/arduino-ide-serial-port-list-300x195.png 300w, https://cyberblogspot.com/wp-content/uploads/2023/01/arduino-ide-serial-port-list-768x498.png 768w" sizes="auto, (max-width: 802px) 100vw, 802px" /></a><figcaption class="wp-element-caption">Figure 4.  Arduino IDE Showing Serial Ports List</figcaption></figure></div>


<p></p>



<p><strong>STEP 3 &#8211; Install the Board Core ATTinycore by Spence Konde</strong></p>



<p>Although we may use the original Digistump AVR board core, I prefer to use the ATTinyCore as it supports almost all of the ATtiny line of AVR chips.  Additionally, the ATTinyCore gives us the option to program the ATtiny85 in several ways: no bootloader, Optiboot, and Micronucleus (Digispark) modes.  If you need help in installing the ATTinyCore, please see <a href="https://cyberblogspot.com/how-to-install-attinycore-on-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Install ATTinyCore on Arduino IDE</a>.</p>



<p><strong>STEP 4 &#8211; Use Software Serial to Create UART Ports on ATtiny85</strong></p>



<p>Open the Arduino IDE and upload the sketch shown below.  If you need help in uploading the sketch using the board core ATtinyCore, you may visit <a href="https://cyberblogspot.com/how-to-program-digispark-attiny85-board-with-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Program Digispark ATtiny85 Board with Arduino IDE</a>.</p>



<p><strong>IMPORTANT NOTE</strong><br>Before hitting the Upload button to install the sketch, unplug <strong>both</strong> USB cables for the Digispark board and the USB-to-serial converter.  Plug in the USB cable for the Digispark board when prompted by the Arduino IDE.  When the sketch upload is done, unplug the USB cable from the Digispark board.  Connect the USB cable for the USB-to-serial converter and proceed to STEP 5 for testing the Serial Monitor. </p>



<pre class="EnlighterJSRAW">/* cyberblogspot.com 15Jan2023 */

#include &quot;SoftwareSerial.h&quot;

SoftwareSerial mySerial(1, 0);  //RX, TX  PB1, PB0

void setup() { 
  mySerial.begin(19200);
  
  mySerial.println(&quot;Change baud rate to 19200&quot;);
  mySerial.println(&quot;Type something and press ENTER&quot;);
}

void loop() {
  if (mySerial.available()){
    mySerial.println(mySerial.readString());
  }
}</pre>



<p></p>



<p>The sketch above needs no explanation.  Simply include the library header file for the SoftwareSerial library.  You do not have to download the SofwareSerial library as it should come with the ATtinyCore board core installation.</p>



<p>Regarding the code creating the SoftwareSerial object in line 5, </p>



<p>SoftwareSerial mySerial(1, 0);  //RX, TX  PB1, PB0</p>



<p>you may use any two (2) available ATtiny85 ports available.  In this case, I used PB1 for RX (receiver) and PB0 for TX (transmitter).</p>



<p><strong>STEP 5 &#8211; Test the Serial Monitor</strong></p>



<p>After uploading the sketch to the Digispark ATtiny85 board, unplug the USB cable from the Digispark board.  Plug in the USB cable for the USB-to-serial converter. </p>



<p>Then, select the correct COM port for your USB-to-serial converter in the Arduino IDE &#8220;Tools/Port&#8221; menu.  Test the program and you should now be able to use the Serial Monitor on the Digispark ATtiny85 board.</p>



<h2 class="wp-block-heading">References on How to Enable Serial Monitor on Digispark ATtiny85</h2>



<p><a href="https://en.wikipedia.org/wiki/USB-to-serial_adapter#:~:text=Most%20commonly%20the%20USB%20data,RS423%20adapters%20are%20less%20common." target="_blank" rel="noreferrer noopener">USB-to-serial adapter </a> &#8211; Wikipedia article on USB to Serial Converter<br><a href="https://cyberblogspot.com/how-to-install-arduino-ide-on-windows-10/" target="_blank" rel="noreferrer noopener">How to Install Arduino IDE on Windows 10</a><br><a href="https://cyberblogspot.com/how-to-install-attinycore-on-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Install ATTinyCore on Arduino IDE</a><br><a href="https://cyberblogspot.com/how-to-use-arduino-as-isp-programmer/" target="_blank" rel="noreferrer noopener">How to Use Arduino as ISP Programmer</a><br><a href="https://cyberblogspot.com/how-to-program-attiny85-with-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Program ATtiny85 with Arduino IDE</a><br><a href="https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/" target="_blank" rel="noreferrer noopener">Digispark ATtiny85 Pinout and Configuration</a><br><a href="https://cyberblogspot.com/how-to-program-digispark-attiny85-board-with-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Program Digispark ATtiny85 Board with Arduino IDE</a><br><a href="https://cyberblogspot.com/digispark-usb-device-not-recognized/" target="_blank" rel="noreferrer noopener">Digispark USB Device Not Recognized</a><br><a href="https://cyberblogspot.com/how-to-use-at-09-ble-with-arduino-and-smartphone/" target="_blank" rel="noreferrer noopener">How to Use AT-09 BLE with Arduino and Smartphone</a></p>
<p>The post <a href="https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/">How to Enable Serial Monitor on Digispark ATtiny85</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cyberblogspot.com/how-to-enable-serial-monitor-on-digispark-attiny85/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Digispark ATtiny85 Pinout and Configuration</title>
		<link>https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/</link>
					<comments>https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 09 Jan 2023 20:52:39 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ADC]]></category>
		<category><![CDATA[Analog to Digital Converter]]></category>
		<category><![CDATA[Arduino IDE]]></category>
		<category><![CDATA[ATtiny85]]></category>
		<category><![CDATA[ATtiny85 Breakout]]></category>
		<category><![CDATA[Digispark]]></category>
		<category><![CDATA[Digispark ATtiny85]]></category>
		<category><![CDATA[Digispark ATtiny85 Development Board]]></category>
		<category><![CDATA[Digispark ATtiny85 Pinout]]></category>
		<category><![CDATA[Digispark ATtiny85 Schematic Diagram]]></category>
		<category><![CDATA[Digistump]]></category>
		<category><![CDATA[Digital I/O]]></category>
		<category><![CDATA[Hardware Interrupt]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[Inter-Integrated Circuit]]></category>
		<category><![CDATA[Pin Change Interrupt]]></category>
		<category><![CDATA[Port B]]></category>
		<category><![CDATA[Pulse Width Modulation]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[Serial Peripheral Interface]]></category>
		<category><![CDATA[SPI]]></category>
		<category><![CDATA[Universal Serial Bus]]></category>
		<category><![CDATA[USB]]></category>
		<guid isPermaLink="false">https://cyberblogspot.com/?p=5533</guid>

					<description><![CDATA[<p>A Digispark ATtiny85 development board is a microcontroller board with an ATtiny85 MCU chip. It is a favorite board for projects that require a small number of GPIOs. The board is basically an ATtiny85 chip that is provided with a voltage regulator and a USB interface. We will take a look at the Digispark ATtiny85&#8230;&#160;<a href="https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Digispark ATtiny85 Pinout and Configuration</span></a></p>
<p>The post <a href="https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/">Digispark ATtiny85 Pinout and Configuration</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>A Digispark ATtiny85 development board is a microcontroller board with an ATtiny85 MCU chip.  It is a favorite board for projects that require a small number of GPIOs.  The board is basically an ATtiny85 chip that is provided with a voltage regulator and a USB interface.  We will take a look at the Digispark ATtiny85 pinout and the different configurations that it has to offer. </p>



<h2 class="wp-block-heading">Types of Digispark Boards</h2>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-types-jpg.webp"><img loading="lazy" decoding="async" width="802" height="486" src="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-types-jpg.webp" alt="A picture showing two (2) versions of Digispark ATtiny85 with the same pinout or configuration " class="wp-image-5550" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-types-jpg.webp 802w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-types-300x182.webp 300w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-types-768x465.webp 768w" sizes="auto, (max-width: 802px) 100vw, 802px" /></a><figcaption class="wp-element-caption">Figure 1.  USB Type-A Interface and Micro-USB Interface</figcaption></figure></div>


<p>Figure 1 shows the two (2) popular versions of the Digispark ATtiny85 development boards.  The one on the left uses a type-A USB connector to connect directly to the USB port of a PC or a laptop.  On the other hand, the board on the right has a micro-USB connector.  As a result, we need a micro-USB cable to connect this to a computer for programming purposes.  </p>



<p>It should be observed that both boards have the same pin layout.  We can breadboard them as long as we do not connect a header pin to the VIN terminal.     </p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-jpg.webp"><img loading="lazy" decoding="async" src="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-752x1024.webp" alt="A picture of another version of Digispark ATtiny85 development board" class="wp-image-5553" width="376" height="512" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-752x1024.webp 752w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-220x300.webp 220w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-768x1045.webp 768w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-type3-jpg.webp 800w" sizes="auto, (max-width: 376px) 100vw, 376px" /></a><figcaption class="wp-element-caption">Figure 2.  Another Type of Digispark ATtiny85</figcaption></figure></div>


<p>Figure 2 is a picture of another type of Digispark ATtiny85 board.  As shown in the picture, the board does not have an ATtiny85 chip but instead only an 8-pin DIP socket.  We must provide a DIP-type ATtiny85 chip in order to use this board.  Also, the pin layout of this board is different.  This board is not breadboard friendly.  However, the pin layout is ICSP-programmer ready.  That is, the pins are arranged so as to accept the female connector of an AVR ICSP-programmer. </p>



<p>It must be mentioned here that technically, this board is not (yet) a Digispark ATtiny85 board.  A Digispark ATtiny85 board has an ATtiny85 chip that was burned with a Micronucleus bootloader.  In order to make this board a Digispark board, it needs an ATtiny85 chip that was pre-programmed with a Micronucleus bootloader.  Otherwise, an ATtiny85 without a bootloader can be inserted into the DIP socket and an ICSP programmer is used to burn a new Micronucleus bootloader into it.     </p>



<h2 class="wp-block-heading">Digispark ATtiny85 Specifications</h2>



<ul class="wp-block-list">
<li>Support for the&nbsp;Arduino&nbsp;IDE 1.0+ (OSX/Win/Linux)</li>



<li>Power via USB or External Source &#8211; 5v or 7-35v (12v or less recommended, automatic selection)</li>



<li>On-board 500ma 5V Regulator</li>



<li>Built-in USB</li>



<li>6 I/O Pins (2 are used for USB only if your program actively communicates over USB, otherwise you can use all 6 even if you are programming via USB)</li>



<li>8k Flash Memory (about 6k after bootloader)</li>



<li>I2C and SPI (vis USI)</li>



<li>PWM on 3 pins (more possible with Software PWM)</li>



<li>ADC on 4 pins</li>



<li>Power LED and Test/Status LED</li>
</ul>



<h2 class="wp-block-heading">Digispark ATtiny85 Pinout</h2>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-pinout-original_final.png"><img loading="lazy" decoding="async" width="802" height="602" src="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-pinout-original_final.png" alt="A picture showing the Digispark ATtiny85 pinout and configuration of its physical pins, digital I/O, ADC ports, and other pertinent information" class="wp-image-5546" srcset="https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-pinout-original_final.png 802w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-pinout-original_final-300x225.png 300w, https://cyberblogspot.com/wp-content/uploads/2023/01/digispark-attiny85-pinout-original_final-768x576.png 768w" sizes="auto, (max-width: 802px) 100vw, 802px" /></a><figcaption class="wp-element-caption">Figure 3.  Digispark ATtiny85 Pinout</figcaption></figure></div>


<h2 class="wp-block-heading">Digispark ATtiny85 Pinout Description</h2>



<h3 class="wp-block-heading">ATtiny85 Breakout</h3>



<p>First of all, by referring to Figure 3, you will notice that the Digispark board serves as a breakout board for the ATtiny85 chip.  All of the eight pins of the ATtiny85 chip are accessible.  The physical pins of the ATtiny5 chip are designated by the gray-colored pinouts numbered 1 to 8.</p>



<h3 class="wp-block-heading">Six (6) Digital I/O Pins</h3>



<p>As per specification, the Digispark ATtiny85 board can be configured to use six (6) digital I/O ports.  These ports are shown in Figure 3 as yellow pins, labeled PB0 to PB5.  <strong>NOTE</strong>: Port B pin PB5 is by default configured as a RESET pin.  In order to use PB5 as an I/O port, an ATtiny85 fuse (RSTDISBL) has to be reset (changed from 1 to 0).  Please see <em>How to Reset ATtiny85 Fuses</em>. </p>



<h4 class="wp-block-heading">Arduino IDE Programming Notes</h4>



<p>In the Arduino IDE, pins PB0 to PB5, when used as digital I/O are referred to as 0 to 5.  That is,</p>



<pre class="EnlighterJSRAW">/*
cyberblogspot.com 09Jan2023
*/

bool a, b, c;

void setup() {
  // put your setup code here, to run once:
  pinMode(0, INPUT);   //set PB0 as input
  pinMode(1, INPUT);   //set PB1 as input
  pinMode(2, INPUT);   //set PB2 as input
  pinMode(3, OUTPUT);  //set PB3 as output
  pinMode(4, OUTPUT);  //set PB4 as output
  pinMode(5, OUTPUT);  //set PB5 as output
}

void loop() {
  // put your main code here, to run repeatedly:
  a = digitalRead(0);     //read PB0
  b = digitalRead(1);     //read PB1
  c = digitalRead(2);     //read PB2
  digitalWrite(3, LOW);   //set PB3 LOW
  digitalWrite(4, LOW);   //set PB4 LOW
  digitalWrite(5, HIGH);  //set PB5 HIGH
}</pre>



<h3 class="wp-block-heading">Four (4) Analog to Digital Converter (ADC) Ports</h3>



<p>Port B ports PB2 to PB5 can be configured as analog inputs.  These pins are shown in Figure 3 as orange pins.  The pins are labeled ADC0 to ADC3.  Be aware that the Port B numbers do not exactly match the ADC port numbers.  In other words, PB2 does not correspond ADC2, PB3 does not correspond to ADC3, and so on.  Instead,</p>



<ul class="wp-block-list">
<li>ADC0 is PB5</li>



<li>ADC1 is PB2</li>



<li>ADC2 is PB4</li>



<li>ADC3 is PB3</li>
</ul>



<h4 class="wp-block-heading">Arduino IDE Programming Notes</h4>



<p>When using the command <strong>analogRead()</strong>, Arduino IDE assumes you are using the ADC port numbers (0 for ADC0, 1 for ADC1, 2 for ADC2, and 3 for ADC3) and NOT the Port B numbers (0 for PB0, 1 for PB1, 2 for PB2, 3 for PB3, 4 for PB4, and 5 for PB5).  However, the <strong>pinMode()</strong> command expects you to use the Port B numbers.  This is one of ATtiny85&#8217;s peculiarities that is very confusing.  The example code below should clear this up. </p>



<pre class="EnlighterJSRAW">/*
cyberblogspot.com 09Jan2023
*/

int a, b, c, d;

void setup() {
// put your setup code here, to run once:
// the following four lines of code are actually not needed
// because by default the I/O pins are in Hi-Z INPUT mode
pinMode(2, INPUT); //set PB2 as input
pinMode(3, INPUT); //set PB3 as input
pinMode(4, INPUT); //set PB4 as input
pinMode(5, INPUT); //set PB5 as input
}

void loop() {
// put your main code here, to run repeatedly:
a = analogRead(0); //read ADC0 which is in PB5
b = analogRead(1); //read ADC1 which is in PB2
c = analogRead(2); //read ADC2 which is in PB4
d = analogRead(3); //read ADC3 which is in PB3
}</pre>



<h3 class="wp-block-heading">Three (3) Pulse Width Modulation (PWM) Outputs</h3>



<p>Referring again to Figure 3, there are three (3) PWM outputs available on Digispark ATtiny85 boards.  These are colored green in the pinout shown above and are labeled as PWM0, PWM1, and PWM4.  There is no typo error here.  The third PWM output is labeled as PWM4 because the PWM port numbers use the same Port B numbers.  To clarify, </p>



<ul class="wp-block-list">
<li>PWM0 is PB0</li>



<li>PWM1 is PB1</li>



<li>PWM4 is PB4</li>
</ul>



<h4 class="wp-block-heading">Arduino IDE Programming Notes</h4>



<p>The PWM output signal is generated by the command <strong>analogWrite()</strong>.  Although we are going to use the ports as analog outputs, we DO NOT use the ADC port numbers.  Rather, we use the PWM port numbers which are the same as the Port B numbers.  In other words, we are also using the Port B numbers in programming PWM in the Arduino IDE.  Please take a look at the following sketch.</p>



<pre class="EnlighterJSRAW">/*
cyberblogspot.com 09Jan2023
*/

void setup() {
  // put your setup code here, to run once:
  pinMode(0, OUTPUT);  //set PB0 (PWM0) as output  
  pinMode(1, OUTPUT;  //set PB1 (PWM1) as output
  pinMode(4, OUTPUT);  //set PB4 (PWM4) as output
}

void loop() {
  // put your main code here, to run repeatedly:
  analogWrite(0, 255);  //100% duty cycle PWM on PB0
  analogWrite(1, 128);  //50% duty cycle PWM on PB1
  analogWrite(4, 0);    //0% duty cycle PWM on PB4
}</pre>



<h2 class="wp-block-heading">SPI (Serial Peripheral Interface) Communication</h2>



<p>Ports PB0, PB1, and PB2 can be used for SPI communication:</p>



<ul class="wp-block-list">
<li>MOSI &#8211; PB0</li>



<li>MISO &#8211; PB1</li>



<li>SCLK &#8211; PB2 </li>
</ul>



<h2 class="wp-block-heading">I<sup>2</sup>C (Inter-Integrated Circuit) Communication</h2>



<p>Ports PB0 and PB2 can be used for I2C communication:</p>



<ul class="wp-block-list">
<li>SDA &#8211; PB0</li>



<li>SCK &#8211; PB2</li>
</ul>



<h2 class="wp-block-heading">USB (Universal Serial Bus) Communication</h2>



<p>Ports PB3 and PB4 can be used for USB communication:</p>



<ul class="wp-block-list">
<li>USB- is PB4</li>



<li>USB+ is PB3</li>
</ul>



<h2 class="wp-block-heading">Pin Change Interrupt and External Interrupt</h2>



<p>Finally, ports PB0 to PB5 can all be used for pin change interrupt and PB2 as external interrupt pin.</p>



<h2 class="wp-block-heading">Final Notes on Port B Pins</h2>



<p>PB5 has limited current sourcing capacity.  Also, when it is at output HIGH, it generates 3V instead of 5V on its output.</p>



<p>PB3 and PB4 are both used during programming (sketch upload).  Therefore, it may be necessary to temporarily disconnect the circuits connected to them to avoid interfering with the uploading of sketches.  Additionally, PB3 has a 1.5K pull-up resistor that is used for USB communication.</p>



<p>PB0 or PB1 has the built-in LED attached to it.  Version A boards use PB1 while version B boards use PB0.</p>



<h2 class="wp-block-heading">Digispark ATtiny85 Schematic Diagram</h2>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/01/digispark-schematic.png"><img loading="lazy" decoding="async" width="1002" height="577" src="https://cyberblogspot.com/wp-content/uploads/2022/01/digispark-schematic.png" alt="Schematic diagram of Digispark ATtiny85 whose pinout and configurations are described in this article" class="wp-image-5014" srcset="https://cyberblogspot.com/wp-content/uploads/2022/01/digispark-schematic.png 1002w, https://cyberblogspot.com/wp-content/uploads/2022/01/digispark-schematic-300x173.png 300w, https://cyberblogspot.com/wp-content/uploads/2022/01/digispark-schematic-768x442.png 768w" sizes="auto, (max-width: 1002px) 100vw, 1002px" /></a><figcaption class="wp-element-caption">Figure 4. Digispark ATtiny85 Schematic Diagram</figcaption></figure></div>


<h2 class="wp-block-heading">References on Digispark ATtiny85 Pinout and Configuration</h2>



<p><a href="http://digistump.com/wiki/digispark" target="_blank" rel="noreferrer noopener">http://digistump.com/wiki/digispark</a><br><a href="https://diyusthad.com/2021/07/digispark-attiny85.html" target="_blank" rel="noreferrer noopener">ATtiny85 External and Pin Change Interrupt</a><br><a href="https://cyberblogspot.com/how-to-install-arduino-ide-on-windows-10/" target="_blank" rel="noreferrer noopener">How to Install Arduino IDE on Windows 10</a><br><a href="https://cyberblogspot.com/how-to-install-attinycore-on-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Install ATTinyCore on Arduino IDE</a><br><a href="https://cyberblogspot.com/how-to-program-attiny85-with-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Program ATtiny85 with Arduino IDE</a><br><a href="https://cyberblogspot.com/how-to-program-digispark-attiny85-board-with-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Program Digispark ATtiny85 Board with Arduino IDE</a><br><a href="https://cyberblogspot.com/digispark-usb-device-not-recognized/" target="_blank" rel="noreferrer noopener">Digispark USB Device Not Recognized</a><br><a href="https://cyberblogspot.com/how-to-use-at-09-ble-with-arduino-and-smartphone/" target="_blank" rel="noreferrer noopener">How to Use AT-09 BLE with Arduino and Smartphone</a></p>



<p> </p>



<p> </p>
<p>The post <a href="https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/">Digispark ATtiny85 Pinout and Configuration</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cyberblogspot.com/digispark-attiny85-pinout-and-configuration/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Digispark USB Device Not Recognized</title>
		<link>https://cyberblogspot.com/digispark-usb-device-not-recognized/</link>
					<comments>https://cyberblogspot.com/digispark-usb-device-not-recognized/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 29 Dec 2022 07:55:23 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino IDE]]></category>
		<category><![CDATA[ATtiny85]]></category>
		<category><![CDATA[ATtiny85 Digispark]]></category>
		<category><![CDATA[ATTinyCore]]></category>
		<category><![CDATA[Digispark]]></category>
		<category><![CDATA[libusb]]></category>
		<category><![CDATA[libusb device driver]]></category>
		<category><![CDATA[Micronucleus]]></category>
		<category><![CDATA[Micronucleus bootloader]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[USB device not recognized]]></category>
		<category><![CDATA[zadig]]></category>
		<guid isPermaLink="false">https://cyberblogspot.com/?p=5280</guid>

					<description><![CDATA[<p>When inserting an ATtiny85 Digispark board on a USB port of a PC running Windows 10, the error &#8220;USB device not recognized&#8221; pops up. There are only two reasons for this error, assuming your ATtiny85 Digispark board is still good. One, the Windows device driver for Digispark is not installed. And two, the Digispark board&#8230;&#160;<a href="https://cyberblogspot.com/digispark-usb-device-not-recognized/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Digispark USB Device Not Recognized</span></a></p>
<p>The post <a href="https://cyberblogspot.com/digispark-usb-device-not-recognized/">Digispark USB Device Not Recognized</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/windows-error-usb-device-not-recognized.jpg"><img loading="lazy" decoding="async" width="361" height="146" src="https://cyberblogspot.com/wp-content/uploads/2022/12/windows-error-usb-device-not-recognized.jpg" alt="Screenshot of the Windows 10 error saying &quot;USB device not recognized&quot;" class="wp-image-5281" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/windows-error-usb-device-not-recognized.jpg 361w, https://cyberblogspot.com/wp-content/uploads/2022/12/windows-error-usb-device-not-recognized-300x121.jpg 300w" sizes="auto, (max-width: 361px) 100vw, 361px" /></a><figcaption>Figure 1.  Windows Error:  USB Device Not Recognized</figcaption></figure></div>


<p>When inserting an ATtiny85 Digispark board on a USB port of a PC running Windows 10, the error &#8220;USB device not recognized&#8221; pops up.  There are only two reasons for this error, assuming your ATtiny85 Digispark board is still good.  One, the Windows device driver for Digispark is not installed.  And two, the Digispark board does not have the required Micronucleus bootloader installed on it.  </p>



<h2 class="wp-block-heading">Solution 1 &#8211; Install the Device Driver for the Digispark Board</h2>



<p>Download and install the Windows device driver for Digispark.  You can find the latest version here: <a href="https://github.com/digistump/DigistumpArduino/releases" target="_blank" rel="noreferrer noopener">Digistump Arduino Release 1.6.7</a>.  Also, an alternative is to download and install <a href="https://zadig.akeo.ie/" target="_blank" rel="noreferrer noopener">Zadig</a>.  It is an application software for installing generic USB device drivers which include libusb, the device driver for Digispark boards. </p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/device-driver-manager-libusb.png"><img loading="lazy" decoding="async" width="445" height="406" src="https://cyberblogspot.com/wp-content/uploads/2022/12/device-driver-manager-libusb.png" alt="Screenshot of annotated Windows Device Manager showing the libusb device driver after installing the Digispark device driver to fix the Digispark USB device not recognized error " class="wp-image-5283" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/device-driver-manager-libusb.png 445w, https://cyberblogspot.com/wp-content/uploads/2022/12/device-driver-manager-libusb-300x274.png 300w" sizes="auto, (max-width: 445px) 100vw, 445px" /></a><figcaption>Figure 2.  Windows Device Manager Showing the Digispark Bootloader</figcaption></figure></div>


<p>After successfully installing the device driver, you should see the libusb device driver when you open the Windows Device Manager.  See Figure 2 above.</p>



<p>If the error &#8220;USB device not recognized&#8221; still appears when you plug in the Digispark board, proceed to solution 2.</p>



<h2 class="wp-block-heading">Solution 2 &#8211; Install the Micronucleus Bootloader</h2>



<p>In order to install the Micronucleus bootloader, you will need an ICSP (In-Circuit Serial Programmer) programmer.  Examples of ICSP programmers are USBtinyISP, USBasp, and Arduino as ISP.  Additionally, you will need to install ATtinyCore on the Arduino IDE.  The following instructions assumes you have wired your Digispark board with an ICSP programmer and have already installed the ATtinyCore on the Arduino IDE.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>For help on how to install ATtinyCore, please see <a href="https://cyberblogspot.com/how-to-install-attinycore-on-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Install ATTinyCore on Arduino IDE</a>.</p></blockquote>



<p><strong>STEP 1 &#8211; SELECT THE BOARD &#8211; ATtiny85(Micronucleus/Digispark)</strong></p>



<p>Open the Arduino IDE and select the proper board: <strong>ATtiny85(Micronucleus/Digispark)</strong>, see Figure 3 below.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-board.png"><img loading="lazy" decoding="async" width="1000" height="726" src="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-board.png" alt="A picture of Arduino IDE showing how to select the ATtiny85 board" class="wp-image-5289" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-board.png 1000w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-board-300x218.png 300w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-board-768x558.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a><figcaption>Figure 3.  Board Selection in Arduino IDE </figcaption></figure></div>


<p><strong>STEP 2 &#8211; SELECT THE PROGRAMMER</strong></p>



<p>On the Arduino IDE main menu, go Tools -&gt; Programmer and then select the ICSP programmer you are using.  In my case, I am using a USBasp programmer, so I select <strong>USBasp(ATtinyCore)</strong>.    </p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-programmer.png"><img loading="lazy" decoding="async" width="1000" height="727" src="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-programmer.png" alt="Another screenshot of the Arduino IDE showing how to select the programmer to use in order to fix the Digispark USB device not recognized error" class="wp-image-5290" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-programmer.png 1000w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-programmer-300x218.png 300w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-programmer-768x558.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a><figcaption>Figure 4.  Selecting the Programmer in Arduino IDE</figcaption></figure></div>


<p><strong>STEP 3 &#8211; SELECT THE BURN BOOTLOADER METHOD</strong></p>



<p>The next step is to select the Burn Bootloader method.  We must select &#8220;Fresh Install (Via ISP)&#8221; because we are installing a new bootloader via the ICSP (ISP) programmer and not thru the USB interface.  Please see illustration in Figure 5.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-burn-bootloader-method.png"><img loading="lazy" decoding="async" width="1000" height="727" src="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-burn-bootloader-method.png" alt="Screenshot of Arduino IDE illustrating how to choose the Burn Bootloader Method" class="wp-image-5291" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-burn-bootloader-method.png 1000w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-burn-bootloader-method-300x218.png 300w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-select-burn-bootloader-method-768x558.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a><figcaption>Figure 5.  Arduino IDE Showing How to Select Burn Bootloader Method</figcaption></figure></div>


<p><strong>STEP 4 &#8211; SELECT BURN BOOTLOADER</strong></p>



<p>Finally, we start the bootloader installation by clicking on &#8220;Burn Bootloader&#8221;, see Figure 6.  However, you may want to change other options prior to burning the bootloader.  You may change the Clock, Timer1 Clock, LTO, millis()/micros(), and BOD as indicated on the menu.  But <strong>do not change</strong> the &#8220;Reset Pin&#8221; which is currently set to &#8220;Reset&#8221;, unless you know what you are doing.  Changing the &#8220;Reset Pin&#8221; to &#8220;GPIO&#8221; will disable ICSP programming.  As a consequence, you will not be able to access the Digispark board again using an ICSP programmer.  You will need a High-Voltage programmer to reprogram the ATtiny85&#8217;s fuses in order re-enable ICSP programming.  </p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><a href="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-burn-bootloader.png"><img loading="lazy" decoding="async" width="1000" height="523" src="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-burn-bootloader.png" alt="Screenshot of Arduino IDE showing how to burn the Micronucleus bootloader on an ATtiny85 Digispark board thereby fix the Digispark USB device not recognized error" class="wp-image-5292" srcset="https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-burn-bootloader.png 1000w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-burn-bootloader-300x157.png 300w, https://cyberblogspot.com/wp-content/uploads/2022/12/arduino-ide-burn-bootloader-768x402.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a><figcaption>Figure 6.  Illustrating Burn Bootloader in Arduino IDE</figcaption></figure></div>


<h2 class="wp-block-heading">Final Notes on Digispark USB Device Not Recognized</h2>



<p>It is very easy to fix the Windows error &#8220;USB device not recognized&#8221; that appears every time an ATtiny85 Digispark board is inserted on a USB port.  The error is caused by either a missing Windows device driver or a missing Micronucleus bootloader.  The solution is to install the Digispark Windows device driver and/or burn a new Micronucleus bootloader onto the ATtiny85.</p>



<h2 class="wp-block-heading">References on Digispark USB Device Not Recognized</h2>



<p><a href="https://cyberblogspot.com/how-to-install-attinycore-on-arduino-ide/" target="_blank" rel="noreferrer noopener">How to Install ATTinyCore on Arduino IDE</a><br><a href="http://digistump.com/products/1" target="_blank" rel="noreferrer noopener">Digispark USB Development Board</a></p>
<p>The post <a href="https://cyberblogspot.com/digispark-usb-device-not-recognized/">Digispark USB Device Not Recognized</a> appeared first on <a href="https://cyberblogspot.com">CyberBlogSpot</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cyberblogspot.com/digispark-usb-device-not-recognized/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
