Model Boat Mayhem - Forum

Please login or register.

Login with username, password and session length.
Pages: 1 [2] 3 4 5 6 7   Go Down

Author Topic: ARDUINO any one?  (Read 40306 times)

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #25 on: December 19, 2015, 07:31:41 PM »

ballastanksian,

Rotating turret(s) is/are a real easy win which could be switched on/off if you have a spare channel on your radio. I am intrigued by your idea to recreate the controls of a real ship - I would love to know more about your vision...

With regard to millisecond perfect I have been testing an Arduino based radio control setup that has a latency of 5ms compared to "normal" radio control's 20ms.

The setup for the switched version (switched via spare channel on your RC set) would be an Arduino Uno, junction block, servo extension cable male to female, 2 wires and a 4xAA battery block to power Arduino and that's it - oh and your servo of course.

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #26 on: December 19, 2015, 07:49:32 PM »

Brian60,
The challenge - how would you add additional proportional controls to your radio set? If you can do this then you don't need an Arduino as you would simply add them and plug the servo's into RX. If I have misunderstood - apologies...

I have added "controls" before using the "trainer" port and a spare channel as a message channel - that is the Arduino encodes data onto the spare channel which is decoded by a separate Arduino in the boat.

There are many things you could do but you soon run into the "bottleneck"  the physical transmitter hardware and it's limited sticks/buttons/switches. It may be possible using a resistor ladder and switch board to broaden the level of controls. The other thing you bump into really quickly giving any advice of course is that there are so many different RC sets that some solutions may not work on some sets, and also to modify the radio you need to get to the guts inside which many people are uncomfortable with for loads of reasons!

I use a touchscreen based system which is so flexible it's a joy to use! That said it's a bolt on to the traditional radio which still drives/steers the boat. I have thought about investigating Android based products (phones/tablets) as the additional human "control" interface but it's on a long wish list which some day may see the light of day and for me would be another vertical learning curve...

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #27 on: December 19, 2015, 09:22:32 PM »

Another use for stepper motors -

https://www.youtube.com/watch?v=lZOpO4eOb0E - Happy Christmas to all Mayhem users (in case you wondered - it's the vibration of the motors making the sound)

https://www.youtube.com/watch?v=Kh2AWswAMvw

https://www.youtube.com/watch?v=vZe0_dk4czE - spot the Arduino in the middle of the pic

Love it - C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #28 on: December 23, 2015, 03:52:18 PM »

A series of interesting videos about how John Dutton, a modeller from down under has used an Arduino in his great looking model submarine

https://www.youtube.com/watch?v=yluDCgYrJxc

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #29 on: December 23, 2015, 05:49:53 PM »

C-3PO


I've now received my Arduino kit and started playing. I can see how to control a servo with it, but not sure how I read a signal from an RC receiver. Can you point me in the right direction? My initial aim is a servo slower.


Thanks,


Barrie


PS not done much googling yet so maybe there are toms of videos out there {-)
Logged

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #30 on: December 23, 2015, 08:15:49 PM »


PS not done much googling yet so maybe there are toms of videos out there {-)


Should have waited - 2 mins with my friend Google and I have the answer![size=78%]


Barrie[/size]
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #31 on: December 23, 2015, 08:29:12 PM »

Hi barriew - Good on you for giving this a go :)

Try the code below - I haven't tested it so fingers crossed!

Connections to Arduino:
  • Connect the negative RX pin to GND on Arduino
  • Connect the signal RX pin (of the channel you want to read) to pin 9 on Arduino

I am assuming you have downloaded the Arduino IDE - if not we need to back up a little in the process...
Once you have downloaded the sketch code below to the Arduino board, with the board still connected to your computer,  from the IDE to see what the Arduino board is reading we can open the "Monitor" panel - (select "Tools" / "Serial Monitor") - makes sure the baud rate is set to 9600 (bottom right hand side dropdown selection box on the monitor screen we have just opened)  and if it's working you should see the value in microseconds scrolling down the screen!
Change something on your radio control handset and you should see the value change!

Quote
int receiverPin = 9; // connect receiver channel signal to pin 9 on Arduino
unsigned long duration; // create the variable to store the length of our PWM signal in microseconds

void setup()
 {
   pinMode(receiverPin, INPUT); // configure Ardunio pin referred to by our variable "receiverPin" in this case pin 9 to be INPUT
   Serial.begin(9600); // start the serial link so we can view details (print) in the Serial Monitor
 }

 void loop(){

   duration = pulseIn(receiverPin, HIGH); // read PWM signal from the receiver pin we defined earlier (receiverPin) and assign PWM value in microseconds to variable "duration"
   Serial.println(duration); // print duration value to serial monitor

} // end of loop


Let me know how you get on...

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #32 on: December 23, 2015, 09:37:54 PM »

barriew,

A free servo control add-in library for the Arduino IDE which can downloaded from github

Google "VarSpeedServo" - it has many commands but one of them is myservo.write(180, 30, true);  where the first parameter (180) is in degrees (0-180) and the second parameter (30) is speed (0-255)

It can do some really cool things with servos

Reference of commands - https://github.com/netlabtoolkit/VarSpeedServo/blob/master/README.md

Example of usage https://www.youtube.com/watch?v=C5eKIV0_-M8

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #33 on: December 24, 2015, 06:47:23 AM »

Thanks for  the info. I had found that in my Googling, but have not done anything with it yet. I am not sure I actually need a servo slower, but it seemed like a good project to tackle.
To be honest, I'm not sure that I can see a use for the Arduino in the models I build, but I needed something beside building models to occupy me. Well over 50 years I ago I started my IT career with computers which filled large rooms, it seems appropriate to end it with those that fit in a matchbox. O0 {-)


Thanks again for the pointers.


Barrie
Logged

Brian60

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 3,315
  • Location: Hull,UK-but currently residing in Los Martinez, Spain.
Re: ARDUINO any one?
« Reply #34 on: December 24, 2015, 08:37:57 AM »

Ah I see where you are going now.

I misunderstood the concept at the beginning. I thought you were building a replacement TX based around an arduino, rather like another member Tweety77 began to do some years ago (2013?)

What you are actually doing is building an advanced receiver/controller unit?

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #35 on: December 24, 2015, 08:42:23 AM »

Hello Brian60,

Yes and No - The first phase of this is looking at how you could hook up an Arduino in the boat, I have been working on a complete TX/RX one channel full, unlimited number of controls (well almost) RC control system - that's been my 4 year journey! - almost there - watch this space

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

Aussieboatguy

  • Shipmate
  • *
  • Offline Offline
  • Posts: 5
  • Model Boat Mayhem is Great!
  • Location: Australia
Re: ARDUINO any one?
« Reply #36 on: December 24, 2015, 10:42:42 AM »

I found this link to some dutch modelers that have been playing around with Arundio for some time. http://www.leonvanderhorst.nl/workshop_uc.htm 
Logged

tsenecal

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 331
  • Location: Arvada, Colorado, USA
Re: ARDUINO any one?
« Reply #37 on: December 24, 2015, 04:31:20 PM »

my go to site where i learned all i currently know about reading RX signals and moving servos via arduino...


http://rcarduino.blogspot.com/
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #38 on: December 24, 2015, 05:56:32 PM »

tsenecal,

http://rcarduino.blogspot.com/ - a great site for sure with some really good sketch code - I have learnt lots from this site and confess I have extracts from some of his code in several of my applications - he majors on the use of "hardware interrupts" which can be a little daunting for those just starting out if not in concept, then application - even if they are a necessary part of a viable solution.

C-3PO



Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #39 on: December 24, 2015, 07:35:57 PM »

DEAR FATHER CHRISTMAS if you love me at all, please bring me a big red india-rubber ball
Guinness book of World Records
Beano Annual
Brut after shave
Reader's Digest subscription
Millennium Falcon

Instead can I have these:
 
Adafruit 16 channel PWM board - https://learn.adafruit.com/assets/2292

This is a fantastic piece of kit.  Using only two wires from an Arduino, control 16 free-running PWM outputs(could be servos)! Chain up 62 breakout boards to control up to 992 PWM outputs(servos) still on just 2 wires. It's an i2c-controlled (2 wire interface) PWM driver with a built in clock. That means  you do not need to continuously send it a signal tying up your microcontroller, its completely free running!

And here it is running just 16 servos  - https://www.youtube.com/watch?v=ZDfBCLEh5pg

Relay board – switch 30v 10A/ 250v 10A – these boards are available in 2/4/8 relay configurations and are less than £5 and could be switched from those spare channels on your radio via an Arduino attached to your receiver

https://www.youtube.com/watch?v=tuOrH9sSykk

NeoPixel – you can chain these together, they are individually addressable RGB LEDS, you only need 2 wires (signal and ground) to communicate with each LED. So you could  control (on/off & colour) of each LED individually in your boat. To get an idea what they can do check out this example https://www.youtube.com/watch?v=lvONX2qOfss  Note: This example only uses red/white/blue instructions but it could be in full Technicolor with the same kit.

Xbee – this is one of many cheap radio transceivers (transmitter and receiver in one) you can use directly with an Arduino  https://www.youtube.com/watch?v=vKVNmA8C6m8

Rock Block – and finally this, it’s nothing to do with Arduino or boats but what an amazing device – send a message from anywhere on earth so long as you can see the sky – all for a subscription from £8 month (beam me up Scotty)!

https://www.youtube.com/watch?v=NOJ_VtSikAA

And finally, finally if you get bored or need to escape the relatives over the festive break,  watch this great video series by John Dutton and his experience with Arduino's https://www.youtube.com/watch?v=yluDCgYrJxc

Happy Christmas

C-3PO

Possible Arduino model boating applications: (please add your own to this list)

  • LED switching
  • LED Flashing/strobing
  • LED Dimming
  • Gun Flasher
  • Lighting effects - Fluorescent, Xenon etc. switch on/off effect
  • Control individually addressable RGB LEDS
  • RC Mixer
  • Arduino based full RC system
  • Ultrasonic - collision avoidance
  • Stepper motor control - precise control over movement - open payload doors, move a boom, raise antennas
  • Servo - movement sequence of 1 or more servos e.g. gun turret, gun recoil, Missile tracker - control of 2 servos working together
  • Servo travel expander
  • Servo travel slower
  • Anchor chain movement via servo or stepper motor
  • RC switch - e.g. using gear channel on radio
  • Engine sound generator
  • Wav sound file player
  • GPS - data can be read by Arduino - not sure what you would do with it without a complex program
  • GPS - waypoint navigation
  • GPS - mapping/surveying depth of an area of water, record top SD card and map on Google Maps
  • Telemetry - transmit sensor telemetry back to shore - speed, current draw, GPS location, depth, temperature, voltage monitoring - if you can monitor it you can send it!
  • Data logger - write telemetry/sensor data to SD card for onshore analysis
  • Light sensor
  • Gyros ?
  • Ballast auto leveller - automatically correct boat listing
  • Temperature sensor - auto shutdown/alarm(?)
  • Voltage sensor - auto shutdown/alarm(?)
  • Bilge pump - automatic sensor triggered
  • Control smoke generator to either Puff or increase/decrease smoke relative to speed of vessel
  • Compass - hold course
  • Pressure gauge - submarine application

Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

tsenecal

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 331
  • Location: Arvada, Colorado, USA
Re: ARDUINO any one?
« Reply #40 on: December 24, 2015, 07:53:38 PM »

i actually have that very same 16 servo adafruit servo driver  :D

i bought it thinking i will use it and an arduino to replace 2 of the robbe/futaba multi-prop decoders.

https://www.youtube.com/watch?v=fjkPrAtPhUw


if you don't need to control 16 servos, here is one that will work with 8 servos:
https://www.pololu.com/product/207

as we speak, i am also posting to a thread on http://subpirates.com/  on building a FrSky compatible hub for my model submarine. http://www.subpirates.com/showthread.php?5271-Custom-Frsky-Telemetry-Hub


it will primarily be built using one of these:

http://www.ebay.com/itm/New-design-20A-range-Current-Sensor-Module-ACS712-Module-Arduino-module-ACS712T-/181026550196?hash=item2a2605f1b4:g:XqAAAOSw7ThUo8C8

and two of these:

https://alofthobbies.com/frsky-temperature-sensor-tems-01.html

and a few other "bits and bobs" as you easterners like to say
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #41 on: December 24, 2015, 09:09:06 PM »

Arghh

Apologies I posted the wrong video link

NeoPixel – you can chain these together, they are individually addressable RGB LEDS, you only need 2 wires (signal and ground) to communicate with each LED. So you could  control (on/off & colour) of each LED individually in your boat. To get an idea what they can do check out this example https://www.youtube.com/watch?v=lvONX2qOfss  Note: This example only uses red/white/blue instructions but it could be in full Technicolor with the same kit.

Correct link
https://www.youtube.com/watch?v=DMEVmuxoJJk

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

Tug-Kenny

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 7,680
  • Location: Newport. S Wales
Re: ARDUINO any one?
« Reply #42 on: December 25, 2015, 10:44:59 AM »


Thank you for showing us all the features and practicality of these devices.

It's all very interesting and bound to be of use to the rest of the members. I may have a go myself.

Cheers

ken
 
Logged
Despite the high cost of living   .......... It remains popular

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #43 on: December 27, 2015, 09:30:06 AM »

Here is my code for reading the output from a receiver and passing it to a servo. Not very useful as it stands, but it is possible to process the incoming signal before passing it to the servo, restricting the servo range, or slowing the action.
I have currently tested this with a servo tester rather than Tx and Rx. I have used the standard Servo code, not the one which allows you to determine the speed of the action.
My next project will be to try to  emulate the manual system I have for lowering the ramp in two stages on my Calmac Ferry like thishttp://vid1371.photobucket.com/albums/ag293/barrienw/VID_20150918_152321874_zpsimsw54ce.mp4

Barrie


//Read Rx output, send to servo;

#include <Servo.h>
Servo myservo;                                        //Create servo object;
int receiverPin = 9;                                  //Asign input pin;
unsigned long duration;                               //to store pulse duration;


void setup() {
pinMode(receiverPin,INPUT);
Serial.begin(9600);
myservo.attach(6);                                    //Assign output pin;
}

void loop() {                                         // put your main code here, to run repeatedly:
  duration = pulseIn(receiverPin, HIGH);              //Get Duration;
  Serial.println(duration);                           //Echo to Monitor;
  duration = map(duration, 1000, 2000, 0, 180);       //Convert to Dgrees;
  Serial.println(duration);                           // Echo to Degrees
  myservo.write(duration);
  delay(15);
}
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #44 on: December 27, 2015, 09:43:14 AM »

barriew,
Looking good so far, do you have any spare channels on your radio that you could use to trigger the up/down process?
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #45 on: December 27, 2015, 10:11:27 AM »

Yes - but I'm not sure its worth actually building this. The current set up - non-centered channel on Tx, ACTion servo slower, and heavy duty servo - works well enough. But it will be a good exercise for the Arduino to get more experience.
I am moving on to a 'range finder' next to help me get my car into my garage  {-)  That is a project that could get transferred to a Nano or Mini and become permanent. I will return to the servo later after exploring more of the bits that came in the package.
Have you found a good Arduino book? Most of the ones I have seen are simply rehashes of the Tutorials on the Arduino web site, and very expensive. I have bought the Make:Getting Started as hard copy, and one other on Kindle and some came as PDFs in the package, but I'm not impressed :((  I don't like reading reference works on a screen.


Barrie
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 828
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine
Re: ARDUINO any one?
« Reply #46 on: December 27, 2015, 10:41:40 AM »

Barriew,

The only observation I could make re the ramp would be that if you let the Arduino control the servo completely e.g. via a switch on/off (lower/raise) you could
have a "soft" start and "finish" by reducing the servo speed at each end of travel - but you are right it works just fine as is.

Re books that's a difficult one as there is so much out there, loads that just skim the surface and are so "light" in content and others that go into the most intricate details of a microprocessor.

How about YouTube video - this is a good resource https://www.youtube.com/watch?v=09zfRaLEasY but I think you will want to skim through them due to your previous experience.

I have several books and not one of them are "great".  I find gthat you dip in and out and some you just wish you hadn't purchased. Perhapos research these-

30 Arduino Projects for the Evil Genius. However I would check the content before buying to see if anything appeals. I guess it depends if you want a resource that explains the command set or a book of practical examples.

Arduino Cookbook - Recipes to Begin, Expand, and Enhance Your Projects By Michael Margolis

I think you may find this guy interesting (again especially with your previous experience) although it's screen based which may not suit it does make for a good read!  as he covers some good stuff, e.g.  (How to do multiple things at once ... like cook bacon and eggs) - why you should never use the delay(x) command! - although we all do.

http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

Re the range sensor stuff I think I got 6 sensors for about £5 many moons ago - you may want to google Arduino Radar!

C-3PO



Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #47 on: December 27, 2015, 01:00:48 PM »

Thanks C-3PO - it turns out I have those books as PDFs. I will follow up on the videos.

I am using an HC-SR04 ultrasonic sensor which cost me less than £2 posted - these add-ons are ridiculously cheap, whether they come from the UK or China, except from Maplin. Just saw some of their "sale" prices this morning. {-) {-) {-)  They ought to be  :embarrassed: :embarrassed: :embarrassed:

Barrie
Logged

richald

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,943
  • Retired and loving it!
  • Location: Driffield, East Yorks.
Re: ARDUINO any one?
« Reply #48 on: December 27, 2015, 01:49:46 PM »

Interesting little manual to get you started . . .

http://cdn.sparkfun.com/datasheets/Kits/SFE03-0012-SIK.Guide-300dpi-01.pdf

Intro to arduino and 14 projects clearly described.

Richard
Logged
Senior member of the OGG (Order of the Grumpy Gits)
Membership Number : 002

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,009
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #49 on: December 27, 2015, 07:45:51 PM »

Thanks - nothing really new, but its very clearly laid out.


Barrie
Logged
Pages: 1 [2] 3 4 5 6 7   Go Up