"Arduino valve controller"

61 views
Skip to first unread message

Tom Fitzsimons

unread,
Feb 19, 2020, 4:03:02 PM2/19/20
to E-Prime
I designed a valve controller for an 8 channel olfactometer using an Arduino Mega and a solid state relay system to replace a Valvelink 2.  The Valvelink is about $1,200, the Arduino controller was less than $200 in parts.  It has a response time of less than 10ms.  If you need to control an external physical device that is amenable to control from an Arduino I'll be happy to share the design, parts list, and CAD file for the containment box.

As an aside, I build custom olfactometers.

Tom

Spape, Michiel

unread,
Feb 19, 2020, 6:00:07 PM2/19/20
to e-p...@googlegroups.com

Hi Tom,

My own custom olfactometer says this smells like spam. I just wanted to congratulate you, with which I mean the algorithm, on finding something so uncannily almost on target! This group loves millisecond response accuracy, external device control, and studies of perception (though very rarely olfactory perception). Great work.

 

So how would you use it in E-Prime? You got this far past moderation, might as well go for it.

 

I’m sorry for treating this list like social media.

 

Best,

@Michiel

 

#olfactometer4EPrime3, #sorrynotsorry

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/dc5991e1-3aea-4959-9bce-158f96d0cecd%40googlegroups.com.

tom fitzsimons

unread,
Feb 19, 2020, 7:35:12 PM2/19/20
to e-p...@googlegroups.com

Ah – if it was intended as spam I would have written the post in PYTHON.

 

Since I don’t have a copy of e-prime I’ll have to say only that you would communicate with the Arduino the same way you would with any serial device; i.e. send it a string with a tuple or list of tuples designating the circuit you would like to activate, the state you would like it to be and the time you would like it to be active for, along with an end of list command to initiate action.  See for example DEVICE: How To: Serial Port Communication [25287]

https://support.pstnet.com/hc/en-us/articles/360008222633-DEVICE-How-To-Serial-Port-Communication-25287-

 

The point about building olfactometers was intended to demonstrate that it works.  I have tried it with simple solenoid valves, pulse width modulated valves and stepper controlled valves for gradually blending or varying the intensity channels.  Here is the test program (in Arduino’s version of C) and a signal scan of the output from the Arduino and the output from the solid state relay roughly 5 ms later. 

 

The controller would work with any electromechanical device.  I’ll post a link to the bill of materials and rough schematics on the web by Monday.

 

  // Set up variables

  //First the input array of valves if using direct control via PC

int pin = 35, V2 = 36, V3 = 37, V4 = 38, V5 = 39, V6 = 40, V7 = 41, V8 = 42;

int index;

int state;

int wait = 2000; //2 seconds

int L_BUILTIN = 13;

int numValves = 8;

 

void setup() {

Serial.begin(115200);

pinMode(L_BUILTIN, OUTPUT);

 

for (int pin = 35; pin < 43; pin++) {   

    pinMode (pin, OUTPUT);}

pinMode(25,OUTPUT);

for (pin = 35; pin<43; pin++) {

    digitalWrite (pin, HIGH);}

delay(wait);

Serial.println("ALL VALVES ARE ON");

for (int pin = 35; pin<43; pin++) {

    digitalWrite (pin, LOW);}

digitalWrite(25,LOW);

Serial.println ("ALL VALVES ARE OFF");

}

 

void loop() {

 

for (int pin = 35; pin<43; pin++) {

    digitalWrite (pin, HIGH);

    delay(100);}

digitalWrite(25,HIGH);

Serial.println("ALL VALVES ARE ON");

delay(wait);

 

for (int pin=35; pin<43; pin++) {

    digitalWrite (pin, LOW);

    delay(100);}

digitalWrite(25,LOW);

Serial.println ("ALL VALVES ARE OFF");

delay (wait);

Time lag.png

Spape, Michiel

unread,
Feb 20, 2020, 2:30:54 AM2/20/20
to e-p...@googlegroups.com

Hi Tom,

As I sent the previous email, I was thinking that if you aren’t an algorithm, this would be a marvellous opportunity to start a ‘flamewar’. From twitter-hashtags back to ‘flaming’, that’d be quite the thing - whoever uses that term these days, right?! Instead, you present a pretty nice reply that seems related enough, although you might want to focus on the target audience out here who doesn’t necessarily do coding; they’re generally psychologists, not engineers.

 

I don’t know why python makes a post more spammy; to me a post is spam if it’s unsolicited email, generally towards marketing a product or service. You’re still selling this device, no? In this mailing list, people generally send email because they’re trying to develop a psychology experiment in E-Prime and get stuck somewhere along the way (how do I randomize a list of words multiple times without repeating single words, that sort of thing). As a friendly bit of advice, that’s where you might position, perhaps send a few example situations that are intelligible for an experimental psychologist.

 

Cheers,

Michiel

David McFarlane

unread,
Feb 20, 2020, 1:01:28 PM2/20/20
to e-p...@googlegroups.com
Just to back up Tom's point about communicating with the Arduino over
the (virtual) serial port, we have done this ourselves on a couple of
E-Prime projects, one to collect tapping responses from a piezoelectric
device, and another to handle a "spinwheel" for real-time control of
music playback tempo. Lots of things we could do with Arduino &
E-Prime, including replacing the PST SRBox.

-- David McFarlane


On 2020-02-19 Wed 7:34 PM, tom fitzsimons wrote:
> Ah – if it was intended as spam I would have written the post in PYTHON.
>
>
>
> Since I don’t have a copy of e-prime I’ll have to say only that you would communicate with the Arduino the same way you would with any serial device; i.e. send it a string with a tuple or list of tuples designating the circuit you would like to activate, the state you would like it to be and the time you would like it to be active for, along with an end of list command to initiate action. See for example DEVICE: How To: Serial Port Communication [25287]
>
> https://urldefense.com/v3/__https://support.pstnet.com/hc/en-us/articles/360008222633-DEVICE-How-To-Serial-Port-Communication-25287-__;!!HXCxUKc!k1ZZcJAYS8wegZJTcGP-801paQWwsubh9NYEKaq8uA_zFlPCDjwxveMnJTZd-ogT$
Reply all
Reply to author
Forward
0 new messages