Streaming music controlled from OH

Hi ,

I am running OH on my first pi and I am running xbmc on a secondary raspberry pi and have been able to
control the streaming on an online mp4 file using OH.

I to get rid of the secondary raspberry pi and maybe use an arduino instead that plays music from an sd card instead.

The this is the arduino will not have access to the internet so I cant use MQTT from the pi2 (OH) to the arduino.

I was thinking about using a nRF24L01 receiver and sender instead but I need line of sight between OH and the arduino and I cant guarantee that
my users will do that.

Any help would be appreciated.

Just for my understanding: The arduino will have no access to the internet or no access to the network?

If it won’t have connection to the internet there is no problem as you can bring the mqtt broker on the pi and subscribe the arduino to that. if there is no network, things will get quite complicate. The only solution I can think of the very expensive and involves the use of a logitech harmony hub which could work as WLAN-IR bridge. But I’ve no idea whether or not it is possible to control xbmc on arduino via IR. I did something similar with xbmc on raspberry, but as I don’t know much about the arduino as well as your idea with the nrf24l01, this might be a better (at least cheaper) solution.

Regards
Dieter

Hi, Thank you for your response.

Well I want to be able to be able to communicate between the OH (the first pi which currently also runs mosquitto broker) and an arduino to instruct it via some protocol to play something from a connected sd card.

The thing is that my users do not have the knowhow to configure the arduino sketch to configure it to connect to their own home wifi (like setting the network name and password). If they could then I would have use mqtt and it would be easy especially with an arduino like ESP8266.

I am trying to make my solution as seamless as possible. My users demand a plug and play solution.

The arduino can connect to the local wifi network but as described the solution would need to be configure by the users in order for MQTT to work.

I did have the idea to store the wifi user name and password on the arduino sd card and then let the arduino read from there when connecting to the wifi network. My users would then just have to take out the supplied sd card and place it into their pc to change the details on say a .txt file to match their network name and password.

They could then place the sd card back into the arduino and power up. The arduino would read from the card and then try to connect to the wifi network.

That is the only way i can see to get the arduino to connect to the wifi network and then i can use MQTT.

How does that sound @DieterL

Sounds like a good idea for me where you don’t have to spend much effort.

The only problem that might occur is when your users don’t have a card reader with their pc. So you might have to provide that as well (for example I have a small usb to micro-sd adapter, that was quite cheap)

Use the ESP8266, preferably one of the bigger one (ESP-13 or something). On startup, it will read the wifi data from EEPROM. If there is no wifi data in EEPROM, have it open a new wifi network, to which your users can connect, enter their own wifi data in a webinterface, which you then can save to eeprom and reboot.
WAY easier for your users than an sd card. They can use ANY wifi enabled device for configuration, even smartphones or tablets.

@tlanfer Thank you for email this may help me but I have a few more questions for you please

I’m not sure how to do this would happen to have a web page tutorial or some source of extra information on how to do this.

“If there is no wifi data in EEPROM, have it open a new wifi network” - Again this is totally new to me , could you help further?

Update:
I have found this maybe this is what you are referring to ? https://github.com/chriscook8/esp-arduino-apboot/blob/master/ESP-wifiboot.ino

Yes, that github link does pretty much exactly what you want to do. I will read wifi data from eeprom, and if there are none, it will open its own wifi, and a start a webserver.

in the mainloop, you can add your code to connect to the mqtt channel and play music from sd card. Be sure to check return values, because the main loop will run no matter if you are connected to an actual wifi with internet connection, or running your own wifi with no internet available.

1 Like

Thanks for your help you have solved my main issue.

@tlanfer

I don’t know if you know the answer to this question but i’ll ask anyway :smile:

When connecting to the arduino to configure the EEPROM what is the browser url?

If you are on android, you need to know the IP address. Should be http://192.168.4.1. On Apple device (iOS or OSX) or on Windows with iTunes installed, you should be able to reach it under http://esp8266.

1 Like