Welcome to the forum   
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post in this topic Go to first unread post in this topic
Offline madhu.gn.71  
#1 Posted : 23 May 2016 19:45:05(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
Hello all,
I realized that there are few members in the forum who have been using Arduino for automation on their layout. There are few like me and Johnvr who are learning. And few who might want to explore. In this thread let us share everything 'we had done\will be doing' using Arduino so that other members can benefit from that.

I'll start with what I've understood about Arduino after having done small projects with the starter kit I bought.
Note: I'm not from electronics background. So if I can understand Arduino, anybody else in this world can:)

- Arduino is nothing but a programmable chip embedded on a piece of circuit with some interfaces.
-We program the chip using a USB cable and a simple, freely available tool called Arduino Integrated Developement Environment (IDE)
- The interfaces are input and output pins
-Input pins let you connect Sensors
- pressure sensor,
-light sensor,
-infrared sensor,
-manual push button,
-optical sensor
-Temperature Sensor
-Potentiometers (to gradually increase\decrease the voltage) and many more

Output pins let you connect actuators
- A Servo motor (a motor with builtin circuit that can turn only 180 degrees and back to 0 degrees)
- A motor
- Light Emitting Diodes (LEDs)
- Display Screens - yes you can print custom texts on an LCD display and probably more

In simple words, Arduino connects Sensors to Actuators using a few pieces of instructions called Code.
From my limited knowledge at this point of time, I can say that we can achieve the following for our MRR needs
- Flickering of red LED to simulate fire
- A railway crossing gate with realistic slow movements of gates
- Detect a moving train using infrared sensor
- Make a wind mill rotate very slowly
- Turnout switches
- Traffic Signals
- Station Announcements when the train is nearing the station
- Use 1 LED to emit Red, Blue, Green and Yellow colors using a technique called Pulse Width Modulation
-Control your layout's accessories using a smart phone by adding a "Bluetooth shield" and many more

Arduino starter kit is a great way to explore the potential of this invention.

Here are two projects which I have uploaded on Youtube.



thanks 2 users liked this useful post by madhu.gn.71
Offline Johnvr  
#2 Posted : 23 May 2016 20:25:09(UTC)
Johnvr

South Africa   
Joined: 03/10/2010(UTC)
Posts: 1,269
Location: Cape Town, South Africa
Madhu,

Thanks for the brief introductory chat, and for starting the topic on Arduino Projects and Model Railways.
I am really a beginner at this hobby device, but I do see some great potential here.

My current project is to connect up some Marklin Hobby Signals to the Arduino. These are Marklin Distant Signals so no switching of track current involved here, but I would like the signals to change to RED when the train passes, then back to GREEN again.

Here is a picture of my simple setup so far.

In Development Mode, Computer connects USB cable to the Arduino, and Arduino powers the signals.
The Arduino can be powered by external power supply when project is complete.
Programming the signals is done using some fairly basic programming language.

Watch this space !

IMG_1174.JPG

Regards,BigGrin
John
thanks 1 user liked this useful post by Johnvr
Offline Oliver nagel  
#3 Posted : 23 May 2016 20:55:17(UTC)
Oliver nagel

United States   
Joined: 30/12/2012(UTC)
Posts: 121
Location: Allegany
Here is a nice site for Arduino projects.https://rudysmodelrailway.wordpress.com/software/
Flapper

Edited by user 24 May 2016 21:22:09(UTC)  | Reason: Not specified

thanks 1 user liked this useful post by Oliver nagel
Offline madhu.gn.71  
#4 Posted : 19 June 2016 11:58:48(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
I'm trying to control speed of a DC motor so that the wind mill rotation looks realistic. In real world we might have to use either a gear train or set of pulleys to make the windmill rotate slow.
With Arduino and pulse width modulation, we can generate slow speeds. The motor which I've used here is quite powerful and has high RPM. I'll try this experiment with small motors later.
Here is the code to achieve the same and the end result is shown in the video.
Caution: provide 9V dedicated power supply to Motor and let the ground be shared with Arduino. Use light weight material for windmill so that inertia is less while running at low speeds
Code:
const int motorPin = 9;
int motorSpeed;
void setup() {
pinMode(motorPin, OUTPUT);
}
void loop() {
analogWrite (motorPin, 14) ; //Play around with this number for slow rotation
delay(23);  //Some delay for motor to digest and process the command given
analogWrite (motorPin, 7); //Just to avoid jerky motor movments
delay(30);
}


thanks 2 users liked this useful post by madhu.gn.71
Offline madhu.gn.71  
#5 Posted : 19 June 2016 12:23:24(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
Alien\UFO sound or siren:
On your layout if you need fire alarm or siren or some eerie sound, you could try this:)
This is one of the starter kit projects and the code is included in Arduino IDE itself (File>>Examples>>10. Starterkit>>p06_Light Thermin). In the example below, a light sensor is used as a feedback device. We can as well program so that a specific pattern of sound gets played repeatedly

thanks 2 users liked this useful post by madhu.gn.71
Offline kiwiAlan  
#6 Posted : 19 June 2016 15:44:55(UTC)
kiwiAlan

United Kingdom   
Joined: 23/07/2014(UTC)
Posts: 8,067
Location: ENGLAND, Didcot
Originally Posted by: madhu.gn.71 Go to Quoted Post
...Use light weight material for windmill so that inertia is less while running at low speeds


If running at low % pwm (which I suspect you are, seeing you say you have a 'high speed' motor) then there may be some advantage in having a reasonable mass in the windmill blades to smooth out the motor pulses and give an appearance of smooth operation.

Offline madhu.gn.71  
#7 Posted : 19 June 2016 16:43:41(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
Originally Posted by: kiwiAlan Go to Quoted Post

then there may be some advantage in having a reasonable mass in the windmill blades to smooth out the motor pulses and give an appearance of smooth operation.



Yes, you are right! However in the video I've posted above, the wings needed a small push (30th second) when the Arduino board was reset. That lead to my above assumption. I'll keep you all posted with my experiments with different DC motors
Regards,
Madhu
Offline madhu.gn.71  
#8 Posted : 03 October 2020 05:32:58(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
Scratch built a water crane using scrap materials. The crane is controlled by Arduino using IR sensor. Refer to the sketch annotations for more details


Code:
#include<Servo.h>
/**
 * This sketch activates a servo by detecting an obstacle. The primary purpose of this program is to rotate a water crane's 
 * arm when a loco arrives. Read the inline comments for more details
 * Infrared Sensor connected to A1
 * A light bulb (not an LED) connected to OUTPUT 12
 * A servo connected to PIN 9
 * Author: Madhu Gubby 
 * Date: 2020
 */
Servo servo;
int lastReading = 0;
const int SENSOR1 = A1;
const int SERVO = 9;
const int LIGHT = 12;
int sensor1Value = 0;
boolean spoutOpen = false;
void setup() {
  pinMode(LIGHT, OUTPUT);
  servo.attach(SERVO);
  servo.write(0);
}

void loop() {
  sensor1Value = analogRead(SENSOR1);
  delay(15);
  if (sensor1Value < 200) //When the train arrives and blocks the sensor
  {
    delay(4000);
    if (analogRead(SENSOR1) == lastReading) { // If it is a moving loco, the sensor might identify an obstacle but no need to activate the spout. 
      //Here it is assumed that a loco takes 4 seconds to go past the sensor. However this needs to readjusted after fixing on the layout
      activateArm();
    }
  } else {
    lastReading = analogRead(SENSOR1);
  }
}

void activateArm() {
  digitalWrite (LIGHT, HIGH); //Switch on the spout's light
  for (int i = 0; i <= 80; i++)
  {
    servo.write(i);
    delay(40);
  }
  delay(6000); //The spout's arm will be open for 6 seconds
  lastReading = analogRead(SENSOR1);
  deactivatArm(); // Rotate the arm back to the position that it was in before
}


void deactivatArm() {
  for (int i = 0; i <= 80; i++)
  {
    servo.write(80 - i);
    delay(40);
  }
  lastReading = 0; //set it to zero to mark the completion of a water filling cycle
  delay(1000); //wait for a second before switching off the light
  digitalWrite (LIGHT, LOW); //Switch off the spout's light
}
thanks 7 users liked this useful post by madhu.gn.71
Offline DaleSchultz  
#9 Posted : 03 October 2020 15:32:48(UTC)
DaleSchultz

United States   
Joined: 10/02/2006(UTC)
Posts: 3,997
nice job on the crane too!

I thought I would add my 'project' to the list too!

The RemoteSign screens I make are also in the Arduino environment even though the boards are not made by Arduino. I use the ESP boards which come with WiFi built in.

I have built up a whole ecosystem of software and signs with its own set of common commands. One can load my software onto ESP8266 or Wemos D1 mini processors and control output pins from other software in real-time over your wifi network, as well as drive small screens for station signs, etc.

You can also respond to sensors etc.

Edited by user 03 October 2020 19:17:07(UTC)  | Reason: typo

Dale
Intellibox + own software, K-Track
My current layout: https://cabin-layout.mixmox.com
Arrival and Departure signs: https://remotesign.mixmox.com
thanks 1 user liked this useful post by DaleSchultz
Offline madhu.gn.71  
#10 Posted : 04 October 2020 05:10:32(UTC)
madhu.gn.71

India   
Joined: 16/04/2014(UTC)
Posts: 738
Location: Bangalore, India
Hello Dale,
I had seen it on your blog and it looks super cool. Let me read about ESP8266 and Wemos D1 mini. A quick Google search reveals that they can be programmed using Arduino IDE too. If devices on the layout can communicate to each other through WiFi, nothing's like it.
Regards,
Madhu
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

| Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.482 seconds.