CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account
You are here: Home / GizmoBlog

January 30, 2009 by robert Leave a Comment

U401 / U421 Versatile Interface Capabilities

The U401 and U421 USB Interface from USBmicro are an easy way to interface a number of real-world devices to the PC (or Mac/Linux). The U401 and U421 currently have a number of very useful interfacing features.

The USBmicro U401/U421 can be programmed to be simple digital i/o. There are two 8-bit ports on the device that can control 8 bits / 1 port at a time, or individually on a bit-by-bit (each i/o line) basis. There are two commands that set port A and port B i/o directions. The individual lines of the port can be set to inputs or outputs on a per line basis, but the command to set the direction operates on an entire port. The ports can be read with two distinct port read commands. The state of the lines that are set as inputs are returned with the read command. The state of any line that is not set as an input is undetermined and should be ignored.

The ports, when set as outputs, can be written on a byte-wide basis with two distinct port write commands. Also, individual line states may be changed with a set of commands that mask the port state and affect only user-specified lines. This effectively allowsing for bit writes.

Commands to these devices allow for a byte write to one port, while strobing a user-selected line from another port. The strobe can be either negative-going or positive-going. This feature allows a full byte-wide data transfer.

These general i/o commands will let you interface a wide number of devices to your computer. Many “real-world” devices can then present detectable signals to the PC, or can be controlled by signals from the PC.

LCD Interface

Along with the more manual way to interface devices using the general i/o commands, the U401/U421 provide some useful commands that can be thought of as “compound commands”. An LCD, for example, could be interfaced and controlled with the regular i/o commands. The USBm.dll provides function calls that make it a bit easier to interface a standard Hitachi-type of intelligent LCD controller to USB. These commands support communication to the LCD module with a single function call that performs multiple i/o steps. LCD commands include writing characters to the display, and controlling the display (initializing, clearing, moving cursor, etc).

SPI Master

The U401/U421 can be used as an interface to Serial Peripheral Interface (SPI) devices. The firmware of the device provides generic access to read and write many different types of SPI devices. The SPI clock rate transmitted from the device can be adjusted to 62.5 kHz, 500 kHz, 1 MHz, or 2 MHz. The master SPI interface consists of the SPI clock (SCK), Master Out / Slave In (MOSI), and Master In / Slave Out lines. MOSI is the U401 or U421 line that moves information out of the USB device to the SPI slave device. The MISO line is the data line on which the USB device receives data from the slave device. Additional pins are available as generic i/o; the U401/U421 can use these lines as slave select lines (often called “chip select”) to address multiple SPI devices.

SPI Slave

The U401/U421 can be operated as a SPI slave device. A microcontroller circuit external to the device can transfer data via SPI into the U401/U421. The data can then be read from the PC (Win/Linux) or Mac (OSX) with an application. The external processor could be, for example, a PIC or AVR that performs data collection and filtering from an analog sensor, and transfers readings to the PC (Win/Linux) or Mac (OSX) via the U401/U421.

Stepper Motor Control

The U401/U421 can be operated as a two channel stepper motor controller. Through an appropriate voltage/current driver interface, the U401 or U421 can interface to various types of stepper motors. The USB interface device supports the stepper sequences of “Wave”, “Full”, or “Half” with control over direction, speed, and step count.

1-Wire Interface

The U401/U421 can interface with Dallas/Maxim(R) 1-wire devices (temperature sensors, i/o ports, etc) either on each individual U401 or U421 device pin, or on a bus of multiple 1-wire devices.

This is a very versatile interface and a premium way to connect a PC to real-world devices.

Filed Under: Uncategorized Tagged With: 1-Wire, LCD, SPI, Stepper Motor, u401, u421

January 20, 2009 by robert Leave a Comment

U401 and Solderless Prototype Boards

If you use solderless prototype boards (solderless breadboards) for circuit testing, the USBmicro U401 (#CGU401) combined with a 30-pin header (#CGPINHEAD30) is a great way for you to connect a test circuit built on a solderless prototype board to your PC.

The one-tenth inch on center pin spacing of the U401 lends itself well to fit to a solderless prototype board that has the same contact spacing on its rows of pins:

Example of using a U401 with a prototype board.

All it takes is a little bit of soldering to attach the 30 pin header to the edge of the U401. From CircuitGizmos you can obtain both the U401 and the 30 pin header:

CircuitGizmos: #CGU401

CircuitGizmos: #CGPINHEAD30

Soldered in place, the U401 will plug into the solderless prototype board from positions 1 to 30, as shown below:

U401 inserted into a solderless prototype board and providing 5V from the USB connection to power three LEDs.

Note in this picture that pin 7 of the U401 is +5V from the USB connection and that pin 9 is ground. I have made the connections from these pins to the power and ground bus of the prototype board. The LEDs in this picture are just hooked up to power and ground to light constantly.

Now PC control of circuits in a solderless prototype board is as easy as this!

Filed Under: Uncategorized Tagged With: LED, protoboard, solderless, u401

January 13, 2009 by robert Leave a Comment

The U401 / U421 USB Interface

The U401 and U421 USB Interface from USBmicro are an easy way to interface a number of real-world devices to the PC (or Mac/Linux). In many cases control of something as simple and straight forward as a relay from a PC would require more than just a minimum amount of effort. The U401 (U421) make this very straight forward. This control project can be done using two components available from CircuitGizmos (GCU401 or CGU421 and CGRELAY1).

The U401 and the U421 have different shapes. The U421 is a “DIP” (Dual In-line Package) while the U401 is a SIP (Single In-line Package). This just means that one device has two rows of 12 pins spaced over a half inch apart, while the other has 30 pins all in a single row. The U401 sold here also has a thin, removable USB cable. The firmware on the devices are the same.

Here is a U421 pictured:

CircuitGizmos: cgu421

And here is the U401:

CircuitGizmos: cgu401

When you plug a U401 or U421 (generically called a U4x1) into a Windows PC (or Mac/Linux), it is recognized by the operating system and the OS connects the U4x1 to a driver. This is the HID (Human Interface Device) driver that is part of the operating system. No extra drivers need to be installed.

For this Gizmo project I will simply control one single output of a U4x1 to turn on (and off!) a single relay. I’ll use the schematic on the USBmicro site as a guide, and use one the the CircuitGizmo relays powered by 12 volts. I’ll also make use of the free application software to control the relay.

This is the CircuitGizmos relay:

CircuitGizmos: cgrelay1

The picture shows two relays in order to see all sides of the relay. A relay is a coil of wire that when magnetized closes a switch. The connections to the coil are shown below by the light blue arrows, while the contact/switch connections are shown in green:

cgrelay1pins

Applying 12 volts across the coil will close the contact of the relay. The contact, of course, can switch a higher voltage. This relay could be used to switch on a 120VAC light, for instance. The U4x1 by itself can’t switch on a light, but can control this relay to do the job.

Actually the U4x1 doesn’t even directly turn on this relay. The output that the U4x1 has can’t drive the coil directly, so the job needs to be done with an additional device. Take a look at the example schematic from USBmicro:

relayschematic

This schematic shows the relay contact/switch off to the right. That can be the switch that switches on the 120VAC light. The relay is shown in the middle (and in that case has a series resistor – not needed in this case) the connection to the U4x1 on the left. The coil driver in that small schematic is a 74LS07. A single NPN transistor could be used, as could a FET. For this project I choose to drive the relay coil with a ULN2803:

uln2803

The ULN2803 is a device that comes in a DIP package with 18 pins. The ULN2803 would support driving 8 relays. For this project a single port line of the U4x1 USB Interface connects to pin 1 of the ULN2803. The ULN2803 is connected to ground at pin 9. If the U4x1 is connected to pin 1, then the output associated with pin 1 is pin 18. That is connected to one of the relay coil connections. The other relay coil connection is connected to a 12 volt supply. When the U4x1 turns on the driver, the coil is energized and closes the contact. Whatever you have connected to the relay would be turned on.

The output test application can control the U4x1 and is available from USBmicro. There is a screen shot here:

outapp

This Gizmo project showed quickly how a relay can be controlled by a PC with two of the products that you can get here at CircuitGizmos. Using a driver like the ULN2803, you can see how easy it would be to expand on the device and have a project that could control up to 16 relays per single U4x1. The example application gives you a boost to be able to check out your USB project’s hardware. Control of the U4x1 can be done through quite a few different languages.

 

Filed Under: Uncategorized Tagged With: output, relay, u401, u421, uln2803

  • « Previous Page
  • 1
  • …
  • 13
  • 14
  • 15

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2021 · Generate Pro Theme on Genesis Framework · WordPress · Log in