However, since I was not going to use the USB anyway, I could repurpose the two USB data lines, which were connected to PB0 and PB1, for a software emulated UART. The ATmega8 has a hardware UART module, but unfortunately, its hard-wired pins PD0 and PD1 were occupied by the relays. I wanted to be able to control the relays through UART (like the Serial object in Arduino and its associated RX/TX pins). The considerate Chinese did not put any protection there. When the Atmel Studio IDE identified the ATmega8, before anything else I downloaded and backed up the FLASH and EEPROM contents of the MCU, in case I wanted to restore them later. This was neither the easiest nor the prettiest soldering job I’ve ever done, but it was enough to give me the access I needed for the AVR programmer. I soldered the four others to their place, and then soldered a very thin enameled copper wire from the RESET pin of the MCU to the raised header pin. I took a 5-pin male header, and pushed the last pin up through its little plastic holder until it was flush. Unfortunately, there was no hole for the RESET pin (PC6) which I also need. With the aid of the ATmega8’s datasheet I traced these back to pins PB2-5, and that made me happy, because these turned out to include the SPI pins (called MISO, MOSI and SCK) through which I can reprogram the MCU. Near the MCU there was a row of four promising, unpopulated holes. Obviously, the MCU was programmed to emulate a USB device (the ATmega8 doesn’t have any hardware USB capabilities). The board has two major ICs on it: an ULN-thingy to drive the relays, and the venerable ATmega8 with a 12MHz crystal. Well, as much as I enjoy installing shady Chinese DLLs on my system, I thought I’d take a look at other options first. Instead, there was an obscure reference to some DLLs and source codes that I could download to write my own control software with. Excellent. However, there was no link to a software that can actually talk to it. The product page said the board acts as a native USB HID device or something, so there’s no need to install drivers. Here’s how I replaced the USB interface with a basic UART. But there was nothing convenient about the software, and I wanted it to work directly with Arduino and other MCUs anyway. This Chinese “8-Channel USB Relay Board” requires a 12V power supply, and it’s also supposed to plug into the PC for convenient software control.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |