New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

OpenMV camera sending cap counts to an old Intel Edison over UART: nothing arrives

OpenMV camera sending cap counts to an old Intel Edison over UART: nothing arrives

Solved 6 4

Plant manager, and our only controls tech is on leave, so I’m doing this one myself. On the bottling line an OpenMV H7 camera checks caps and counts good ones and rejects. Next to it is an old Intel Edison on its Arduino breakout board, which already reads the filler’s counters and sends line data to Hermetry. I want the OpenMV to pass its two counts to the Edison over serial so they go up with the rest.

OpenMV side:

from pyb import UART
uart = UART(3, 115200, timeout_char=1000)
...
uart.write("caps_ok=%d;caps_rej=%dn" % (ok, rej))

Edison side, Python reading /dev/ttyMFD1 at 115200: the port opens without errors, but read() returns nothing at all. I connected OpenMV P4 (TX) to the breakout’s pin 0 and P5 (RX) to pin 1.

The two boards sit about 40 cm apart in the same enclosure, joined by jumper wires, both powered from the same 5 V supply. I checked the OpenMV with a USB serial adapter on my laptop and the lines come out fine at 115200.

♥ 1

What voltage is the breakout’s level shifter set to? The OpenMV is 3.3 V, the Edison breakout can be jumpered for 5 V.

♥ 1

Are the grounds connected between the two boards? I’ve been caught by that one.

♥ 0

Grounds are connected. The jumper (J9) was on 5 V, I moved it to 3.3 V. Still nothing.

♥ 0

I fought the Edison breakout for a lab last year. Opening /dev/ttyMFD1 isn’t enough on that board: pins 0 and 1 go through a pin multiplexer and the level shifters, and until those are set up the UART isn’t connected to the header at all, the pins are plain GPIO. That’s why it opens fine and reads nothing.

The easy way is the mraa library, which sets the mux for you when you open the UART by its board number:

import mraa
u = mraa.Uart(0)            # pins 0/1 on the Arduino breakout, sets the mux
u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
while True:
    if u.dataAvailable(1000):
        line = u.readStr(64).strip()     # "caps_ok=1823;caps_rej=12"
        vals = dict(kv.split("=") for kv in line.split(";"))
        # add to the payload the Edison already sends:
        payload["caps_ok"] = int(vals["caps_ok"])
        payload["caps_rej"] = int(vals["caps_rej"])

Also check the wiring is crossed: OpenMV TX to the Edison’s RX (pin 0), OpenMV RX to the Edison’s TX (pin 1). Pin 0 is RX on the breakout, so if what you wrote is exactly how it’s wired, swap them.

Timestamps in UTC or it didn't happen.
Accepted solution♥ 9

Both, as it turns out. mraa.Uart(0) set up the pins, and I had TX and RX the wrong way round. Counts now arrive every second and go up with the filler data. caps_rej is on the line board and the shift lead already asked why it jumped at 2 pm.

♥ 2

Good. Plan a replacement for that Edison though, it’s been out of production for years and spares get harder to find.

♥ 1
Viewing 7 posts – 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share