element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
On the Line
  • Challenges & Projects
  • Design Challenges
  • On the Line
  • More
  • Cancel
On the Line
Forum Green Brain - Part II - Dev setup
  • News
  • Projects
  • Forum
  • DC
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join On the Line to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 33 subscribers
  • Views 31 views
  • Users 0 members are here
  • arduino-app-cli
  • On the line design challenge
  • can bus
  • On The Line
  • e14-on-the-line
  • arduino uno q
Related

Green Brain - Part II - Dev setup

saramic
saramic 12 hours ago

Finding a development toolchain for the UNO Q turned out to be more adventure than I bargained for.

Recap

Green Brain Herb is the idea of tracking plant nodes via an industrial CAN bus to ultimately see which plant needs more water cannon Gun.

  • Green Brain - Part I - CAN bus introduction

The wrong turn

Just like my recent Sentinel-box project where I wanted to achieve “Hermetic Builds”, totally isolated from external systems and in particular any click-ops and IDE’s, so I tried my luck with the UNO Q environment. As I could install arduino-cli on my Mac OSX machine, I thought that was a great start. After all it is only 4 characters off the arduino-app-cli (Arduino App Lab CLI) command.

There seem to be a lot of videos, blogs and tutorials out there on how to connect an “Arduino”, even remotely, to a build system. Things like:

# DOES NOT WORK with UNO Q (for me)
arduino-cli upload \
  --fqbn arduino:zephyr:unoq \
  --port 192.168.68.128 \
  --protocol network \
  .

looked promising, connected, “succeeded,” but nothing seemed to be actually running on the MCU (Microcontroller Unit - STM32U585).

Given I really wanted to code on my Mac OSX, running my own specific editor (VSCode) with version control setup and VIM key bindings, etc. I was keeping away from the Arduino App Lab for the moment.

Although I couldn’t get the MCU working all that quickly, I was aiming for a website so I thought I would upload a Node JavaScript server. I worked out that Unix rsync could “remote synchronize” my files to the remote UNO Q. The name of the board - pollyanna in my case, is available on the network as pollyanna.local with a generated SSH key shared between machines

# generate a key
ssh-keygen -o -a 100 -t ed25519

# with a specific name
find ~/.ssh/id_ed25519_UNO_Q*
/Users/michael/.ssh/id_ed25519_UNO_Q
/Users/michael/.ssh/id_ed25519_UNO_Q.pub

# upload it to the UNO Q
ssh pollyanna.local
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

# on my host machine Mac OSX update hosts to use the specific key
# append to file
cat << EOF >> ~/.ssh/config
Host pollyanna.local
    User arduino
    IdentityFile ~/.ssh/id_ed25519_UNO_Q
EOF

I could rsync my files across

# installing rsync on the UNO Q
sudo apt-get install -y rsync

# make sure directory exists
ssh pollyanna.local 'mkdir -p /home/arduino/ArduinoApps/green-brain'

# sync files up to the UNO Q
rsync -av \
  --exclude='.cache/' \
  experiments/in_app_new/ \
  pollyanna.local:~/ArduinoApps/green-brain-in_app_new/

Or with a quick mise script (handy runtime manager and task runner)

mise run upload:green-brain

So I could:

  1. upload my Node files,
  2. jump onto the machine
  3. go to the directory
  4. work out I don’t have node installed nor npm
  5. manually apt-get install those
  6. npm install any libraries
  7. start the web server
  8. “success” I had a web page

Far from hermetic — and ironically far more painful than clicking a button in Arduino App Lab Thinking.

To make things worse, trying to work out how to communicate between the MCU and the MPU, some blog posts suggested it was a good idea to try and uninstall the RouterBridge. This is so deeply embedded in the platform that none of the tricks seemed to work to stop it or read the interfaces directly.

Always start with blink

The frustration reminded me of how I tried to re-write the HAL (hardware abstraction layer) for the MAX32630FTHR using rust Crab . I went back to App Lab, clicked on blink, and in no time I had an LED blinking. I investigated further and worked out that with

arduino-app-cli app new green-brain

I would have a predetermined, sketch and python code as well as an app.yml to wrap the whole thing up. It also meant these apps appeared in App Lab user interface and I could, 1 click deploy and monitor. In no time I extended the blink to be able to set the LED ON/OFF via a website or writing to a file on disk, yes using the RouterBridge.

So in the end the default tool chain seems more than satisfactory for what I was using, and by maintaining my rsync, SSH settings and a few scripts, I was set (An alternative to SSH may be adb, the Android Platform Tools). VSCode and my default environment for coding, and 3 tasks to upload Arrow upper right, start Rocket and stop Octagonal sign the sketch on both the MCU and a docker based web server (no need to manually install anything).

The end advice - follow the App Lab way and build out from that.

// allow connectivity to the Bridge between MCU and MPU
#include "Arduino_RouterBridge.h"

// inbuilt CAN drivers
#include <zephyr/drivers/can.h>
...
// 500 kbps — must match sensor nodes (CAN_500KBPS)
#define CAN_BITRATE 500000
...
// assuming the CAN device is fully setup
...
static String handle_get_nodes() {
  // handle get nodes, and return JSON string with current temp and humidity
}

static String handle_get_status() {
  // handle get status and return a JSON string of generic status data
}

... // make sure the CAN frame matches up with the nodes

void setup() {
  Bridge.begin();
  Bridge.provide_safe("get_nodes",  handle_get_nodes);
  Bridge.provide_safe("get_status", handle_get_status);
}

void loop() {
  //
}

On the Python end

from arduino.app_utils import App, Bridge

...

def loop():
    status = None
    try:
        raw  = Bridge.call("get_nodes")
        data = json.loads(raw)
        # do something with the data

        status = json.loads(Bridge.call("get_status"))
        # do something with the status

App.run(user_loop=loop)

and the result

image

CAN Hub

Now I could connect my existing Arduino Nano nodes to the UNO Q acting as a hub. Noting that the UNO Q STM32 runs on 3V3, I switched to another CAN bus transceiver, the WCMCU-230 based on SN65HVD230. This proved a little tricky as it seems that the “zephyr system” supports CAN on prescribed pins ~D5 (FDCAN1_RX) and D4 (FDCAN1_TX)

Type Location Description Compatible
CAN on-chip STM32 FDCAN CAN FD controller st, stm32-fdcan

And sure enough, after some tweaks, I had connected to my previous 2 nodes and could read their temperature and humidity.

Next

Lots still to cover:

  • Unboxing newly selected hardware
  • Connecting K-Type Thermocouples (hopefully via a MAX6675, which are on the way)
  • The water cannon Gun

oh and given that my build is a jumble of cables, and from a previous design competition I had run out of time, I will need to set up some kind of hardware build to contain the nodes and Garden Hub

Source

https://github.com/saramic/green-brain

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube