Hey guys,
Is it possible to use two devices at the same time (trill craft + oled screen) on the pins SDA, SCL, V+ AND GND of the bela black?
Hey guys,
Is it possible to use two devices at the same time (trill craft + oled screen) on the pins SDA, SCL, V+ AND GND of the bela black?
RafaeleAndrade
they are all I2C, so im hoping as long as they have different addresses this would be possible.
(this is whats happening with the 2 oleds on the TT above)
once the trill arrive, Im planning on making something with a few trill, a couple of i2c encoders and an oled !
the guy who supplied me with the above Terminal Tedium, pointed me to these :
https://www.tindie.com/products/saimon/i2cencoder-v21-connect-rotary-encoder-on-i2c-bus/
they are not cheap, but the idea is Im going to add one or two to the above terminal tedium 'expander',
and also use a few with the trill/bela
thetechnobear they are all I2C, so im hoping as long as they have different addresses this would be possible.
Yes. Each type of sensor has a dedicated range of address, which are non-overlapping between sensor types. You can set the sensor to a different address by applying a tiny amount of solder on the board to bridge two pads together.
thetechnobear awesome! This a great idea!
giuliomoro Thanks! Sometimes simple questions are so essencial for next steps
giuliomoro this is a stand-alone program that receives OSC and sends i2c to the display (generates no audio, but can run in parallel with a real Bela prorgam) http://github.com/giuliomoro/OSC2OLED4Bela
How would one go about running this in parallel if they wanted to run it on start up?
See the instructions above in this thread here. I am pretty sure @crosswick got it to work as a systemd
service, am I right?
giuliomoro Thank you. I've got this mostly to work. However whenever the OSC2OLED program runs for the first time when the Bela is started I am getting this error:
If it is run again the program runs fine and there is no error message. However when running it from start up it stops the other Bela program that is enabled to run on start up.
Are both your Bela program and the OSC2OLED program trying to access the same I2C device?
giuliomoro No just the OSC2LED. The Bela program is just a simple pd sketch that is sending OSC data to the screen for testing purposes at the moment.
insignificatother However when running it from start up it stops the other Bela program that is enabled to run on start up.
Can we see the .service
file? Also, what is the log of the Bela program that runs on startup, and what is the log of your program running at startup? You can achieve such logs with journalctl -fu SERVICENAME
Here is the .service file
[Unit]
Description=OSC to IC2 Screen Launcher
After=network-online.target
[Service]
ExecStart=/root/Bela/scripts/run_project.sh Screen_Test_Error
Type=simple
Restart=always
RestartSec=1
WorkingDirectory=/root/Bela/projects/Screen_Test_Error
Environment=HOME=/root
KillMode=process
[Install]
WantedBy=default.target
Here are the logs
root@bela:~# journalctl -fu bela_startup.service
-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Nov 03 17:16:56 bela stdbuf[293]: sigmund~ version 0.07
Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 0 is set as input at message rate
Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 1 is set as input at message rate
Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 2 is set as input at message rate
Nov 03 17:16:56 bela stdbuf[293]: Bela digital: channel 3 is set as input at message rate
Nov 03 17:16:56 bela stdbuf[293]: connecting to port 7562
Nov 03 17:17:00 bela stdbuf[293]: Makefile:570: recipe for target 'runonly' failed
Nov 03 17:17:00 bela stdbuf[293]: make: *** [runonly] Terminated
Nov 03 17:17:00 bela systemd[1]: Stopping Run Bela at boot...
Nov 03 17:17:01 bela systemd[1]: Stopped Run Bela at boot.
root@bela:~# journalctl -fu custom_program
-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Nov 03 17:17:03 bela systemd[1]: custom_program.service: Service hold-off time over, scheduling restart.
Nov 03 17:17:03 bela systemd[1]: Stopped OSC to IC2 Screen Launcher.
Nov 03 17:17:03 bela systemd[1]: Started OSC to IC2 Screen Launcher.
Nov 03 17:17:04 bela run_project.sh[681]: Checking the board is up and running at root@192.168.7.2...Warning: Permanently added '192.168.7.2' (ECDSA) to the list of known hosts.
Nov 03 17:17:03 bela run_project.sh[681]: done
Nov 03 17:17:03 bela run_project.sh[681]: Board found at root@192.168.7.2
Nov 03 17:17:03 bela run_project.sh[681]: Running Screen_Test_Error...
Nov 03 17:17:03 bela run_project.sh[681]: Pseudo-terminal will not be allocated because stdin is not a terminal.
Nov 03 17:17:04 bela run_project.sh[681]: make: Warning: File 'libraries/UdpClient/build/UdpClient.d' has modification time 96520642 s in the future
Nov 03 17:17:05 bela run_project.sh[681]: Running /root/Bela/projects/Screen_Test_Error/Screen_Test_Error
insignificatother ExecStart=/root/Bela/scripts/run_project.sh Screen_Test_Error
run_project.sh
is going to call make stop
, thus killing the other program. You should run the program directly with /root/Bela/projects/Screen_Test_Error/Screen_Test_Error
.
And it's working. My noobness it showing. Thank you so much for your help and quick responses.
So here's a summary HOW-TO, for posterity:
OSC2OLED4Bela
with your project name in all the steps below.bela.local:7562
from the host computer. You can run it like this for testing.parseMessage()
function in render.cpp
. For instance, you can send /osc-test
followed by a float
, /tr
followed by a float
(ignored) and/or a string
, /param1
followed by a float
. You can edit the program to change or add support for OSC messages/lib/systemd/system/osc2oled.service
with this content:[Unit]
Description=OSC to IC2 Screen Launcher
After=network-online.target
[Service]
ExecStart=/root/Bela/projects/OSC2OLED4Bela/OSC2OLED4Bela
Type=simple
Restart=always
RestartSec=1
WorkingDirectory=/root/Bela/projects/OSC2OLED4Bela
Environment=HOME=/root
KillMode=process
[Install]
WantedBy=default.target
This can be done from the terminal or by creating a file osc2oled.service
in your project (make sure the file includes only the text above and none of the automatically-generated content in the file you create) and then linking it into place by running ln -s /root/Bela/projects/OSC2OLED4Bela/osc2oled.service /lib/systemd/system/osc2oled.service
in the Bela IDE console.
systemctl start osc2oled
, stop it with systemctl stop osc2oled
.journalctl -fu osc2oled
(if executing the command from the Bela IDE console, use journalctl -n 20 -u osc2oled | cat
instead)osc2oled
process to start automatically in the background at boot with systemctl enable osc2oled
. Later you can disable it with systemctl disable osc2oled
osc2oled
service will probably start after the Bela program has started, so if you send OSC to it too early when your program starts, some content may not be visualised on the screen.thanks for the overview! nice one.
i got everything working, up to sending OSC from a Pd patch to the background program -
but only after referencing the logs and your subsequent answer four posts up.
is it possible, for future reference for me and my fellow nitwits, to edit your post some, and have all the relevant info in this one place?
to clarify:
giuliomoro [Service]
ExecStart=/root/Bela/projects/(NAME OF PROJECT)/(NAME OF PROJECT)
Type=simple
Restart=always
RestartSec=1 (<< no need forhttp://bela.io/i think?)
WorkingDirectory=/root/Bela/projects/(OSC2OLED4Bela or NEW NAME OF PROJECT)
Environment=HOME=/root
KillMode=process
i realise this might all be self-explanatory to some, but it's not to everybody
also
giuliomoro Bela IDE console, use journacltl -n 20 -u osc2oled | cat instead)
has a typo in journalctl, which is meh if you copy/paste.
and last,
giuliomoro systemctl enable osc2oled
doesn't seem to work with the /***** osc2oled.service *****/ header (generated in the IDE > new file) still on line 1 of the service file. had to remove that, so [unit] was the first thing in there. again, probably obvious to someone who knows what they're doing, but might save some frustration for others.
feel free to delete this post after if needed.
and thanks for walking us through this!
@Remork . Thanks for the feedback, hopefully it's fixed now.
giuliomoro
well.. dunno?
with the risk of being pedantic
is the "http://bela.io/" supposed to be in the RestartSec line?
and
giuliomoro journalcltl
still has an L too many.