From may till august, an 8 minute 16mm film of mine will play in loop as an installation.

Would it be possible and recommendable to use Bela for a nice setup with
-a button with a LED that visitors push
to start the projector,
to make a small room light dim automatically,
and to start a digital stereo soundtrack

-a trigger signal on the optical sound track at the end of the 16mm film that switches off the projector and fades the room light in again.

Would it be possible and advisable to do all this from a Bela board?
All ideas and advice welcome!
I've been using Pure Data and Bela a bit for a sound installation and in my modular synth.

For dimming the room light, I can use a Velleman K8064 DC controlled dimmer.
https://www.velleman.eu/products/view/?id=354314

    It sounds like Bela would work well for this project.

    Floris -a button with a LED that visitors push
    to start the projector,

    does the button control the start of the projector directly (i.e.: is it the power switch for the projector)? In this case, have you though about how to send a signal to Bela? And/or is Bela controlling the power of the projector? In this case, have you though about how it would power up the projector?

    Floris For dimming the room light, I can use a Velleman K8064 DC controlled dimmer.

    it looks like this is electrically safe to connect because of the optocoupler-provided isolation. However, the output range of a Bela's analog outs (0V:5V) will not allow to provide regulation across the full 0V:12V (or 4V:12V as specified elsewhere) input range. To take advantage of the full range, you will need an external amplifier. With an operational amplifier, the circuit could be pretty minimal: one IC and two resistors.

    Floris -a trigger signal on the optical sound track at the end of the 16mm film that switches off the projector and fades the room light in again.

    How is this received by Bela? As a "click" on the audio input line?

    Thanks for the quick reply.

    for the start button:
    Bela needs to switch 230V indeed, I didn't think this far yet.
    Would a DC controlled relay work for this? And can you recommend one? Or are there more fancy solutions?

    for the dimmer:
    It's probably less complicated to work with a dimmer board that operates from 0V to 5V.
    Do you know any DC controlled dimmers in this range?

      Floris Would a DC controlled relay work for this?

      I think so.

      Floris And can you recommend one?

      Unfortunately I have no direct experience ...

      Floris Do you know any DC controlled dimmers in this range?

      no 🙁

      It may even be that you could use a dimmer at full range to turn on the projector and then at 0 to turn it off, so you just get two of the same dimmer for the two tasks. You should however verify that at full range there are no alteration to the AC signal and that when turned off it is fully off.

      Ok, I'll look around for dimmer and relay boards. All advice welcome!
      Would there be any boards that can be digitally controlled from Bela too?

      for the trigger signal:
      I'm thinking of one film frame of noise at the optical soundtrack send to the sound or analog input from Bela.

      The rest of the optical soundtrack is silent as 16mm is only mono and I'll have the stereo soundtrack come out of Bela.

      from the specifications it looks OK, but see if there is a datasheet to confirm that.

      Yes that looks good. You will need some i2c or uart communication to get it going but it seems fairly straightforward.

      yes I was wondering if I could use Bela's analog outputs with this one too?

      I did use i2c with a trill in Pd a little bit, is this simular?

        Floris was wondering if I could use Bela's analog outputs with this one too?

        Doesn't look like it.

        Floris did use i2c with a trill in Pd a little bit, is this simular?

        It's a bit more involved, but it shouldn't be too bad. I am wondering whether you'll get a decent enough refresh rate that the light oesn't show visible stepping.

        By the way, keep in mind that only certain types if light bulbs are suitable to be controlled via a dimmer, as described in the product page of the first link you sent.

        Also, please be careful when handling high voltages. Put all parts in an enclosure , safely anchored using standoffs to prevent them from touching the case. If using a metal case, ground it. Also be aware that dimmed lights can be a source of electrical noise so try to keep the cables carrying the dimmed current away from the audio cables and the dimmer itself away from the Bela board.

        I'll get started with relay boards, both for switching the projector and room light.

        As with other installations I often experienced interference because of dimmed lights.
        I also had some visible stepping with the Velleman dimmer board, very annoying.
        We'll see if a dimmer is really needed when the relay boards work.

        I've used the 8 channel version of this relay in the past to switch 220V light bulbs with raspberry pi GPIO (3.3V signals). Note that you cannot fade in/out with relays and can only do instantaneous on or off.

        If you have the budget you might also want to consider DMX controlled lights or dimmers as those probably have nicer dimming curves.

        a month later

        here's an update:
        It's been great to control the film projector, room light and soundtrack from Bela!
        After receiving a trigger from a blinking pushbutton in Pd, a relay board is used to switch off the room light and start the projector. And even better: after receiving a trigger from the optical soundtrack (on the 16mm film strip) in Pd starts the stereo soundtrack beautifully in sync with the projected images.

        As the relay switches the room light abruptly, I placed a Velleman VM135 MAGICAL! DIMMER module between the relay and power socket. Then the room light fades in and out but also, "magically" these errors pop up:

        PRU interrupt timeout, -1 110 Connection timed out
        PRU interrupt timeout, -1 110 Connection timed out
        PRU interrupt timeout, -1 110 Connection timed out
        PRU interrupt timeout, -1 110 Connection timed out
        McASP error, abort
        PRU interrupt timeout, -1 110 Connection timed out
        Makefile:606: recipe for target 'runide' failed
        make: *** [runide] Error 1

        Without the dimmer all goes well.
        Does this mean I can't use any dimmer with Bela?
        In a distant future, I would like to use lights that have internal DMX controls. Will the same thing happen when things like these fade?

        There's a picture of my little box on https://florisvanhoof.com/bela.
        (The grey multi cable goes to the pushbutton with build in LED.)
        Next week I will make a better 19 inch 2U box for the Bela, relay board and power sockets.
        Please let me know if you see anything (distances, isolation,...) that can be better.

          To start the digital stereo soundtrack in sync with my film, I made 1mm small perforations in the otherwise black optical soundtrack.
          Thanks @Remork these bursts of optical sound are detected in Pd in the following way:
          -one burst per second means it’s just a splice passing the optical head.
          -two bursts per second means two perforations and will start the digital soundtrack.
          -three bursts per second means three perforations and will end the digital soundtrack and stop the projector

          After a lot of finetuning the threshold times and values, I got this working.
          That is until light switches or power sockets were used anywhere else in the house.
          Pushing switches or (un)plugging power sockets also generate bursts that give false detections and make start/stop the soundtrack etc.

          If those bursts come from the circuitry that receives the optical sound in the projector, I might be able to bypass this by tapping straight in the optical sensor.
          Or would those bursts come from the optical sound lamp itself? In this last case, I can forget about getting triggers from optical sound and choose between these options:

          -Expensive option: the film normally has a black optical soundtrack, but I can ask the lab to print a 440Hz sine wave at the beginning of the film, and a 1000Hz sine wave at the end. This way the pitch can be detected in Pd to control the projector, room lights and soundtrack.

          -Stupid option: use the button that visitors push to activate the soundtrack (after few seconds of silence) and shut the projector down at the end of the soundtrack.
          The installation will run for 3 months, and as in this case there’s no feedback from the film to the computer, I have no idea if this stays in sync well enough. (There’s no talking, so it can be out of sync a few seconds.)

          -I have also seen a system that has a microswitch with tiny wheel rolling along the film that detects the end of the film because of a small piece of film was cut away there, so the microswitch closes. I’m afraid this is hard to make (at least for me) and will put tension on the film loop.

          Sorry if this is too far out. But it would be great to make my 50 year old projector interact with Bela. All advice welcome.

            Floris PRU interrupt timeout, -1 110 Connection timed out
            PRU interrupt timeout, -1 110 Connection timed out
            PRU interrupt timeout, -1 110 Connection timed out
            PRU interrupt timeout, -1 110 Connection timed out
            McASP error, abort
            PRU interrupt timeout, -1 110 Connection timed out
            Makefile:606: recipe for target 'runide' failed
            make: *** [runide] Error 1

            these errors may be caused by either noise being injected into Bela's digital I/O or a fluctuation of the power supply. The latter would normally cause the board to shutdown or remount the SD card / eMMC as read-only and require a reboot anyhow, so you'd probably notice that. It would be good to see if you see anything useful when running dmesg | tail immediately after you get those timeouts.

            Floris Without the dimmer all goes well.

            Where is the dimmer located? I don't think I see it in the picture.

            It may well be that if the dimmed AC line is too close to Bela, it could be the cause of these issues. And/or it could be that the issue is about enabling the dimmer and that things would keep running OK while the dimmer is enabled.

            I'd try the following: power Bela from a battery or a power supply that is not connected to the mains earth, even powering from a laptop while it's not connected to its charger should work. Then, separately, enable the dimmer on a set of AC wires powering your lights in a way that is not connected to Bela at all. Start the Bela program and bring the dimmed AC wires close to the running board: does the program stop running at some point? If the answer is no, try the following. Start the Bela program with the dimmer disabled and the wires close to Bela then enable the dimmer: does the program stop?

            If the answer to both of these is no, then it would be likely that it's not an issue due to the magnetic emissions of the dimmed AC line, but rather an issue with the wiring and the ground return path of your box. If, instead, you get at least a yes, then electromagnetic emissions are the likely culprit and that can be solved/mitigated by spacing Bela and the dimmed AC line further apart and/or shielding them.

            Floris If those bursts come from the circuitry that receives the optical sound in the projector, I might be able to bypass this by tapping straight in the optical sensor.
            Or would those bursts come from the optical sound lamp itself? In this last case, I can forget about getting triggers from optical sound and choose between these options:

            Hmm hard to tell, I don't know anything about how this optical sensor works. I am wondering if this and your issue with the dimmer both point to an issue with wiring of the grounds and earths in your system.

            If this cannot be resolved, another option beyond the ones you highlighted would be to try logging the two types of trigger to file (e.g.: with [writesf~]), then look at them and see if there is an easy way to differentiate between the bursts you get.

            thanks!
            Dimmer:
            Disconnecting Bela from ground helps for the dimmer errors.
            The picture was taken right after I removed the dimmer.
            It was located between one of the relays and the power socket.

            Electrical bursts:
            Optical sound looks and works much like grooves on a vinyl record, with light instead of a needle.
            The little holes I made just sound like pops.
            The holes and bursts from connecting anything to mains sound very much alike.
            On the scope it is almost impossible to tell the difference. And I can't differentiate them with low pass filtering.
            Also: I'm wondering what's the analogy between the Bela IDE scope scale and the values in the Pd threshold object.

            Solution:
            These projectors only came with an 8 ohm speaker output and I just found out this one is fine and totally free of bursts.
            The unwanted electrical bursts are activated by the extra line output that I soldered on my projector last year.
            When any cable (short or long) is connected, the bursts appear.
            When nothing or only a jack plug without cable is connected, the bursts are gone.
            I opened the projector again, looked at the drawing s in the manual for an hour and found better signal and ground paths, soldered a cap, and it works!