Arduino experiments

Moderator: Moderator Group

Arduino experiments

Postby alverman » Fri Dec 31, 2010 6:06 pm

Good evening,
I would like to experiment with the sensor / encoder connected to an Arduino board which then interfaces to the WD.
I would use the WD node Serial and TCP.
Could you tell me the protocol for the transmission of data to different nodes?

Thanks, Alberto
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **
User avatar
alverman
 
Posts: 562
Joined: Sat Jun 12, 2010 6:37 pm

Re: Arduino experiments

Postby mkohler » Tue Jan 18, 2011 4:38 pm

Hello,
Try these libraries and then use the following code.

https://bitbucket.org/bjoern/arduino_os ... /Ethernet/

Best,
Michael
You do not have the required permissions to view the files attached to this post.
mkohler
 
Posts: 15
Joined: Mon Nov 30, 2009 9:41 pm

Re: Arduino experiments

Postby alverman » Tue Jan 18, 2011 4:42 pm

Great :)

tnx
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **
User avatar
alverman
 
Posts: 562
Joined: Sat Jun 12, 2010 6:37 pm

Re: Arduino experiments

Postby dantronic » Thu Feb 03, 2011 3:59 pm

I have been connecting Arduino and WDPro quite a bit. It is possible to send multiple streams of data over serial without a lot of code on the Arduino side, and no OSC needed. The analog input pins translate to 10-bit values {0-1023} and then you just need to package the values from Arduino-->PB like this:

void setup() {
Serial.begin(115200);
int data1 = 0;
int data2 = 0;
int data3 = 0;
}
void loop() {
// read the pins
Analog.Read(1,data1);
Analog.Read(2,data2);
Analog.Read(3,data3);
// and write to serial
Serial.println("a",data1,"/",data2,"/",data3,"b");
}

What you have done is set a "start" character, "split" characters, and "end" character that the COM connection in WD looks for.
So on the WD side...
Start a COM connection in the Connection Manager, with the proper port and speed,
Make a COM node with the same start/split/end characters (I use "a" "/" "b")
Once you activate this node you should see the three values streaming live to the properties window.

Some tips
-use the maximum connection speed allowed for the Arduino board. You can find this in the Arduino Serial Monitor.
-in WDPro the Range node is your friend! Quickest way to convert {0-1023} to {0-65535} etc
-a potentiometer connected to an Arduino input can tend to "flicker" at the top end of the voltage range. Solution = in WDP set Range input max to 1021 instead of 1023, and it will stay steady at the top.
---
Dan Ribaudo
dantronic
 
Posts: 15
Joined: Sun Feb 22, 2009 9:06 pm
Location: St Louis Missouri, USA

Re: Arduino experiments

Postby alverman » Thu Feb 03, 2011 4:28 pm

My arduino Sketch

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x08, 0xE6 }; // Eth shield Mac
byte ip[] = { 192,168,1,10 }; // Arduino
byte server[] = { 192,168,1,195 }; // Widget
int Dx = 0;
int Sx = 0;

// Initialize the Ethernet client library
// with the IP address and port of the server
Client client(server, 8084);

void setup() {
// start the Ethernet connection:
Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(115200);
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");

// if you get a connection, report back via serial:
if (client.connect()) {
Serial.println("connected");
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}

void loop()
{
Dx = analogRead(0);
Sx = analogRead(1);
client.print ("*");
client.print(Dx);
client.print ("@");
client.print(Sx);
client.print ("#");

if (!client.connected())
{
Serial.println("disconnecting.");
client.stop();
}
}
You do not have the required permissions to view the files attached to this post.
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **
User avatar
alverman
 
Posts: 562
Joined: Sat Jun 12, 2010 6:37 pm

Re: Arduino experiments

Postby rubendesnoo » Thu Sep 29, 2011 1:34 pm

Hi Alverman,

We did successfully connect an arduino uno over usb with widged designer, with a compass sensor.But because we would like to have a wireless solution we bought an ethernet shield. We first programmed some sripts and did get tcp data in the browser of the widgets computer, but not in widget designer.

After that we loaded your script on the board but we still couldn't get it working with widget designer.

Could you tell us how you set this up?
- which connection (tcp/udp/client only/multiclient/broadcast etc.)
- which input node?
- which ip-adresses?
- which port?

We would be very grateful if you could help us,

regards
Freelance interactive art production
The Netherlands
rubendesnoo@gmail.com

Widget Designer pro 4.0
rubendesnoo
 
Posts: 141
Joined: Thu Feb 17, 2011 4:10 pm
Location: Netherlands

Re: Arduino experiments

Postby alverman » Fri Sep 30, 2011 10:46 am

I send you my little project.
The port is 8084 but you can modify from a arduino schetch
The ip address for arduino is 192.168.1.10 but you can modify
The ip for widget is 192.168.1.195 but you can modify
The widget connection is tcp

I have used an ethernet shield only because I dont have wifi shield but the configuration is the same of eth shields

Try, modify for your scope and say me if you need more information.

enjoy

Alverman
You do not have the required permissions to view the files attached to this post.
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **
User avatar
alverman
 
Posts: 562
Joined: Sat Jun 12, 2010 6:37 pm

Re: Arduino experiments

Postby trafalmejo » Tue Mar 24, 2015 11:19 pm

Hi dan and everyone,

I tried your solution and it worked, but just once :( !. i didn´t use any split ASCII, just set up de connection ID. and it sent useful data to me. but it is not working anymore. This is my code:

long distancia;
long tiempo;
void setup(){
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(8, INPUT);
}

void loop(){
digitalWrite(9,LOW);
delayMicroseconds(5);
digitalWrite(9, HIGH);
delayMicroseconds(10);
tiempo=pulseIn(8, HIGH);
distancia= int(0.017*tiempo);

Serial.println(distancia);
}


It is about a ultrasonic sensor to measure distances. I just need one data.....the current distance.

Can u help me?
Thanks for all.
trafalmejo
 
Posts: 5
Joined: Sat Jan 17, 2015 3:56 pm

Re: Arduino experiments

Postby sune » Mon Mar 30, 2015 10:10 pm

which Arduino module are you uses to do the network connection ?
Sune Munk Schou
Lighting- and Video Technician
tlf: +45 31 58 54 41
mail: sune@stouenborg.dk
web: stouenborg.dk
User avatar
sune
 
Posts: 37
Joined: Mon Sep 12, 2011 8:16 am
Location: Danmark


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 14 guests

cron