parent
0d86194f26
commit
87521ddce2
32
README.md
32
README.md
|
@ -236,34 +236,12 @@ exit;
|
|||
sudo systemctl restart apache2
|
||||
```
|
||||
|
||||
### Setup Open Lighting Archetecture as the ArtNET/sACN middle man:
|
||||
### Clone the project to your Pi
|
||||
|
||||
Edit:
|
||||
You can just clone the project itself into your home directory.
|
||||
|
||||
`sudo nano /etc/ola/ola-artnet.conf`
|
||||
`cd ~ && git clone https://github.com/ping-mee/PiXelTubes`
|
||||
|
||||
```
|
||||
always_broadcast = false
|
||||
enabled = true
|
||||
ip = eth0
|
||||
long_name = PiXelTube Master
|
||||
net = 0
|
||||
output_ports = 4
|
||||
short_name = PiXelTube Master
|
||||
subnet = 0
|
||||
use_limited_broadcast = false
|
||||
use_loopback = false
|
||||
```
|
||||
Then just change directory into the server folder.
|
||||
|
||||
Save and exit.
|
||||
|
||||
|
||||
|
||||
You can access the Pi's OLA webinterface via the following address:
|
||||
|
||||
`http://<ip_of_the_pi>:9090/`
|
||||
|
||||
* From there click add universe > set universe ID > set universe name.
|
||||
* Select Artnet input with the IP address from the ethernet port and as Artnet output the address from the wifi access point.
|
||||
|
||||
Repeat this process for every universe you are going to use for your tubes. As an addition to Artnet you can also use sACN (E1.31) as an input.
|
||||
`cd PiXelTubes/server`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
import wifi
|
||||
from stupidArtnet import *
|
||||
from sacn import sACNlistener
|
||||
from neopixel import *
|
||||
import requests
|
||||
import json
|
||||
|
@ -72,17 +72,27 @@ def update_led_strip(dmx_values, dmx_address, strip, LED_PER_PIXEL):
|
|||
# Update the LED strip
|
||||
strip.show()
|
||||
|
||||
def listen_to_artnet(universe, dmx_address, strip, LED_PER_PIXEL):
|
||||
def listen_to_sacn(universe, dmx_address, strip, LEDS_PER_PIXEL):
|
||||
try:
|
||||
artnet = StupidArtnet()
|
||||
artnet.start(universe=universe)
|
||||
# Create a new sACN listener
|
||||
listener = sACNlistener()
|
||||
|
||||
# Configure the listener to listen to the specified universe
|
||||
listener.register_listener(universe)
|
||||
|
||||
# Start the listener
|
||||
listener.start()
|
||||
|
||||
while True:
|
||||
dmx_values = artnet.listen()
|
||||
# Get the latest data from the specified universe
|
||||
packet = listener[universe].listen()
|
||||
|
||||
if dmx_values is not None:
|
||||
update_led_strip(dmx_values, dmx_address, strip, LED_PER_PIXEL)
|
||||
if packet is not None:
|
||||
# Extract DMX values from the sACN packet
|
||||
dmx_values = packet.dmx_frame
|
||||
|
||||
# Update the LED strip based on the received DMX values
|
||||
update_led_strip(dmx_values, dmx_address, strip, LEDS_PER_PIXEL)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
import socket
|
||||
|
||||
def forward_artnet(iface_in, iface_out):
|
||||
# Create raw socket to receive and send ArtNet packets
|
||||
sock_in = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
|
||||
sock_in.bind((iface_in, 0))
|
||||
|
||||
sock_out = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
|
||||
sock_out.bind((iface_out, 0))
|
||||
|
||||
while True:
|
||||
# Receive ArtNet packet from the input interface
|
||||
pkt, _ = sock_in.recvfrom(65535)
|
||||
|
||||
# Modify the source MAC address if needed
|
||||
# Modify other fields as required
|
||||
|
||||
# Forward the packet to the output interface
|
||||
sock_out.sendall(pkt)
|
||||
|
||||
print(f"Forwarded ArtNet packet from {iface_in} to {iface_out}")
|
||||
|
||||
# Specify the input and output interfaces
|
||||
input_interface = "eth0"
|
||||
output_interface = "wlan0"
|
||||
|
||||
# Start forwarding ArtNet packets between interfaces
|
||||
forward_artnet(input_interface, output_interface)
|
Loading…
Reference in New Issue