AccelerationConsortium / ac-training-lab

Codebase for controlling and managing the Acceleration Consortium (AC) Training Lab.
https://ac-training-lab.readthedocs.io/
MIT License
8 stars 2 forks source link

Autotrickler v4 - custom RS232 control with A&D scale #113

Open sgbaird opened 1 week ago

sgbaird commented 1 week ago

As a follow up to #20, the goal is to get a similar interface and IolT setup to that of the US Solid scale. Some related material at https://ac-microcourses.readthedocs.io/en/latest/courses/robotics/3.2-serial-communication.html. In particular:

✅ Read HR Analytical Balance Literature

This document provides an overview of the analytical balance we'll be interfacing with. Understanding the capabilities and specifications of the instrument is crucial for effective integration.

✅ Skim HR Analytical Balance Manual. Read Sections 15 and 17 closely.

Sections 15 and 17 detail the RS232C interface and the commands used to communicate with the balance. This information is essential for programming our microcontroller to interact with the balance correctly.

The connection at the back of the scale is similar. We have two scales (the 1 mg and the 0.1 mg resolution). The 0.1 mg resolution scale is at NRC. Let's focus on the 1 mg at UoT.

evelynnesher commented 1 week ago

IMG_2977 I set up the RS232 connection with the scale. As shown below, I needed to unplug the auto trickler as it was plugged into the RS-232C serial interface. IMG_2978 IMG_2979 IMG_2980 Currently, it prints “ST” when the weight measurement is stable and “US” when the weight is actively changing and unstable.

sgbaird commented 1 week ago

That was fast! Great. There should be a second pico 2ch rs232 module available (I think in the same room?), so we can have one for the US solid scale and one for the A&D scale in the office.

evelynnesher commented 1 week ago

Got HiveMQ set up and publishing with no issues, so I’m moving on to the app now. Do you want this one to have the autotrickler feature too? I’ll have to figure out a way to make it work since they both use the same port.

sgbaird commented 1 week ago

Nice! You'll use the same port, but adjust the MQTT topic structure to differentiate between the two devices. I think a separate app might be better, but I'm open to the idea of integrating it into the existing app.

evelynnesher commented 1 week ago

IMG_2978

IMG_2983 I think you misunderstood, I meant the physical port on the scale, where both the Raspberry Pi (for the RS232 connection) and the AutoTrickler are connected. But as you can see, only one can connect at a time.

sgbaird commented 1 week ago

Ah, my bad 😅 The autotrickler can be left disconnected for now.

evelynnesher commented 1 week ago

image I set up the app in a private space on my personal account to test it out first. It is currently identical to the previous one but ready to be implemented into the AC Hugging Face Spaces. Side note: no Pico-2CH-RS232 here, just an empty box.

evelynnesher commented 1 week ago

image image App is public and scale is embedded into GatherTown.

sgbaird commented 1 week ago

Great! Could you also open a PR with device code and an example of orchestrator code, as well as transfer the hugging face repo to AC?

evelynnesher commented 1 week ago

Done!