Posts

Arduino USB Camera Controller – Status Report 1

Cam.controller rev0

Cam.controller rev0

This is first iteration of camera controller layout inspired by Fernando Radi’s project. I designed a PCB containing Arduino Pro Mini, USB Host Mini, as well as other small parts necessary to complete the circuit. The whole thing is about the size of 16×2 LCD display and 1 inch high.

Next picture shows the controller with LCD removed. LCD connector is at the top left. Two resistors below the connector set the screen contrast. Slide switch next to LCD connector turns backlight on/off while power switch sits at the top right. USB Host Mini and Arduino Pro Mini are mounted underneath the LCD; encoder and “Back” button are placed to the right of LCD.

Project files include Eagle schematic and board layout, as well as a pdf of bottom side of PCB ready to be used in toner transfer process. EOSCamController code can be run on this board with no modifications. Some encoders have their A,B outputs swapped so if you see screen navigation moving backwards, swap encoder outputs. If you want to build this controller, refer to Eagle board layout file for part and jumper placement.

Cam.controller with LCD off

Cam.controller with LCD off

In the next iteration of the layout, I’m planning to move power switch to the left closer to backlight switch and use right-angle encoder and “Back” button. I will also try to find space for a LiPo charger. Stay tuned and please leave a comment if you have better layout in mind!

Oleg.

USB Host Shield Hardware Manual

USB Host Shield 2.0 pinout

USB Host Shield 2.0 pinout


Today, I posted a static page containing USB Host Shield hardware manual. On this page, I give introduction to the shield hardware, explain board layout, connectors and jumpers. Finally, I show some useful modifications that can be made to the board to expand its capabilities.

I decided to post it incomplete – at present, only 2.0 shields are covered. However, I’m not going to stop here – Mini will be described next followed by rev.1xx. Owners of rev.1xx may want to take a look at current page anyway since 2.0 and 1.xx are not that different.

While writing this manual I tried to cover every detail. If you think that I missed something, please let me know!

Enjoy,
Oleg.

Updated USB Host library uploaded to gitHub

No SPI

No SPI

New version of USB Host library has been uploaded to gitHub. I managed to find a couple of bugs and solve some compatibility issues. The biggest change, however, has been made on the very lowest level of the library – SPI transfers between Arduino and MAX3421E registers.

From the beginning, USB Host firmware relied on Arduino Playground SPI library. Starting from version 0018 of Arduino IDE, this library became part of the distro. Two versions after that, Arduino team decided to re-write SPI library, among other things changing function names. As a result, USB Host code became incompatible with “stock” SPI library. To remedy the situation, I incorporated SPI routines directly into MAX3421E support code. The new code is independent of Arduino SPI library and builds correctly on “old” (i.e. 0017) and “new” (0021) versions of Arduino IDE. In addition to that, new code accounts for SPI pinout difference between Arduino variants and works on both Atmega 328 and Atmega 1280/2560 based boards. ( Note: the current rev1.x USB Host Shield still needs to be modified to work with Megas )

The new library can be downloaded from USB Host Shield gitHub repository. If you are upgrading existing installation of the library, please make a backup copy before downoading! I checked it against all code examples and USB devices in my possession and everything works without a hitch. However, code written with tight timing may stop working because of speed difference since new SPI routines are slightly faster.

As you can see in the title picture ( click on it to enlarge ), the line #include "Spi.h" is no longer needed. In next several days I’m going to update all USB examples on this site to match the new code. If you have any any problems with the library, please let me know!

Oleg.

Bluetooth code for Arduino USB Host

Arduino to Bluetooth connection

Arduino to Bluetooth connection

[EDIT]The standard RFCOMM/SPP implementation is available in rev.2.0 of the library.[/EDIT]

I am pleased to announce addition of Bluetooth dongles to the family of USB devices supported by USB Host Shield. Bluetooth dongles are affordable, interface is well documented, and USB transport layer is very simple. Even though full Bluetooth protocol is heavy and takes a lot of program space, it can be stripped down quite a bit for a particular application. One good example of such approach is Richard Ibbotson’s HID over Bluetooth implementation – see Wiimote Game Controller Interfacing article for details. I wanted to have simple communication transport over Bluetooth which would fit into Arduino and the code I’m presenting in this article is doing just that – it’s lightweight terminal program allowing two Arduinos talk to each other over Bluetooth. The code has been developed by George Lgotkin.

The source is hosted in GitHub repository. Standard Arduino library format of the code has not been tested yet, for now it’s easier to just copy all the files in a directory and open btclass_h.pde in Arduino IDE. To use the program, you need two Arduinos, two USB Host Shields, and two Bluetooth dongles. You need to compile and load the sketch into both Arduinos and then open two terminal windows, one to a serial port of each Arduino – this can be done from a single computer. Don’t use Arduino IDE built-in terminal. Also, SPI library shipped with recent versions of Arduino IDE is not compatible with USB Host library, if you have compiler errors related to SPI, replace your library with one from Arduino-0018 or the Playground. Serial port speed is set to 115200 in the sketch, it can be changed in setup(), if necessary.

Sketch starts by printing short help (see screenshot below) and then waits for the command. In order for two Bluetooth devices to talk to each other, one has to be the server and another one client. In one terminal, type ‘S’ and press Enter. This starts the server. If you are curious, type ‘M’, Enter – the address of the module will be printed. Note that if you send address request before starting the server, address containing all zeroes will be returned.

To establish connection, type ‘C’, Enter in other terminal. The sketch will print “Connecting…”. After some time ( 30 seconds or less ) both terminals will print “Connected”. Now type something in one terminal and press Enter – the string you just typed will appear in other terminal window. Easy.

This code is just a small example, error handling is minimal. It works better if no other Bluetooth radios are transmitting nearby. If client Arduino reports “Connected” but server doesn’t, it means that client has connected to some other server, most likely your laptop or phone. This can also be used to your advantage for testing – start Bluetooth on a PC and then see if both Arduinos are able to connect to it in client mode.


Continue reading Bluetooth code for Arduino USB Host