In the last posts I talked about the IR sensor (#5), the dataset (#6) and the classifier (#7). In this post I started to move from the bench to the real thing.
In my proposal and in the first posts, the Nicla Vision was the brain of the bin. It read the accelerometer, the IR sensor and its own microphone, ran the classifier, moved the chute and drove the LEDs through an MCP23017 port expander. But then, I experienced some issues with the ADXL372. I spent several days on it, but its ID registers kept coming back as 0xA9, 0x18 and 0xF0 instead of 0xAD, 0x1D and 0xFA. The MCU side was fine: with MISO tied to 3.3 V it read 0xFF as it should. A pull-up on MISO and a 100 kHz clock gave the same wrong IDs, and the values changed when I touched the wires or added a second ground. I never found a fix that made it answer reliably, and the deadline doesn't wait for me.
So, the move was to place the Nicla below the plate, but this action had an important consequence: for sure, I can't run all those wires from the plate to box. The solution was to add another board (the Arduino Nano 33 BLE). In this way, I can split tasks as follow:
- Arduino Nano 33 BLE: the main controller. It reads the CN0569 IR sensor over I2C. When object is detected, it drives as digital output connected to the Nicla board to trigger acquisition
- Arduino Nicla Vision: runs the classifier. It sits in a small printed case under the gate plate, the trapdoor at the bottom of the chute. When triggered by Arduino Nano, it records the knock with its LSM6DSOX accelerometer and its microphone and runs the Edge Impulse model of post #7.
- Arduino Nicla sends the result of the classification back to the Arduino Nano through a unidirectional serial link (only transmission from Nicla to Nano is possible)
- Depending on the result received over the serial link, the Arduino Nano moves the NEMA motor through TMC5272 board, drives the servo to open the plate and sends a command on a serial link to Arduino Uno to animated LEDs
- Arduino Uno receives commands over the serial link and drives GPIOs accordingly
These are the boards and the links between them

The links between them are deliberately simple:
| Link | From --> To | Pins | Settings |
| DETECT (GPIO) | Nano --> Nicla | Nano D6 → 1 kΩ → Nicla D2 | high while an item is expected |
| NICLA_TX (UART) | Nicla --> Nano | Nicla D1/TX → Nano D0/RX | 19200 8N1, one line per item, e.g. GLASS 0.93 |
| LED_LINK (UART) | Nano --> Uno | Nano D1/TX → Uno D2 | 9200 8N1, e.g. identified 2 |
| I2C | Nano <--> CN0569 | A4 SDA, A5 SCL | |
| SPI | Nano <--> TMC5272-EVAL | D13, D11, D12, D9 | |
| PWM | Nano → gate servo | D7 | 50 Hz, 1000 to 2000 µs |
To recap, the sequence for one item is:
- The CN0569 sees something fall through the chute, and the Nano reads the break over I²C.
- The Nano raises DETECT and sends detected to the Uno, so the LEDs react.
- The Nicla takes the rising edge of DETECT as the start of its capture window, waits for the knock, classifies it, and sends one line back: the bin and the confidence.
- The Nano drops DETECT, sends identified <bin> to the Uno, turns the chute to the bin, opens and closes the gate, and goes back home.
Note that the Nano 33 BLE has only one hardware UART (Serial1 on D0/D1). So I use its RX for the Nicla and its TX for the Uno, at the same baud rate. The Uno link was already at 19200, so the Nicla link follows. USB is a separate port, so the debug prints on the PC don't disturb either of them.
The weak point is known: the LSM6DSOX stops at ±16 g, and a paper drop already reached 15.6 g on one axis. A can or a glass jar will clip it. If I get the first prototype running on time, I'll order new ADXL372 boards and go back to the original plan. The Nano pins it used (D3 and D10) are still free on purpose, so it can come back without rewiring anything else.
Why an Arduino Uno just for the LEDs?
The LED panel is 9 CamdenBoss IND514113 indicators. Each LED gets about 10 mA. The first version drove them from the Nicla through an MCP23017 expander and a ULN2803 on a piece of perfboard. With the new architecture the obvious candidate was the Nano, but the Nano 33 BLE has 3.3 V pins that are not 5 V tolerant, and it had already given most of its pins to the sensor, the driver and the servo.
The Uno solves both problems. Its ATmega328P pins give 5 V and can source 10 mA per LED without any driver: I just need to add a 300 Ω resisto. All 9 LEDs on is about 90 mA, well under the limits of the port groups. As a bonus, the Uno does all the animation timing: the Nano only says which animation to show and never waits for the LEDs.
There's one catch with mixing a 5 V board and a 3.3 V board. The link runs one way only, from Nano TX to Uno D2, and a 47 kΩ resistor from D2 to the Uno's 3.3 V pin keeps the line idle high without ever putting 5 V on the Nano. The ATmega328P reads a high from 3.0 V, so 3.3 V works with little margin.
Building the bin
The Hammond box contains all the electronics. I started to mount the Molex connectors: one connector gets the power, the other one connects to the Nical under the plate


The signals on the power connector are
- + 12V (for the NEMA motor)
- GND
- + 5V
Currently, I choose to use a PC power supply, which has both 12V and 5V. Next iteration, I plan to power the bin with just 12V and place a step down converter to get the 5V
The signals to the Nicla board are
- +5V
- GND
- DETECT
- NICLA_TX
Cables passes just behind the bottom mount for the pole, which also hosts the mounting place for the servo

Then, I mounted the top mount, with the NEMA motor and the coupler for the pole

Both the top and bottom mounts have 6804 bearings. I will also add a thrust bearing no to overload the NEMA motor shaft
Then, I installed the board for the TMC5272 and Arduino Nano. I added a sort of "bus bar" made with strip headers, in order to have several pins to connect 5V and GND

On the lid, I mounted the CN0569. The part where the CN0569 is mounted has room also for the Nicla board but, in this prototype, the Nicla board will be installed under the plate

Whats's next
Soon, I will complete the build and
- Install the LEDs and the Arduino Uno board
- Install the thrust bearing
- Install the home switch
- Mount the servo and the plate
- Run the first smoke test on the prototype