UartOverUsbDriver driver with Label Printer

Hi,

I’m trying to print from an imp05 to a label printer over USB (Brother QL-700)

I am using the modified QL720NW_UART_USB driver code based on mysticpants/Electric-Imp-Usb-Drivers UartOverUsbDriver. https://github.com/electricimp/Usb/tree/v0.1.0/examples/QL720NW_UART_USB_Driver

So far so good. The imp device and USB driver recognize the device and installs the driver.

But sending print commands to the printer results in zero response on the printer in terms of printing or status lights.

I added some logging statements to the driver and the print commands are written to the Bulk Out endpoint.

There also seems to be a lot of activity on the Bulk In endpoint (appears to be all 0x00 chars) but the UsbHost.On(“data” callback is not called (and I could not find another event type where the bulk in data might appear).

Any pointers on how to move forward would be muchly appreciated.

Here is the code:

// Initialize USB Host
usbHost <- USB.Host(hardware.usb);
usbHost._DEBUG=true
server.log(“Usb initialized”)

// Register the UART over USB driver with USB Host
usbHost.registerDriver(QL720NWUartUsbDriver, QL720NWUartUsbDriver.getIdentifiers());
server.log(“driver registered”)

// Subscribe to USB connection events
usbHost.on(“connected”,function (device) {
server.log(typeof device + " was connected!");

switch (typeof device) {
    case "QL720NWUartUsbDriver":
        // Initialize Printer Driver with USB UART device
        printer <- QL720NW(device);

        // Print a text label
        printer
            .setOrientation(QL720NW.LANDSCAPE)
            .setFont(QL720NW.FONT_SAN_DIEGO)
            .setFontSize(QL720NW.FONT_SIZE_48)
            .write("San Diego 48 ")
            .print();

        // Configure Barcode
        barcodeConfig <- {
            "type": QL720NW.BARCODE_CODE39,
            "charsBelowBarcode": true,
            "width": QL720NW.BARCODE_WIDTH_M,
            "height": 1,
            "ratio": QL720NW.BARCODE_RATIO_3_1
        }

        // Print bacode of the imp's mac address
        printer.writeBarcode(imp.getmacaddress(), barcodeConfig).print();
        break;
}

})

usbHost.on(“data”,function (data) {
server.log("data " + (typeof data))
})

// Subscribe to USB disconnection events
usbHost.on(“disconnected”,function(deviceName) {
server.log(deviceName + " disconnected");
})

More information

  • I am able to get the status light on the printer to flash red by sending several print requests - so something is happening.

  • Printer is good. Installed Brother software on my Mac and can print an image on the label,

Turns out the USB was working fine, but the QL700 does not behave like a QL720. Still don’t know what that behaves differently…

btw, for people reading this, we recommend the QL-1050 these days for factory fixtures as it has serial and is available easily.