I want to take an Arduino and after programming it on the PC like normal via USB, push a button or something and change its mode so that the behaves differently. Is this possible? I'd like to interface with this:
image of chinese dro scale using usb b-mini to b-mini cable for connection

Pins are +1.5V, clock, data, ground. Blue box on top is what I'd like to replace with the arduino. They're using a mini USB connector for the serial connection. Looks like a mutant form of SPI as the clock is from the box (with readout) to the slide and the MISO data comes in reply with clock pulses from the slide. (update: it uses a 21 bit protocol with 9kHz clock and the code from Yuriystoys is almost plug and play)

I'm working on reading the info while in parallel to the connection via wires I soldered to the board's pads.

Update: I ended up soldering a through-hole USB A socket onto a Prototyping board and using that. I routed +3.3V to pin 1, set up a voltage divider for the clock (D6) 330/470Ω on pin 2, routed pin 3 to MISO (D7), and connected ground to pin 4. I'm sure this is physically/electrically impossible to implement using the existing USB port on the board.

usb socket soldered onto arduino proto board

While I did get the results I was looking for, the capacitance based scale's reading technology would slowly drift, rendering results inaccurate over time. I need repeatability and drifting .002" in 10 minutes won't cut it. I am reworking this using a 1 micron glass slider scale from DroPros.com and will maintain fixed position in EEPROM between calibrations.

Special purpose test measuring bench
TFT display is Adafruit 1.8" TFT with SD card and 5-way joystick input. An indispensable i/o shield in my opinion; easy to program, easy for user input, and quite versatile.

  • \$\begingroup\$ Change its mode: What exactly does that mean -- do you mean run one of two different sets of code based on the button toggle? If so, just write two different functions in your code, have it also read the button, and when a pressed is detected, toggle to the appropriate function. \$\endgroup\$
    – boardbite
    Jun 20, 2013 at 2:13
  • \$\begingroup\$ Not likely possible or worth the hassle as per the answers, but if you're after general info on the common scale protocols to save decoding it yourself take a look at the OpenDRO project pages. \$\endgroup\$
    – PeterJ
    Jun 20, 2013 at 9:49
  • \$\begingroup\$ I hope whoever designed that at least made sure that plugging it in to a usb port, as might eventually happen, won't let the smoke out. \$\endgroup\$ Jun 29, 2013 at 12:02
  • \$\begingroup\$ The cable is mini-B on both ends. The end of the cable by the remote display is attached with screws, so you've got to try pretty hard. \$\endgroup\$
    – Krista K
    Jun 29, 2013 at 19:03

3 Answers 3


So the usb port is being as a general connector, not as a USB standard device? If so, just get a usb port or cable and wire it to the Arduino outputs.

If it's being used as an actual usb slave device, then that's alot more complicated.

Either way, if you want to use the existing usb port, you would need an arduino that uses a AVR ic as the usb port, and reprogram it so that it can do two functions (not simple). The older arduinos use a FTDI FT232R, a dedicated usb to serial IC that would not work well with what you want to do.


There are different kinds of Arduino:

  • The Arduino Uno uses a separate microcontroller (ATmega16u2) for USB communication. Reprogramming it is possible if you know what you’re doing, but unless you have an external programmer, this is very risky.
  • Older Arduinos use an FTDI chip for USB communication, and while the serial side can be reprogrammed, I don’t think the USB side can.
  • The Arduino Leonardo and Micro use an USB capable ATmega32u4 as their main microcontroller, so those are most amenable to hackery like this.

On the USB capable AVRs used for Arduinos, the USB pins are not mapped to a regular data port. However, according to the data sheet, they can be controlled through the UPOE register, so theoretically what you ask for is possible. It seems much easier to use other pins for this, though.


This will not be possible without circuit changes because of the fixed power connections to the USB connector, which appears incompatible with the power connection you mention.

If not for the power issue, with an UNO or similar, you could probably reprogram the USB interface Atemga to use the usb lines instead as GPIOs, but the voltage levels might not be safe for this device.

But really getting an wiring it into GPIO pins of the main Atmega328p, perhaps after level translation circuitry, will be the most sensible.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.