Hi Marcus,
Marcus Haines wrote:
> I came across OLA today and was wondering if I could use this
> software to do just that: receive DMX and assign channels to
> variables that I can use python on the pi to output to servos and LEDs.
No.
> If anyone has any knowledge that might aid me in this, I would greatly
> appreciate it if you could share.
Always avoid general-purpose operating systems such as Linux when you
have strict and short timing contraints, which is certainly the case
for DMX reception (µs precision) and perhaps also for the servo control
loops, depending on the servo interface hardware.
General-purpose operating systems and high-level programming languages
such as Python are featureful and convenient but come at the cost of
absolutely massive timing jitter, in proportion to the precision
required in this application.
So, you must use significantly less software. At least for the timing
critical parts.
If you want you can still use Pi hardware. Look at the dedicated Pi
DMX software written by Arjan van Vught:
I would start with C, as there is a ton of examples available. These microcontroĺers have lots of pwm's and I am sure that there are examples on how to control servos or even stepper motors with it. Receiving DMX512 is easy. It gets trickier with RDM, but you don't need that yet.
Hi Marcus,
all fine ;-)
arduino is not in itself more complicated than Python.
i love the syntax of Python - and some things are a bit easier to understand than in C++…
in general the thinking concept behind most programming languages is very similar -
and for Python and C++ definitly… it is more of a syntax thing…
(at least for this simple things we speak about here…)
regarding the Send and Receive:
DMX is a chained system:
there is only one active sender - that is your control desk.
all other devices are just receivers.
they are all wired daisy-chained:
SENDER -------------+-------------+---------
| |
device device
the stub-line should be as short as possible (<3cm if i remember correctly)
therefore the devices have an input and output plug on the housing -
internally these two are directly connected with wires..
so with your Arduino UNO that is all fine.
what i meant is that you are only able to use the Serial.print() functions if you are not receiving DMX at the same time..
have you had a look at the example?
https://github.com/mathertel/DMXSerial/blob/master/examples/DmxSerialRecv/DmxSerialRecv.ino
basically it is exactly doing what you requested.
it is only adding a check for a missing dmx value and if so a fallback value for the leds..
.
in an absolute minimal way for receiving dmx values is this:
#include <DMXSerial.h>
void setup() {
DMXSerial.init(DMXReceiver);
}
void loop() {
int this_channel_value = DMXSerial.read(theDMXchannelToRead);
// do something with the value stored in *this_channel_value*
}
Could I assign channel 1 to a variable and write something along the lines of if channel 1 is at 100%, digitalWrite(RedLED, 100);?
as i written - yes that is exactly what the example does!
it only uses the correct function analogWrite()
as digitalWrite()
can only set the output to HIGH or LOW (=ON / OFF)
where analogWrite()
does create a PWM on the output.(have a read in the linked reference page.)
there is also an build in Example for fading - look into it
i suggest test all your parts one after the other:
leds changing brightness
motors moving the way you want
and than combining this with the dmx receiving…
and here also add one after the other…
so it is easier to catch bugs earlier and it is easier to find & fix them…
sunny greetings
stefan
i think with these default values it does this:
*write value 80 to the library internal dmx channel 1
and so on.
i think you can just ignore them.
that is what i have done in my minimal example i gave in the second response..
(i stripped out all the other stuff form the official example that is addon / nice to have.)
here with an analogWrite added:
#include <DMXSerial.h>
const int ledPin = 9;
void setup() { DMXSerial.init(DMXReceiver);
// setup pin 9 as output..
pinMode(ledPin, OUTPUT); } void loop() { int this_channel_value = DMXSerial.read(theDMXchannelToRead); // do something with the value stored in *this_channel_value*
// for example set an LED brightness:
analogWrite(ledPin, this_channel_value); }
i did not test it. but i think it is the minimum needed to read only one channel and set an led to the received value.
now with correct indentation in the code...
sorry for the multi-posts..
--
The Open Lighting Project: open-l...@googlegroups.com, #openlighting (irc.freenode.org)
To unsubscribe from this group, send email to open-lightin...@googlegroups.com
For more options, visit https://groups.google.com/groups/opt_out?hl=en
---
You received this message because you are subscribed to the Google Groups "open-lighting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-lightin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/20220113091118.26539.qmail%40stuge.se.
The way I had thought of the code was basically it saying “if I receive DMX, do it. Else, go to a home position”
thats exactly what the code does!
sunny greetings
stefan
i did not think of this initial case…
i thikn that is the case why the original example sets some initial values to the internal dmx slots..
and i think it is more consitent if he would usethe default values at this place to:
void setup() {
DMXSerial.init(DMXReceiver);
// set some default values
DMXSerial.write(1, RedDefaultLevel);
DMXSerial.write(2, GreenDefaultLevel);
DMXSerial.write(3, BlueDefaultLevel);
// enable pwm outputs
pinMode(RedPin, OUTPUT); // sets the digital pin as output
pinMode(GreenPin, OUTPUT);
pinMode(BluePin, OUTPUT);
}
a cite / link here is also fine for me!
and i love to see some photos from your final build :-)
sunny greetings
stefan
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/E1nB0MH-000510-Kf.spam-suxx-2022-01-21-12-18-05%40roasted.cubic.org.
woow cool to see progress!!! thanks for sharing the videos with us!
i would suggest to use tree individual simple small LEDs on the arduino output pins (with series resistors of course…(150R should be fine for testing with the 5V output…)
that way you know that your software is working…
and i just hat a look at the led-driver:
Apply logic level PWM signal (3.3V or 5V, 100-2000 Hz) to RED, GREEN and BLUE pins to display colors and change brightness. If no control signal is present the RGB-LED won’t turn on.
if you have a oscilloscope this would help to check how the pwm signal looks that gets to the driver board..
check at the arduino documentation - maybe its possible to use a slower pwm frequency -(i don’t know out of my head..)
that also could help…
sunny greetings
stefan
--
The Open Lighting Project: open-l...@googlegroups.com, #openlighting (irc.freenode.org)
To unsubscribe from this group, send email to open-lightin...@googlegroups.com
For more options, visit https://groups.google.com/groups/opt_out?hl=en
---
You received this message because you are subscribed to the Google Groups "open-lighting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-lightin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open-lighting/20220121213838.1b6bd2e6%40dorian.fritz.box.