Beginner An Idiots guide: DIY Water Drop Controller with Arduinos and stuff.

No work this evening... so time for some carpentry

Sin-título1.jpg
Sin-título2.jpg
Sin-título3.jpg

It's a good idea not to throw anything away. The board from al old bookshelf were waiting for this oportunity :giggle:
Some screws and two nice holes (well, one nicer than the other) and the frame is ready.
Now wait for the Airtacs and flash cables


Regards
Tony
 
Last edited:
@nattsteer - that looks strange!

It obviously seems to power up ok, but the only thing I can think of is that there is indeed a signal issue....maybe a shorted pin or an accidentally swapped wire, perhaps due to a soldering issue.
I remember when I first powered mine up, nothing worked, and it was then the laborious process of troubleshooting - checking every single connection and track etc.
I found quite a few problems with mine, wires in the wrong place....tracks not broken properly etc....honestly I'm very surprised I didn't fry anything the first time I powered up!

Does anything happen to those jumbled characters when you turn the pots?
Are there any changes to the characters?

When you croc-clipped a pot, do you mean you connected one in parallel to the resistors that you have in place?
If so then this would certainly affect the display in some way I would think.
I think you should replace the incorrect resistors so that you are getting the right contrast, and start from there - at least you can then dismiss it as a potential problem.

Have you plugged in a camera and solenoid to test the functionality (albeit with arbitrarily chosen 'blind' values), and if so does it run the sketch correctly?
If so, this would definitely point towards an issue with the display only, which would narrow things down significantly.

It's possible it's a software/library issue, but I'm not convinced of this with your coding experience....just thought I'd mention it!

I know this is going to sound like a lot of faffing, but if you have a Flickr account, and uploaded some hi-res images of both sides of your board, and then link them here, I would be happy to scrutinise them for any errors....I know only too well how easy it is to become tunnel visioned and not see problems straight away....fresh eyes and all that!
I can't make any promises, but I'd be glad to help if this is something you would like to do.

I wish I could be more helpful....I'm sure you'll get it working soon....and don't throw it on the bonfire - if you put 12V into the +5V, it'll blow up all by itself!:p
I'm kidding....don't do this....I did, and all I got was a rather disappointing 'pop'!:D

Best of luck Natt, and don't give up mate!(y)

Thank you for being ever supportive. I've left it in the corner to think about what it's done for tonight, but I will absolutely take you up on your kind offer tomorrow. The display did change when I turned the pots so I'm sure its a wrong cable or a short somewhere.
I cut off the resistors that were on the contrast line (at gnd and 5v) and clipped those on to the pot so I could get a value, but when I hooked it up to my multimeter it went insane, I got values ranging from 1.3k to 3.4m but I think it's more likely the multimeter as it did something similar when I tried it on some regular resistors the other day.

@Seron
You're right about 1/8000th not being fast enough, but the way I would use them would be to set my shutter speed at say 1/1000th of a second (to be sure that I am eliminating all ambient light) and use my three flashes at lowest power (1/128th) thus retaining the very short flash duration of around 1/20000th of a second, which would be fast enough to freeze the drop.
Oooo, oooo, something I know about! When you use HSS its sort of a jimmy rig way to get round sync issues and shutter speed, and (as I'm sure you know) the curtains of the shutter open one after another at these speeds and scan the sensor (hence why you get a black bar if you try and take a picture above the sync speed) so when you put these flashes into HSS they have to use a longer flash duration to last the length of the scan. It's completely counter-intuitive that you are better off in a dark room with a shutter speed of a couple of seconds while you set your scene and let your flashes do their thing. I realise thing doesn't solve your problem of not wanting to be in the dark of course. In a complete departure of the high tech you could always hold a piece of black card in front of the lens while you manoeuver haha!
 
Oooo, oooo, something I know about! When you use HSS its sort of a jimmy rig way to get round sync issues and shutter speed, and (as I'm sure you know) the curtains of the shutter open one after another at these speeds and scan the sensor (hence why you get a black bar if you try and take a picture above the sync speed) so when you put these flashes into HSS they have to use a longer flash duration to last the length of the scan. It's completely counter-intuitive that you are better off in a dark room with a shutter speed of a couple of seconds while you set your scene and let your flashes do their thing. I realise thing doesn't solve your problem of not wanting to be in the dark of course. In a complete departure of the high tech you could always hold a piece of black card in front of the lens while you manoeuver haha!

Thanks for clarifying it Natt, I didn't know this 'quirk' about HSS at all!
So even though it says '1/128th' power, it actually isn't - that's cheating that is, I'm going to write a letter to my MP immediately!!:D
My apologies to Tony (@Seron ) also, you were right as well!:sorry:

I think it all might be moot anyway, I really rather like Tony's idea of placing a few LEDs on the frame, and have the Arduino turn them off for a few seconds and on again when the drop sequence has finished, using bulb mode in camera.
I think even I should be able to stand still for a few seconds, and not spill anything or break any of my arms/legs etc., while it's doing it's thing!:ROFLMAO:
Plus I also have a few (non HSS) flashes which will all work from the same trigger, so I'll have more light than I know what to do with!

Covering the lens with a black card? That's genius that is! You should patent that immediately! If you don't I will!!:D
Wonder if I could build an Arduino powered servo operated arm, with a black card attached, that moves out of the way at the right moment....how hard can it be?!:ROFLMAO:
 
...although I won't pretend to know how it works!:thinking:
If any doubts, fell free to ask

I never knew you could add more interrupt pins to an Arduino....this could be very useful indeed
They are kind of second-class interrupts and are a litle trickier to use directly. Thats where a good library comes in our rescue :runaway:

I would use them would be to set my shutter speed at say 1/1000th of a second (to be sure that I am eliminating all ambient light) and use my three flashes at lowest power (1/128th) thus retaining the very short flash duration of around 1/20000th of a second, which would be fast enough to freeze the drop.
Still thinking it won't work. At speeds over the "sync" the shutter is not fully opened at any time. The second curtain starts closing before the first one has finished opening so there will be a blocked area. Bigger at higher speeds.
What HSS does in increase the flash duration to give time to expose the whole sensor. Your "freeze speed" will be equal to your shutter speed
Here is an "expert" explanation

I'm having trouble finding those neat little LED stickers however....do you think a couple of ultra bright, white LEDs would work ok?
If they were placed inside a makeshift cone to give a more even spread....just might work, and the LEDs are only 32p each!
I got mine at eBay although shiping cost from Spain will make then less interesting.
Anything will work as far you can stick it at the right place. A short led strip, maybe?

Regards
Tony
 
Still thinking it won't work. At speeds over the "sync" the shutter is not fully opened at any time. The second curtain starts closing before the first one has finished opening so there will be a blocked area. Bigger at higher speeds.
What HSS does in increase the flash duration to give time to expose the whole sensor. Your "freeze speed" will be equal to your shutter speed

Thanks Tony, you're right.
I was being rather hopeful that my flashes would perform some kind of magic, but indeed it all makes sense now.:sorry:

As per my post above, I will, however, be using your idea of LEDs to light my 'drop arena' - so this will simplify my code, and I will no longer have to worry about tedious shutter delays or lag etc..

Your structure looks great by the way - progressing nicely....can't be long before we see some drop images from you I hope!(y)

Thanks again!(y)
 
Thanks for clarifying it Natt, I didn't know this 'quirk' about HSS at all!
So even though it says '1/128th' power, it actually isn't - that's cheating that is, I'm going to write a letter to my MP immediately!!:D
My apologies to Tony (@Seron ) also, you were right as well!:sorry:
I couldn't agree more, a petition is in order!

I think it all might be moot anyway, I really rather like Tony's idea of placing a few LEDs on the frame, and have the Arduino turn them off for a few seconds and on again when the drop sequence has finished, using bulb mode in camera.
I think even I should be able to stand still for a few seconds, and not spill anything or break any of my arms/legs etc., while it's doing it's thing!:ROFLMAO:
Plus I also have a few (non HSS) flashes which will all work from the same trigger, so I'll have more light than I know what to do with!
I've actually been doing some high-speed photography recently, I bought a Hahnel Module Pro and spent this weekend (when not failing at electronics :p) firing glitter stuffed Nerf bullets and can tell you that working in the dark is just ridiculous! I've taken to wandering about with a torch in my mouth! And yet I still fall over light stands or knock something over, I'm just glad nothing expensive has broken yet!
 
Found THESE on Amazon (I remember reading how you don't trust eBay @GarethB

They look just the ticket Natt, thanks for finding them!(y)
And a big thanks for finding an Amazon link too....it means a lot mate!:)
I spent an hour looking, but drew a blank....seems my keyword choice wasn't great!
 
So turns out I couldn’t leave it alone and I had success! No more screen mumbojumbo! Or so I thought... I’ve got one pot controlling two values, one that doesn’t appear to be controlling anything and one that is the wrong way round (no idea how, ground and 5v are the same on all of them and none of them are reverse pots). So I thought I’d plug it in anyway and press the button to see if the valve at least opens, but nah. Nothing. @GarethB I’ve opened a Flickr account (we’ll reopened an old one, don’t laugh at my pictures please, newbie present) and I’ll upload some rat nest masterpieces tomorrow - @Seron there are some up close pics of the support structure there already, link in my signature.
 
So turns out I couldn’t leave it alone....

I would have done the same thing Natt!!:giggle:
It just gnaws away at you!;)
I worked through the night a couple of days ago in fact, trying to get my code to work.... it's a double-edged sword - whilst I managed to make some progress, it'll take me a week to get over it!!:D

Glad you've made some progress, but sorry to hear you have pot issues now....hmm, now that's a sentence that could be badly misconstrued!!:LOL:

I'll check out your Flickr page later today when you post some circuit pics, and of course I won't laugh....we were all newbies once.:)
 
The Difficult Second Album.

Latest (late) updates!

Hello folks!:)

It's been a few months since I last updated this thread with project info, so without further ado, lets get going.

Several months ago I hit a kind of learning plateau....I just couldn't seem to crack certain issues I was having, which would have enabled me to progress further with the next evolution of my water drop controller project.
So I decided to take some time off, and revisit when my brains felt a little emptier!

Now is the time!

Firstly a brief outline of what I want to achieve with my next project.

1 - It will have a minimum of two solenoid valves (maybe three) which again shall be controlled in a similar fashion as the MK 1 version - ie. drop sizes and delays etc..
2 - It will incorporate a much simpler user interface using a button operated menu system, and a rotary encoder to enter time values.
3 - It will have more than one LCD screen (two larger ones in actuality), due to the need to display a lot more timing data.

I have built the prototype project on a breadboard, and it works so far.
I haven't yet connected any exterior equipment yet (camera/flashes/valves etc), but the code I have written seems to work ok - I am using a row of LEDs as stand-ins for the camera etc.

This prototype uses two valves at the moment, but adding a third shouldn't present any significant problems - it's just a simple matter of adding a few lines of code.
It's a very simple circuit, it even looks simpler than the MK 1 version, and that's largely due to point 3 above.

Here are a couple of images showing the prototype on a breadboard:

full


full


I'll break down the new features of the MK2 version into three sections

1 - The LCD screens and I²C protocol
2 - The button keypad
3 - The rotary encoder

Lets first talk about the I²C (or I2C from now on) protocol.

"What is the I²C protocol....or I2C from now on?", I hear you ask?

Well, in laymans terms (and I am a layman) it's a way of connecting an LCD screen using many fewer pins than the way I connected the screen in the MK 1 version.

The method I used in the MK 1 version used six pins on the Arduino, whereas the I2C method uses only two.
And what's more, it will allow more than one screen to be connected, using the same two pins....neat huh?

It requires a separate little board to be soldered onto the back of a conventional LCD screen, where the header pins would normally be soldered.
This little board - or I2C interface module - cost around £1.50 and can be bought from BITSBOX of course....the link is:

I2C Interface module - BITSBOX LINK

So instead of soldering a set of header pins, you would simply solder one of these instead, and you have just converted your LCD screen to work with the I2C protocol.
Now there are only four wires - GND, VCC and two data pins labelled SDA and SCL.

Here's the back of a 20x4 LCD screen with the I2C interface module attached:

full


The pins connections are as follows:

GND - GND on Arduino
VCC - 5V on Arduino
SDA - A4 on Arduino
SCL - A5 on Arduino

There is no need for a separate contrast control, since it comes built in on the back of the board, see below:
(It's the blue, square thing on the right)

full


"How is it possible to connect more than one LCD screen using the same two pins? You did say that earlier didn't you?"

Yes I did.

If you look closely on the back of the I2C interface board, you'll see six tiny solder pads just under the contrast control - they are labelled A0, A1, and A2 - shown in the following image:

full


They are how you configure the address, which is how the Arduino knows what data to send to which place....sort of like a postcode.
You may already know by now that at the beginning of every Arduino sketch which uses an LCD screen, there are a couple of lines of code like this:
(These lines of code are using a newer library, and so won't look exactly like the ones from the MK 1 sketch, but they perform the same function)

C++:
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4)

The first line tells Arduino to include the special LiquidCrystal I2C library and the second line tells Arduino the name of the LCD (lcd in this case), the address and the screen size - the '0x27' is the address and the '20,4' is the screen size....you could of course use '16,2' if you are using a 16x2 screen.

(The LCD I2C library that I used can be found by CLICKING THIS LINK - it's not the newest library, but it works well)

It is this address that needs to be changed, and that will allow another screen (or more) to be connected.
Some fiddly soldering is required here.
One of the pairs of pads needs to be bridged:

full


In order to make this easier, I used a small piece of cut off 'leg' from an old capacitor (always keep your cut-offs).
It was held in place by a tiny blob of flux paste, and then carefully soldered.
It's not the neatest job, but it works.

The following table shows the various combinations of bridged pads and which address that corresponds to.

full


The default (top) is no soldered pads, and corresponds to 0x27 address.
So you can see by soldering the two A0 pins, this LCD screen is now configured to use the 0x26 address.
(It's always a good idea to label what the address is now!)

full


contd below....
 
Last edited:
contd from above....

When it comes to connecting these two screens to an Arduino, it couldn't be simpler.
Using some male to female jumper wires, connect both GNDs to Arduino GND, both VCCs to Arduino 5V, both SDAs to Arduino pin A4 and both SCLs to Arduino pin A5.
Like so:

full


Here is a very simple test sketch which neatly demonstrates the way it works....feel free to have a fiddle with it:

C++:
/*
   This is a simple test program to run two 20x4 I2C LCD screens on a simgle Arduino
   The four pins on the I2C interface should be connected as follows:

   GND - GND on the Arduino
   VCC - 5V on the Arduino
   SDA - A4 (analog pin 4) on the Arduino
   SCL - A5 (analog pin 5) on the Arduino

   Both screens are to be connected to the same pins on the Arduino

*/


#include <Wire.h>                                 // use the Wire.h library - already installed in Arduino IDE                          
#include <LiquidCrystal_I2C.h>                    // use the LiquidCrystal_I2C.h library

///////////////////////////////////////////////////////////////////////////////
//              Download LiquidCrystal_I2C.h library from:                   //
//      https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c      //
///////////////////////////////////////////////////////////////////////////////


LiquidCrystal_I2C lcd1(0x27, 20, 4);              //assign lcd1 to address 0x27
LiquidCrystal_I2C lcd2(0x26, 20, 4);              //assign lcd2 to address 0x26

void setup() {
  // put your setup code here, to run once:

  Serial.begin(9600);                             //start the serial monitor - always good practice

  lcd1.init();                                    // initialize lcd1
  lcd1.backlight();                               // turn on the backlight for lcd1
  lcd2.init();                                    // initialize lcd2
  lcd2.backlight();                               // turn on the backlight for lcd2

}

void loop() {
  // put your main code here, to run repeatedly:

  lcd1.clear();                                    // clear lcd1
  lcd2.clear();                                    // clear lcd2

  lcd1.setCursor(2, 1);                            // set cursor position for lcd1
  lcd1.print("This is screen 1");                  // print your messsage on lcd1


  lcd2.setCursor(2, 1);                            // set cursor position for lcd2
  lcd2.print("This is screen 2");                  // print your message for lcd2
  delay(1000);                                     // wait 1 second

}

This is what it should look like on the two screens:

full


Well that's about all my knowledge of I2C exhausted, more MK 2 stuff to come soon.

Thanks for tuning in folks:)
 
Last edited:
:clap:(y) For that MKII (y):clap: @GarethB
Interesting idea of using two screens. My 20x4 is about to arrive so maybe I'll be using it along wiht the 16x2 instead of replacing one for the other. Being both I2C there should be no problem (I buy them with the I2C module already soldered to keep me as far as possible from hot irons :LOL:)

Waiting for updates

Regards
Tony
 
Wow! You have all been very busy :clap: I have slowed down a fair bit on my project but you have been going great guns! I'll have to buck my ideas up :)

Some good and very helpful information too. The bit about HSS makes perfect sense. I've not used it before but wondered how it worked - thank you all for that (y)

Liking the woodwork @Seron. :clap:

@nattsteer - did you get your display working okay? Also, did you try the balloon bursting photo that you mentioned?

@GarethB - Great work Sir! :clap: I too am following with interest (y)

I'm looking forward to seeing the fruits of everyones hard work :banana:
 
:clap:(y) For that MKII (y):clap: @GarethB
Interesting idea of using two screens. My 20x4 is about to arrive so maybe I'll be using it along wiht the 16x2 instead of replacing one for the other. Being both I2C there should be no problem (I buy them with the I2C module already soldered to keep me as far as possible from hot irons :LOL:)

Waiting for updates

Regards
Tony

Thanks Tony!(y)
I'm not a fan of soldering either!
You only need look at some of my excuses for 'soldering' to see that!:LOL:

Wow! You have all been very busy :clap: I have slowed down a fair bit on my project but you have been going great guns! I'll have to buck my ideas up :)

Some good and very helpful information too. The bit about HSS makes perfect sense. I've not used it before but wondered how it worked - thank you all for that (y)

Liking the woodwork @Seron. :clap:

@nattsteer - did you get your display working okay? Also, did you try the balloon bursting photo that you mentioned?

@GarethB - Great work Sir! :clap: I too am following with interest (y)

I'm looking forward to seeing the fruits of everyones hard work :banana:

Thanks Lee!

I'm also looking forward to seeing some great images from everyone very soon.

Updates in the post!(y)
 
Wow! You have all been very busy :clap:
Definitely got the bug again now!

@nattsteer - did you get your display working okay? Also, did you try the balloon bursting photo that you mentioned?
Not tried the balloon again yet, but managed to get some great shots of glitter stuffed nerf bullets, not put them through post yet but very please with the RAW files (or back of camera jpeg in this case):
9A8355F5-4A3E-4252-8614-14512A20D48B.jpeg
As for the display, got that working... of a fashion but the potentiometers weren’t controlling the correct value (I had one not adjusting anything and one adjusting two, but didn’t seem to be a cross anywhere) and another that was reversed but had the ground and 5v the same way as the others and wasn’t a reverse pot. So I’ve decided to start fresh, with fresh wire, fresh components etc., except tonight I have it on a breadboard and still not able to get the solenoid to drop water but the LED is flashing. So... :runaway: (they don’t have a shrug emoji, but that is similar to how I’ve been feeling :LOL:)
 
Hello again folks!:)

Lets talk about buttons...

full


...no, not that sort of buttons, this kind:

full


(BitsBox link to the buttons I used in this test project: BitsBox 6x6 tactile switches)

Firstly lets briefly mention button or keypad shields.

"What's a button or keypad shield?"

I'm glad you asked because I'm about to waffle on about it for a while.

A button shield is a device which mounts straight onto an Arduino UNO board, and has a 16x2 LCD and a 5 button keypad built in.
It's a very handy little device, that allows all sorts of functions, like menus for example.

It looks like this:

full


(Switch Electronics link to keypad shield shown here: Switch Electronics 16x2 keypad shield)

You'll see that it actually has six buttons.
The button on the far right side of the keypad is actually a reset button for the Arduino, so we shall only be concerned with the other five.

They are 'UP', 'DOWN', 'LEFT', 'RIGHT', and the one on the far left is 'SELECT'.

This is all well and good, but what if we wanted to use a different screen for example, say a 20x4 LCD instead?
And what if it just isn't practical to use an Arduino UNO for size reasons?
And furthermore, what if you wanted to put the buttons in a different place, away from the screen?

I wanted answers to these questions, and it turns out that the solution is....make your own button shield!

Don't panic...it's not as hard as it sounds!

Put simply, a button shield is five buttons which are connected through a resistor array, to a single analogue pin on the Arduino.
(I'll be using a 20x4 LCD screen, which will be connected the way I discussed in the previous chapter.)

As you press a button, the Arduino sees a value between 0 and 1023 on the analogue pin.
We can adjust the resistors so that a specific button has a specific value.
Then it's a matter of assigning a button to a particular resistance value.

In order to emulate the exact button shield function, I used the following values of resistors:

1 X 330 Ω
1 X 620 Ω
1 X 1 KΩ
1 X 2 KΩ
1 X 3.3 KΩ

I connected it using the following circuit:

full


It should look something like this:

full


As you can see, it only uses one pin (the orange wire to analog pin A0 in this case) on the Arduino NANO, which is very handy if you want to keep things minimal.

Now lets connect up the LCD screen, as shown in the previous chapter above:

full


And there it is, a 'homemade' keypad shield, which uses an Arduino NANO, and can be customised and fitted into any project.

Of course it won't work without a sketch.

So lets talk about that....this is where it might get a little bit complicated, because I'm also going to talk about using the buttons to navigate a menu system.

There are many ways to implement a menu structure in Arduino, and I have spent a considerable amount of time looking for the simplest and easiest to follow.
The template that I was able to find is reasonably simple to understand, as long as you work through it slowly and methodically.

It uses the 'switch-case' system within Arduino, which enables choices to be made depending on inputs.

Here is the template sketch:

C++:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++

Adapted by Gareth Bellamy (2019)
Thanks to Fahmi Ghani for his menu template

+++++++++++++++++++++++++++++++++++++++++++++++++++*/

// LCD Pins: VCC - 5V, GND - GND, SDA - A4, SDL - A5

#include <Wire.h>
#include <LiquidCrystal_I2C.h>           //Use I2C library for LCD
LiquidCrystal_I2C lcd(0x27, 20, 4);      //Set up 20x4 LCD called 'lcd' - assign to 0x27 address (default)

int keypad_pin = A0;                     //assign the button pin to A0 on Arduino
int keypad_value = 0;
int keypad_value_old = 0;

char btn_push;

byte mainMenuPage = 1;
byte mainMenuPageOld = 1;
byte mainMenuTotal = 5;         //specify how many pages are in the menu - change if more pages required


void setup()
{
  Serial.begin(9600);         //start the serial monitor
  lcd.init();                 //Initialise lcd
  lcd.backlight();            //turn on backlight

  MainMenuDisplay();          //call the function 'MainMenuDisplay'

  delay(1000);
}


void loop()
{
  btn_push = ReadKeypad();       //read values from buttons

  MainMenuBtn();                 //call the function 'MainMenuBtn'

  if (btn_push == 'S')           //enter selected menu
  {
    WaitBtnRelease();
    switch (mainMenuPage)
    {                            //the following 'cases' are the main menu options - add more 'cases' if more pages added
      case 1:   
        MenuA();
        break;
      case 2:
        MenuB();
        break;
      case 3:
        MenuC();
        break;
      case 4:
        MenuD();
        break;
      case 5:
        MenuE();
        break;
    }

    MainMenuDisplay();
    WaitBtnRelease();
  }



  delay(10);

}

//--------------- main menu button navigation ---------------------

void MainMenuBtn()
{
  WaitBtnRelease();
  if (btn_push == 'U')                  //if the up button is pressed...
  {
    mainMenuPage++;                     //....then increment the page by 1
    if (mainMenuPage > mainMenuTotal)
      mainMenuPage = 1;
  }
  else if (btn_push == 'D')             //if the down button is pressed...
  {
    mainMenuPage--;                     //...then decrement the page by 1
    if (mainMenuPage == 0)
      mainMenuPage = mainMenuTotal;
  }

  if (mainMenuPage != mainMenuPageOld) //only update display when page change
  {
    MainMenuDisplay();
    mainMenuPageOld = mainMenuPage;
  }
}


void MainMenuDisplay()      //this function calls the main menu options - add more 'cases' when more pages needed
{
  lcd.clear();
  lcd.setCursor(0, 0);
  switch (mainMenuPage)
  {
    case 1:
      lcd.print("1. Menu A");
      break;
    case 2:
      lcd.print("2. Menu B");
      break;
    case 3:
      lcd.print("3. Menu C");
      break;
    case 4:
      lcd.print("4. Menu D");
      break;
    case 5:
      lcd.print("5. Menu E");
      break;
  }
}

//This is where the individual menu contents are to be actioned
//Add more 'void Menu#()' if you are adding more pages - copy and paste, but change the relevant bits accordingly

void MenuA()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Inside Menu A");

  while (ReadKeypad() != 'L')             //task is performed and then pressing 'left' takes you back to main menu
  {

    //Insert Task for Menu A here

  }
}


void MenuB()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Inside Menu B");

  while (ReadKeypad() != 'L')
  {

    //Insert Task for Menu B here

  }
}


void MenuC()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Inside Menu C");

  while (ReadKeypad() != 'L')
  {

    //Insert Task for Menu C here

  }
}


void MenuD()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Inside Menu D");

  while (ReadKeypad() != 'L')
  {

    //Insert Task for Menu D here

  }
}


void MenuE()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Inside Menu E");

  while (ReadKeypad() != 'L')
  {

    //Insert Task for Menu E here

  }
}

char ReadKeypad()        //this function sets up the button values and assigns the directions
{

  Serial.println(keypad_value);             // if different resistor values - open serial monitor, hold down a button and note the value then adjust values below accordingly

  /* Keypad button analog Value
    no button pressed 1023
    select  741
    left    503
    down    326
    up      142
    right   0
  */
  keypad_value = analogRead(keypad_pin);


  if (keypad_value < 100)           //the right button value is 0 - see above
    return 'R';
  else if (keypad_value < 200)      //the up button value is 142
    return 'U';
  else if (keypad_value < 400)      //the down button value is 326
    return 'D';
  else if (keypad_value < 600)      //the left button value is 503
    return 'L';
  else if (keypad_value < 800)      //the select button value 741
    return 'S';
  else
    return 'N';

}


void WaitBtnRelease()
{
  while (analogRead(keypad_pin) < 800) {}
}

Of all the menu sketches I found on the internet, this one was by far the easiest to understand....and I like easy!!:giggle:
It might look daunting, but I've tried to notate it as best I can....I'll be honest, I don't even understand bits of it....but it does work well, and I think it will work nicely for what I have in mind for my project.

It can be expanded to have as many pages as you like, but for this example sketch there are five pages, with each main menu page having a sub menu section, which can be anything you want to do.
For me this will be where I will tell Arduino the individual valve timings and flash delays etc.

If you are following along at home, and have connected your buttons with the resistor values that I have, then this sketch should work straight away.
If, however, you haven't used the exact same values, then resistors that are close will do.
You will need to check the values of each button in the serial monitor, and make the necessary changes in the sketch - I have shown where to do this....it's near the bottom.

Thanks to Fahmi Ghani for publishing this great menu Template.
His original sketch can be found here:

https://pastebin.com/HKPsWB6z

Here is a link to the demonstration video (by the original author), showing the menu in action:

View: http://youtu.be/cMqif5ICS5M


I should reiterate that I have adapted his sketch to work with a 20x4 LCD screen, and I have added a fifth menu page, whereas his original will only work with a 16x2 keypad shield, and only has four menu pages.

contd...
 
Last edited:
...contd

So now we have a working button system, with a fully expandable menu system.
There follows a series of images demonstrating what my revised code (above) looks like.
(I'm too cheap to film it):giggle:

Here is what my menu looks like on a 20x4 screen:

full


...and here is my finger pressing the 'up' button:

full


...and now we're on the 'Menu B' page:

full


...and my finger is now pressing the 'select' button:

full


...and finally we see what is inside the 'Menu B' page:

full


That's all for now folks.

I hope this will be useful to someone out there.

Stay tuned folks!
 
That's a great couple of posts @GarethB. I wish I could articulate a tutorial as well as you! I feel inspired to find a new project that uses two screens and a set of buttons now (y) :banana:

Although, I really should finish the project thread that I started first I guess!!
 
That's a great couple of posts @GarethB. I wish I could articulate a tutorial as well as you!

Thank you Lee, that's very kind of you to say....although I've noticed that my thread has a distinct lack of actual water drop images, whereas yours has some fantastic images!
Perhaps I'm getting carried away with the waffle and not doing enough photography!:sorry:
Leebert also said:
I feel inspired to find a new project that uses two screens and a set of buttons now (y) :banana:

There's nothing that buttons cannot achieve!!:D

Leebert further said:
Although, I really should finish the project thread that I started first I guess!!

It'll never finish....it'll go on forever!;)
If you do finish however, you've done it wrong!!:LOL:

Just kidding, I've had a gander at your updates just now, and the triptych image is superb, really first class.:clap:
I must get on and cobble together a working prototype so I too can get this thread looking snazzy with some (hopefully) nice water drop images.

I have a (somewhat) radical idea, that I've been keeping a secret.
I don't think it'll revolutionise anything....don't want to oversell myself here....but I don't think anyone has tried it yet....and I've scoured the internet.
To make it happen I am going to need a pressurised tank, and....
I've said too much....more later!!:p
 
Hi Gareth
Great write up, I have wired it as you explained, uploaded the sketch, I'm a complete novice where Arduino is concerned when opening the serial monitor and change the timings in the sketch, nothing happens, should I see numbers in the serial monitor?
Also, the camera won't trigger, I have changed the polarity on the Optocoupler
 
Hi Gareth
Great write up, I have wired it as you explained, uploaded the sketch, I'm a complete novice where Arduino is concerned when opening the serial monitor and change the timings in the sketch, nothing happens, should I see numbers in the serial monitor?
Also, the camera won't trigger, I have changed the polarity on the Optocoupler

Hi Jim, thanks for reading all my ramblings!(y)
And:welcome: to TalkPhotography too!

Sorry for the delayed response, I'm not at my pc ATM, but I will be later today.
I promise I will address your questions then.
In the meantime, would it be possible for you to take one or two photos of your circuit on the breadboard?
If you have a Flickr account, it's very easy to link the images here.
Or you could upload them directly on the site via the 'Gallery' tab at the top of the page, but make sure the size is no more than 1024 pixels on the longest side.

If you prefer not to upload any pics, don't worry...we'll get you up and running anyway!
:)
 
Gar
Hi Jim, thanks for reading all my ramblings!(y)
And:welcome: to TalkPhotography too!

Sorry for the delayed response, I'm not at my pc ATM, but I will be later today.
I promise I will address your questions then.
In the meantime, would it be possible for you to take one or two photos of your circuit on the breadboard?
If you have a Flickr account, it's very easy to link the images here.
Or you could upload them directly on the site via the 'Gallery' tab at the top of the page, but make sure the size is no more than 1024 pixels on the longest side.

If you prefer not to upload any pics, don't worry...we'll get you up and running anyway!
:)


Gareth image on Flickr

View: https://www.flickr.com/photos/119906778@N08/48990363538/in/dateposted-public/
 
Gareth

Hi Jim, thanks for reading all my ramblings!(y)
And:welcome: to TalkPhotography too!

Sorry for the delayed response, I'm not at my pc ATM, but I will be later today.
I promise I will address your questions then.
In the meantime, would it be possible for you to take one or two photos of your circuit on the breadboard?
If you have a Flickr account, it's very easy to link the images here.
Or you could upload them directly on the site via the 'Gallery' tab at the top of the page, but make sure the size is no more than 1024 pixels on the longest side.

If you prefer not to upload any pics, don't worry...we'll get you up and running anyway!
:)

Gareth
Photo of Optocoupler, is there a difference between an Optocoupler and an Optoisolator?

View: https://www.flickr.com/photos/119906778@N08/48990445418/in/dateposted-public/
 
Hi Jim.:)

Gareth I have to do three posts first before I can link anything

Ahh, you're right...forgot about that, sorry!:facepalm:

Glad you got it sorted, Thanks for showing the pics.

Photo of Optocoupler, is there a difference between an Optocoupler and an Optoisolator?

Firstly, there is no difference between an optocoupler and an optoisolator, they are essentially the same thing.

I've just looked up the data sheet for your optocoupler in your second pic, (MCA2231) and yours has a 'photodarlington' on the output pin 4, (red arrow) which means there are two transistors linked in a 'darlington' pair on the output, as opposed to a single transistor in the 4N35 (blue arrow)

full


Link to ISOCOM Components MCA2231 pdf datasheet: http://isocom.com/wp-content/uploads/2017/08/MCA2230_31_MCA2255Data.pdf

The 'darlington' configuration greatly increases the current gain, but in our case here I don't think this will make any difference to the operation, it's there merely to isolate the camera from any damaging voltages on the 12V side, where the solenoid lives.
I've checked the pin layout too, and they are the same, so nothing to worry about there.

The one that's in your circuit image (image #1) looks to be a different one however...can't quite make out the part number, but it looks like a 4N35, in which case It'll be fine.

I wonder if you could confirm that you're using a 4N35, and also a TIP120 transistor too.
It's not critical that they are the same of course, but if they are, then we'll definitely be on the same page.

I've had a close look at your circuit, and it looks like everything is connected correctly.
The resistor values check out, but I can't quite see clearly if your diode is facing the right way....it should have the bar facing towards the 12VDC rail.
I know this may seem obvious, but it's worth double checking all the orientations...I've done it myself many times!!

I've just rebuilt the circuit again to test it out and see if we can track down the problem with yours.

I assume you're using the code I posted on page #1 of this thread, namely Water Drop Controller V4?

Code can be found by clicking here

One thing to always check before you upload anything, is to check that the correct COM port is active for your Arduino.
You'll find it under the 'Tools' tab in the Arduino IDE...it's labelled 'Port'.
Again, sounds obvious, but if I had a pound for every time I forgot....etc!!:LOL:

full


So, when the code is uploaded, and you open the serial monitor for the first time, you should see this:

full


Make sure that it says 'No line ending' - (red arrow) - this means that each line will load cleanly (there are line breaks already in the sketch)
And double check the baud rate too - (blue arrow) - it should match what is typed near the top of the Arduino sketch:
C++:
Serial.begin(9600);         //Start the Serial Monitor

full


After entering a value for the 1st drop size, - 100 in this case:

full


...and pressing enter, you'll be presented with another line asking for the 2nd drop size:

full


...and so on, until you've entered all four values.
When you next hit enter (for the final time), the serial monitor should display this:

full


....and the program will cycle continuously with those time values, pausing for 5 seconds after each sequence, until you press the reset button, when it will start from the beginning again, and you can enter different time values.

The circuit I've just put together is working - my valve is opening and closing and my camera's shutter is activating at the right time intervals.

I'm sure you'll get yours running...it's probably something simple which you might have overlooked....I do it all the time!!:giggle:

Just check that the optocoupler is seated securely (same for all components naturally) because I've found that they can sometimes 'ride up' out of the sockets.

Also check that you have set up the serial monitor correctly too....as above.

Good luck Jim, I'm sure you'll be up and running in no time!(y)

Don't hesitate to post if you have any further questions, and even though I'm still a relative novice, I'd be only to glad to help in any way I can.:)
 
Last edited:
Quick follow up thoughts...

You said that your camera shutter isn't firing, so I'm assuming that your valve isn't operating also?
The code will wait indefinitely for an input, and understandably you won't be able to input any figures until you can see the serial monitor properly, but just thought I'd ask.

Do you have any more optocouplers? I think they are quite robust, but on the off chance that one is blown, it's good to have some spares to swap out just in case.

Also are you using a Canon camera, and if so, does it use the N3 type connector that mine does?
The reason I'm asking is that although it's a very simple connector, it's also very easy to get the wires the wrong way round...again, I know this all too well from experience!!:LOL:
If it's the 2.5mm jack connector, then the process is more or less the same....test by shorting the wires and seeing which one is for the shutter and which one is for autofocus.
 
Last edited:
Garth
You are a star all working now I changed the Optocoupler! Valve and camera are going, thank you very much for the detailed troubled shoot, yes I'm using Canon 5Dmklll
Jim
 
Garth
You are a star all working now I changed the Optocoupler! Valve and camera are going, thank you very much for the detailed troubled shoot, yes I'm using Canon 5Dmklll
Jim

That's great news Jim, glad to have helped!
Very pleased you have a working system now....feel free to post some water drop images here when you have your times dialled in...would be great to see them!(y)
 
Will do when I get all set up, I built one about three years ago following Ted Kinsman on PetaPixel and got some good images.
Ones my Flickr page
View: https://www.flickr.com/photos/119906778@N08/32685332613/in/dateposted-public/

Wow!!!:clap:
Fantastic work there Jim....looks like I could learn a lot from you!

Ted Kinsman's guide is indeed excellent, I found it tremendously helpful too.
I will surely be perusing your Flickr pages too, some very impressive images there Jim.

Looking forward to seeing some more water drop images from you soon.
 
Last edited:
Thanks Gareth
The one I built then was put away and got lost, I started to search Google a few weeks ago for another I seen yours and tried to build it but didn't understand how the monitor worked until your explanation here
I found the leads and valve so will get it up and running next week I hope.
Most of the images on Flickr I used Zxanthan gum and food colouring so will need to get some of that.
I got a lot of help from an American lady through Facebook Carol Kunkis Cohn and Hugh Letheren on World of Drops.
 
Thanks Jim.(y)

I also use xantham gum as a thickener... it's a bit of a faff, but it works...and it's cheap!
I started with vegetable glycerin, which is nice and clear and dilutes nicely with water (and doesn't smell like xantham gum!) but it's a bit expensive.
What ratio do you mix?
I've been using a 1/4 teaspoon of xantham powder per litre of water...seems to work ok.

Also, what do you use to make it opaque?
A lot of 'drop photographers' use milk so I've heard, but of course that will go bad quickly, so I'm curious what other, longer lasting solutions there may be.
I have some water soluble, white pre-mixed poster paint, which I'm hoping will work...but I suppose the valves will need to be dismantled and cleaned after every use!
(Valve maintenance isn't a strong point of mine!):giggle:

Do you use any detergent in your mixes?
I have yet to experiment with this, though I've heard it yields nice, long, stringy water bounces, though the bubbles could be problematic!
I should probably do some tests!

I'm currently working on a pressurised, double valve system at the moment...a sort of 'one up - one down kind of thing...with limited success!!

Anyway, good luck with your project Jim.(y)
 
Last edited:
Gareth
I have set up my system and it didn't work, was getting only one drop but the camera was trying to shoot twice, looked at the sketch and the wiring diagram and discovered pin 9 and pin 10 were mixed up, changed them around and all is working fine two drops and camera working. I have included a photo for you to check.
Jim
 
Last edited:
Gareth
I have set up my system and it didn't work, was getting only one drop but the camera was trying to shoot twice, looked at the sketch and the wiring diagram and discovered pin 9 and pin 10 were mixed up, changed them around and all is working fine two drops and camera working. I have included a photo for you to check.
Jim

Crikey!!
Good catch Jim, thanks for spotting that....how very clumsy of me!!:sorry:

I'll amend the original post accordingly.
 
Back
Top