Author Topic: control multiple arduino outputs over wifi/bluetooth simultaneously  (Read 3780 times)

0 Members and 3 Guests are viewing this topic.

Offline Jbates58Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
hi all

i am working on a project for my wedding where we are having RGB LED strips put into our clothes. i am wanting to hame them all controlled by an individual arduino on the person, that is controled my a master unit that is connected to an audio source on the mixer.

this will then generate the led colour and brightness, then transmit that to the slave units for them to display for the dancing etc...

so, computer/MP3 ---> master arduino )generating colour and brightness)--->transmits to slave arduinos (aprox 6-7)---> controls LED outputs so they all match



what would be the best way of acheiving this? i am looking to use this project and them modify it as needed to acheive the wireless result.

i guess somewhat exactly like this, except using an arduino to generate the values.

https://5p.io/building-a-wifi-controlled-led-strip-controller/


im not sure how to make and arduino take the generated output and transmit it to the others.

the arduino units will be battery powered so that's not an issue, but i will need to make one to calculate the battery capacity needed.

Cheers all

Jason
 

Offline Ammar

  • Regular Contributor
  • *
  • Posts: 154
  • Country: au
 

Offline Jbates58Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #2 on: March 05, 2017, 11:08:15 am »
sorta. but as i am using RGB led, it will need to be able to PWM the 3 different outputs. so i dont think that mobule will work. i was thinking of using something like a esp8266 module with atleast 3 gpio pins, as i think i should be able to use them as PWM out. (wil need conformation on that)

Jason
 

Offline fab672000

  • Newbie
  • Posts: 9
  • Country: ca
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #3 on: March 05, 2017, 02:28:38 pm »
The ESP8266EX have four PWM outputs:
Name pin GPIO PWMx
-----------------------
MTDI 10 IO12 PWM0
MTDO 13 IO15 PWM1
MTMS 9 IO14 PWM2
GPIO4 16 IO4 PWM3

But more importantly you'll also need to drive your rgb strips with drivers such as the ULN2003, very easy to use and can drive 2 strips of  RGB leds with its 7 darlington array ; but depending on how many leds to drive, it is probably a good idea to use one per strip, you to evaluate and dimension.

Now for the software remote part ;  an interesting design approach would be to use  the MQTT protocol (you have several MQTT clients for arduino for esp8266) that now allows you implement Publisher / Subscriber metaphors in no time.
Typically your audio master could publish simple commands to the slaves or slaves sending states via a slave device id path string like "/rgb/dev1/{state|command}' "255,10,10" where state is used to publish a state (typically the slave embedded device) and command is usuallly what your slave receives by the server (your audio master server).
Then your slave would subscribe and then be notified by a command (thanks to your mqtt client) and parse a very simple string message, then set the corresponding color with the PWM's. Note that now your device can also send states very simply to the mqtt server (could be useful for heartbeat functionality as an example).

Note that your design should also consider non PWM digital outputs to drive these leds as it would still provide you with color combinations (i.e. digital R+G pins on give a BRIGHT yellow ...).
Now suddenly, you have many more options for your MCU choice and simultaneous output with only one MCU.

Finally if you want to use the ESP8266 MCU which I think is a good choice for your design , try the Wemos D1 or lua boards for prototyping, they sell for nothing on ebay and are very compact.

cheap esp8266ex compact boards on ebay
cheap 50-pcs ULN2003
Mosquitto MQTT implementation. For the audio server part good readings (works on raspberry pi too btw)
« Last Edit: March 05, 2017, 05:53:46 pm by fab672000 »
 

Offline garboui

  • Regular Contributor
  • *
  • Posts: 69
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #4 on: March 05, 2017, 08:09:06 pm »
For simplicity sake on the Rx end and having simotaneous broadcast capability of controlling / operating as an IO bridge, the ~20 xbee modules might be your ticket. Also coming in 900/868MHz variants their link availability will be much better since you will want no interruptions of operation on the first dace.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16941
  • Country: 00
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #5 on: March 06, 2017, 07:37:35 am »
sorta. but as i am using RGB led, it will need to be able to PWM the 3 different outputs. so i dont think that mobule will work.

Why not? It just connects RS232 wirelessly.

If you want colored LEDs then buy a WS2812 LED strip and chop it up. You only need a single Arduino pin to control as many LEDs as you want.
 

Offline Jbates58Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #6 on: March 06, 2017, 09:16:03 am »
sorta. but as i am using RGB led, it will need to be able to PWM the 3 different outputs. so i dont think that mobule will work.

Why not? It just connects RS232 wirelessly.

If you want colored LEDs then buy a WS2812 LED strip and chop it up. You only need a single Arduino pin to control as many LEDs as you want.

Is something like this what you are looking for? http://www.instructables.com/id/RF-315433-MHz-Transmitter-receiver-Module-and-Ardu/


hmmm sorry fellas, after re-reading the page i think that will work a treat.

how would i ensure that all units are connected on the same network/frequency to receive the same signal? this is my first foray into wifi related stuff. i see that it supports sending to multiple devices, but i am just unsure if by the time it reached the last unit, it will be to delayed compared to the first (if that makes sense?) also, would the transmission speed be suitable for this purpose? and what not? i know that the single unit will work well when it has to get the input data, process it then generate the output, however, as there is a wifi link in between them, im just wondering if that will slow it all down to much?

also, would using the code given,

Code: [Select]
this code for transmitter :
//simple Tx on pin D12
//Written By : Mohannad Rawashdeh
// 3:00pm , 13/6/2013
//http://www.genotronex.com/
//..................................
#include <VirtualWire.h>
char *controller;
void setup() {
  pinMode(13,OUTPUT);
vw_set_ptt_inverted(true); //
vw_set_tx_pin(12);
vw_setup(4000);// speed of data transfer Kbps
}

void loop(){
controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,1);
delay(2000);
controller="0"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,0);
delay(2000);

}


would it just be a case of making it look like this to generate the different PWM vaules on the pins?

Code: [Select]
this code for transmitter :
//simple Tx on pin D12
//Written By : Mohannad Rawashdeh
// 3:00pm , 13/6/2013
//http://www.genotronex.com/
//..................................
#include <VirtualWire.h>
char *controller;
void setup() {
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
vw_set_ptt_inverted(true); //
vw_set_tx_pin(12);
vw_setup(4000);// speed of data transfer Kbps
}

void loop(){
controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(9,150);
digitalWrite(10,200);
digitalWrite(11,255);

delay(2000);
controller="0"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,0);
delay(2000);

}


as i also see that there is the 2 states from the original code where it has 2 states, high/low. how do i go about setting the transmitting unit to change the transmitted values based on its calculation?

i will order some of these units soon if this all pans out. wedding is in 9 weeks.

also, on this project. i have a few rolls of RGB strip so i can use that, but its all 12v. to save building a bigger pack, i looked around for 5V RGB and found rolls of them aswell, does anyone here have any experience with them? will they be as good as the 12v?


Jason

 

Offline Jbates58Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #7 on: March 07, 2017, 07:16:22 am »
or, alternativley. after looking at the esp 2866 - 01 unit, it has 3 pins that i can use for the PWM outputs, and as its 2.4ghz wifi, would it not be better for distance and transmission quality?

Jason
 

Offline fab672000

  • Newbie
  • Posts: 9
  • Country: ca
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #8 on: March 10, 2017, 01:10:06 am »
Like I mentioned in my previous post, the esp8266 ex even have 4 pwm outputs, and I used this chip many times to implement WiFi sensor bridges of all sorts in my home.
I also drove rgb leds with arduino minis/nanos for illuminating my kid's pc towers and I used uln2003 drivers to drive the power hungry leds.
What is great with the esp8266 is that most of the time you don't even need RF technology anymore to drive remotely your embedded devices.
Just remember that the ESP8266 is 3.3v not 5v when you choose it over usual arduino atmel 5v chips, especially if you use 5v drivers (you can still adapt your output level if needed though).
 

Offline Jbates58Topic starter

  • Regular Contributor
  • *
  • Posts: 68
  • Country: au
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #9 on: March 10, 2017, 11:19:17 am »
cheers mate.

could you assist me in the coding side? im not to sure even what to look for to learn about it. perhaps if you can point me to where would assist me in what im trying to do. as i said, im new to the whole wifi thing.

Jason
 

Offline fab672000

  • Newbie
  • Posts: 9
  • Country: ca
Re: control multiple arduino outputs over wifi/bluetooth simultaneously
« Reply #10 on: March 11, 2017, 06:53:37 pm »
Start by reading with this
http://www.instructables.com/id/Driving-RGB-LED-strips-off-an-Arduino/?ALLSTEPS
Then get the electronics involved work: as an example I could read few people report that ULN2003A chips would work with 3.3v ; try this and make sure you understand how to drive these leds.

Show us where you are at and we can help more but it is your project, and don't forget to use the thanks button in this thread if people helped you.

We can help you more, but it is your project.
 
The following users thanked this post: Jbates58


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf