Model Boat Mayhem

Technical, Techniques, Hints, and Tips => Microprocessor control => Topic started by: C-3PO on December 15, 2015, 11:01:43 am

Title: ARDUINO any one?
Post by: C-3PO on December 15, 2015, 11:01:43 am
Hello,

I am interested to explore the uses and applications of an Arduino microprocessor board in the world of radio control model boating.  So if you have used one it would be great if you could share a short summary of what you accomplished.

If you have not come across an Arduino before it is a simple and cheap way to access microprocessor controlled applications. The Arduino can read the "PWM" signals from your radio control receiver, apply some logic to them (e.g. if this then do that) and then communicate the result of the logic with the outside world in the form of a digital or analogue signal as a result. A few things you can  control LEDS (off, on/brightness), servos, relays

The program ("Sketch") code is very easy to learn and you can achieve solutions often with just a few lines of code. There are thousands of hobbyists using the Arduino and many help forums on the internet so you can always get help when you get stuck. You can download lots of sketch’s from the internet and the software used to load the sketch to the board via USB comes with lots of examples.

Here is a snapshot of some code to make an LED blink connected directly to the board -  Turns on an LED on for one second, then off for one second, repeatedly

Quote
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

An example of a simple application would be: Controlling an LED on/off using a 2 state(on/off) channel on your radio (Gear etc)

If you want to know more then check out these links or just Google Arduino

What is an Arduino - https://www.arduino.cc/en/Guide/Introduction

Tutorial series - https://www.youtube.com/watch?v=09zfRaLEasY

There are other routes to accessing microprocessors e.g. Pic/Raspberry PI but here I would like to focus just on the Arduino.

C-3PO
Title: Re: ARDUINO any one?
Post by: richald on December 15, 2015, 11:15:53 am
C-3PO 

I have a lot of arduino bits, boards and sensors  - I've played around with various bits of code.
I like the Arduino - as a retired software engineer who used to code in C   - the programming is
generally very easy and the boards are cheap!

With regard to uses - when I have cleared a bit of the backlog of boat building, the first idea
I want to explore is using an ultrasonic distance sensor to measure 'clear air' in front of the boat
and if a collision is imminent modify the signal between the radio receiver and the ESC to slow
and if necessary stop the boat - - I have some working code but the setup for testing needed
a bit of thought and I wasn't 100% happy with the way the signal from the receiver was being read.

Richard
 
Title: Re: ARDUINO any one?
Post by: C-3PO on December 15, 2015, 11:27:23 am
Thanks Richard,

This is the underlying concept of what Richard is talking about (connected to the ESC to allow throttle control)

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

C-3PO
Title: Re: ARDUINO any one?
Post by: dreadnought72 on December 15, 2015, 12:30:41 pm
I'm a big fan of the Arduino - I'm currently testing a variety of circuits using stepper motors and rate/heading solid-state gyros controlled by WPM signals from a receiver. More on this later.


What I may well have to write up is my thoughts on Arduino-driven mixers, since there's a lot of questions about mixing channels on the forum and the Arduino is a cheap, easy-entry system into the world of achieving Exactly What You Need.


Andy
Title: Re: ARDUINO any one?
Post by: C-3PO on December 15, 2015, 01:17:23 pm
Andy - sounds very interesting.

You mentioned
Quote
Arduino is a cheap, easy-entry system into the world of achieving Exactly What You Need.

For those that don't know there are several different models of Arduino - a good place to start is the Arduino Uno - it's roughly the size of a credit card.

The Arduino Uno genuine version is about £18, the cloned version less than £5 delivered (eBay) (you need to be careful which clone as some have challenges with the USB chip and can be a real pain) - Similar concept to original manufacturer RX or Orange RX.

Software (IDE) Integrated Development Environment - Free download.

I have used the Arduino clones many times without any issues so you could be experimenting with an Arduino for less than a £5 investment!

C-3PO
Title: Re: ARDUINO any one?
Post by: C-3PO on December 15, 2015, 02:49:59 pm
Want to make a servo sweep from side to side. Servo needs to be powered by an external power source (battery)

2 electrical connections to Arduino -

Sketch code below (text after "//" double lines is text notation to help understand the code and is not executed as part of the sketch(program)
Quote
#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int pos = 0;    // variable to store the servo position

void setup() {
   myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
   for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees in steps of 1 degree
     myservo.write(pos);          // tell servo to go to position in variable 'pos'
     delay(15);                       // waits 15ms for the servo to reach the position
   }
   for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
     myservo.write(pos);              // tell servo to go to position in variable 'pos'
     delay(15);                       // waits 15ms for the servo to reach the position
   }
}
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on December 15, 2015, 06:34:37 pm
Interesting,


You can even have a play for free without having to buy an arduino
https://123d.circuits.io/lab
Title: Re: ARDUINO any one?
Post by: richald on December 15, 2015, 06:39:37 pm
Something else I have just found - online Arduino compile/downlad/test

https://codebender.cc/ (https://codebender.cc/)

https://codebender.cc/libraries (https://codebender.cc/libraries)

can't comment beyond that from my brief inspection, seems fairly competent.

Richard
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on December 15, 2015, 06:42:46 pm
Just played on the link I posted in my last post and it did exactly what it should do


I'm ordering one.....
Merry xmas to me :)
Title: Re: ARDUINO any one?
Post by: C-3PO on December 15, 2015, 07:50:52 pm
essex2visuvesi - Simulator love it!
Quote
https://123d.circuits.io/lab

C-3PO
Title: Re: ARDUINO any one?
Post by: ballastanksian on December 15, 2015, 08:43:04 pm
I like the concept and will one day give it a go but I have to fully get my wooden head around my battery charger and straight prop shafts first:O)

Title: Re: ARDUINO any one?
Post by: essex2visuvesi on December 15, 2015, 10:40:45 pm
essex2visuvesi - Simulator love it!
C-3PO


Took me less than 5 mins to put together a simulation of your code... and it worked


Just ordered this set as a Christmas pressie to me
http://www.banggood.com/UNO-R3-Starter-Kit-LCD1602-Servo-Buzzer-For-Arduino-p-1008835.html
Title: Re: ARDUINO any one?
Post by: dreadnought72 on December 16, 2015, 12:37:11 am
The very basics: the Arduinos (and other microprocessors) are nothing but small, cheap, miniature computers. They have a clock, memory and processor. Using code, they can repeatedly, endlessly and faultlessly, read inputs and effect outputs.


Inputs for us are going to be transmitter signals and any type of on-board sensor. Light? Ultrasonic? GPS? Gyro? It doesn't matter - all manner of sensors are available, and they are all remarkably cheap and available. Outputs will tend to be lights, audio and - most usefully - commands that can control servos and ESCs.



Code is not difficult: you can think of it as nothing more than instructions, like a recipe, a knitting pattern or a part of a Haynes Manual. 'Do this if that', 'If done, now do the other'. Programs written in code (typically written on a PC) can be downloaded to the Arduino, tested, stored and initiated when the Arduino is powered up. Code has to be written in a specific manner to be actioned properly in order to avoid misinterpretation. Follow the rules governing the syntax (a posh word for the components of the language of the code) and you won't go far wrong.


So how do you start?


The best approach is to simply sketch a plan for what you want to achieve.


I'll be kicking off a 'how to write a mixer' thread over the next couple of days. Plenty of diagrams and examples will follow.


Using microprocessors is not rocket science (and neither is, it has to be said, rocket science!) and we should be open to embracing the opportunities this new technology is opening for us.


Andy

Title: Re: ARDUINO any one?
Post by: C-3PO on December 16, 2015, 07:35:29 am
Andy,

Great descriptions.. I look forward to your Arduino Mixer accomplishments.

For those that are interested in this area of the hobby it would be great to adopt a supportive approach to sketch code. Normally with code there are many ways to achieve the same thing and as we all comes from different backgrounds with different levels of understanding, collectively we are brilliant!.  So I for one look forward to broadening my understanding in this area from both code and applications of microprocessors in our hobby.

So how does this all apply to the model boating fraternity?

Most of us have multi channel radio control sets and only use 2 channels, so wouldn't it be neat to add some additional functions to your model on those extra channels?

Why do I like Arduino's - it's the mental challenge of working at a solution for something I want to achieve - it keeps my grey matter on it's toes - some of my Arduino projects are still on going after 4 years so be patient don't expect instant results.

C-3PO
Title: Re: ARDUINO any one?
Post by: C-3PO on December 16, 2015, 08:03:05 am
What type of board NOT TO BUY from eBay

There are lots of cloned Arduino boards on eBay. I am not an expert but this is my understanding (please anyone correct me if I have this wrong). I would recommend buying a real Arduino board first time out - many suppliers on the internet:

https://proto-pic.co.uk/genuino-uno-rev-3
http://www.amazon.co.uk/Arduino-A000066-ATMEGA328-Microcontroller-Board/dp/B008GRTSV6/ref=sr_1_3?ie=UTF8&qid=1450252867&sr=8-3&keywords=arduino+uno
http://www.mouser.co.uk/ProductDetail/Arduinoorg/A000066/?qs=sGAEpiMZZMtE4ePzUE8d2JuFIVM5Ac0l
https://www.coolcomponents.co.uk/arduino-uno-revision-3.html

Some cloned boards have a weird communication chip which means you have to obtain a USB PC driver from a Chinese site(not a word of English!) - something I do not recommend.

My experience is that the boards with a small chip should be avoided -see images below.
C-3PO
Title: Re: ARDUINO any one?
Post by: Brian60 on December 16, 2015, 06:51:32 pm
Oooh this topic is so Deja Vu all over again {-) (you have to have seen the movie)

I raised this exact topic just a year ago....

http://www.modelboatmayhem.co.uk/forum/index.php/topic,49659.msg513084.html#msg513084 (http://www.modelboatmayhem.co.uk/forum/index.php/topic,49659.msg513084.html#msg513084)


And before anyone asks, no I haven't done anything further yet, I have been doing so much other stuff I've not had time to spend with it. I can't believe where time goes to even though I no longer work!

I now have 3 pieces of electronic board to get to grips with, arduino, picaxe and the latest addition a DLM.

What's one of those I hear you all ask --- well go on then, ask! All will be revealed hopefully over the weekend when it is connected and I can photo/video the setup/
Title: Re: ARDUINO any one?
Post by: C-3PO on December 16, 2015, 07:30:44 pm
DLM - what's one of those? :)

Sounds like it's a mate of my mate R2D2?

C-3P0

Title: Re: ARDUINO any one?
Post by: ballastanksian on December 16, 2015, 10:57:19 pm
I recall that a fellow Mayhemer was going to build a transmitter using Aduino components some time back; Possibly any one of you chaps who are describing the workings of the system to us. I have seen the range of parts and accesories available in Maplins and cannot see a radio transmitter compnenent. They do a cute little joystick.

Title: Re: ARDUINO any one?
Post by: C-3PO on December 16, 2015, 11:27:03 pm
Hi ballastanksian,


There are several routes you could go down to create an Arduino radio control transmitter. Is this something you would like to achieve?
I am in the final testing of a "proof of concept" one channel radio control system that has unlimited( well almost) "channels of control" that is it has no limitations like the traditional radio control systems we use.


C-3PO
Title: Re: ARDUINO any one?
Post by: C-3PO on December 19, 2015, 10:11:07 am
The list of model boat Arduino applications I have so far


These are just a few ideas that have been suggested. Some of these would need readily available, mostly very cheap additional hardware.

All suggestions welcome - I will add them to the list - those additional channels on your radio want to be used!

C-3PO
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on December 19, 2015, 03:35:28 pm

  • Stepper motor control
  • Servo - movement sequence of 1 or more servos e.g gun turret, gun recoil, Missile tracker - control of 2 servos working together


This is the main reason for getting mine
Title: Re: ARDUINO any one?
Post by: Brian60 on December 19, 2015, 04:50:08 pm
Multiple proportional control? ie most tx's have 2 joysticks, what about a facility for 4? I understand that some drone copters use 4 joysticks albeit they seem to be being replaced by tilt/tip/yaw controls via holding one of the many tablet style computers.

Failing joystick what about say 4 or more potentiometer type controls so you could set a turret or some other option, to some point via stepper motor and leave it there, until the pot is moved again?
Title: Re: ARDUINO any one?
Post by: ballastanksian on December 19, 2015, 06:51:14 pm
Hi C3PO, I have considerd the idea especially to recreate the controls of a real ship, ie engine telegraph and a steering wheel along with some switches for turrets, but I must coincentrate first on work, and then on getting my Destroyer and three tugs sailing before I can begin my big project that would appreciate rotating turrets.

Nothing I plan to sail will ever sit on its stern and throw up an impressive wave, so it does not need millisecond perfect control :-)
Title: Re: ARDUINO any one?
Post by: Netleyned on December 19, 2015, 06:59:40 pm


Nothing I plan to sail will ever sit on its stern and throw up an impressive wave, so it does not need millisecond perfect control :-)


Not building a Springer then %)


Ned
Title: Re: ARDUINO any one?
Post by: ballastanksian on December 19, 2015, 07:01:54 pm
Cheeky! One day I will, just not at the moment :-)
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: barriew 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 {-)
Title: Re: ARDUINO any one?
Post by: barriew 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]
Title: Re: ARDUINO any one?
Post by: C-3PO 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:

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
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: barriew 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
Title: Re: ARDUINO any one?
Post by: Brian60 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?
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: Aussieboatguy 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 (http://www.leonvanderhorst.nl/workshop_uc.htm) 
Title: Re: ARDUINO any one?
Post by: tsenecal 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/
Title: Re: ARDUINO any one?
Post by: C-3PO 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



Title: Re: ARDUINO any one?
Post by: C-3PO 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)


Title: Re: ARDUINO any one?
Post by: tsenecal 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 (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/ (http://subpirates.com/)  on building a FrSky compatible hub for my model submarine. http://www.subpirates.com/showthread.php?5271-Custom-Frsky-Telemetry-Hu (http://www.subpirates.com/showthread.php?5271-Custom-Frsky-Telemetry-Hub)b


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 (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 (https://alofthobbies.com/frsky-temperature-sensor-tems-01.html)

and a few other "bits and bobs" as you easterners like to say
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: Tug-Kenny RIP 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
 
Title: Re: ARDUINO any one?
Post by: barriew 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 (http://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);
}
Title: Re: ARDUINO any one?
Post by: C-3PO 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
Title: Re: ARDUINO any one?
Post by: barriew 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
Title: Re: ARDUINO any one?
Post by: C-3PO 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



Title: Re: ARDUINO any one?
Post by: barriew 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
Title: Re: ARDUINO any one?
Post by: richald 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 (http://cdn.sparkfun.com/datasheets/Kits/SFE03-0012-SIK.Guide-300dpi-01.pdf)

Intro to arduino and 14 projects clearly described.

Richard
Title: Re: ARDUINO any one?
Post by: barriew on December 27, 2015, 07:45:51 pm
Thanks - nothing really new, but its very clearly laid out.


Barrie
Title: Re: ARDUINO any one?
Post by: Tug-Kenny RIP on December 28, 2015, 10:39:22 am

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



Thank you for that.  All very interesting.     :-))

ken
Title: Re: ARDUINO any one?
Post by: C-3PO on December 28, 2015, 10:51:19 am
This is a great sets of Videos by the "genius" Jeremy Blum (1.4 Million views)

Not RC specific but really stunning background info

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

C-3PO
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on December 31, 2015, 03:41:04 pm
Mine arrived yesterday and I had a little play


The servo swinger code worked perfectly.


A bit of research shows how to create a radar system, so my next project is to make a tracking turret.  :-))

Title: Re: ARDUINO any one?
Post by: ballastanksian on January 01, 2016, 12:29:50 pm
That would save having lots of channels. You could even slave the turrets to a director! Imagine having miniature model Phalanxes tracking passers by!

What are the laws regarding radar transmission? Are there any??
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on January 01, 2016, 01:52:21 pm
That would save having lots of channels. You could even slave the turrets to a director! Imagine having miniature model Phalanxes tracking passers by!

What are the laws regarding radar transmission? Are there any??


This one is not real radar but looks cool and could be used to track and object
https://www.youtube.com/watch?v=kQRYIH2HwfY
Title: Re: ARDUINO any one?
Post by: C-3PO on January 01, 2016, 02:04:22 pm
Why not go the whole way - this is a pretty cool extension of the concept

https://www.youtube.com/watch?v=0YFD6SyEma4#t=66

The Ultrasonic sensor's are less than £2 delivered

C-3PO

Title: Re: ARDUINO any one?
Post by: richald on January 01, 2016, 07:13:15 pm
essex2visuvesi
have a look at the SRF01 Rangefinder - does the same job as the commonly used HCSR04 but much more compact.
(range 0 to 6metres - I think!)

http://www.robotshop.com/uk/devantech-srf01-ultrasonic-range-finder.html?gclid=CJCrxLHUiMoCFSEcwwodY6YLfQ (http://www.robotshop.com/uk/devantech-srf01-ultrasonic-range-finder.html?gclid=CJCrxLHUiMoCFSEcwwodY6YLfQ)

https://www.dfrobot.com/wiki/index.php?title=SRF01_Ultrasonic_sensor_(SKU:SEN0004) (https://www.dfrobot.com/wiki/index.php?title=SRF01_Ultrasonic_sensor_(SKU:SEN0004))

http://www.robot-electronics.co.uk/htm/srf01tech.htm (http://www.robot-electronics.co.uk/htm/srf01tech.htm)
Some sample code for the Arduino www.robot-electronics.co.uk/files/arduino_srf01.ino (http://www.modelboatmayhem.co.uk/forum/www.robot-electronics.co.uk/files/arduino_srf01.ino)
Info nicked from the robot-electronics.co.uk website

SRF01 Rangefinder
The SRF01 uses a single pin for both serial input and output. By using a software serial port, we can make the Arduino do serial
input and output on a single pin as well. You can have up to 16 SRF01's connected to a single pin on the Arduino.
The Range is displayed on an LCD03 module.

(http://www.robot-electronics.co.uk/images/arduino_srf01.png)
Richard
Title: Re: ARDUINO any one?
Post by: barriew on January 01, 2016, 07:18:51 pm
Ramp Door operator
I have now finished the code to operate the ramp on my Calmac Ferry. At the moment it uses the non-centring channel so that I can stop the ramp before the ferry arrives at the slipway, and then complete the movement to drop the flap when the ramp is grounded. The servo is driven through an Action Servo Morph.
My new code will automatically lower the ramp only just by moving the control off the endpoint. Further movement will drop the flap. The code also slows the movement.
The development was done using a Servo Tester and a random value for the midway stop, so the next step is to hook up to the receiver and servo to find the actual point (in degrees) and also work out the correct speed. I may also have to restrict the travel.  Once that is done I will make up a system with a Nano.
I had lots of problems getting this to work, mainly understanding the operation of  "If...else".  I found that quite a lot of the literature on Arduino.cc has not been updated for the latest version of Arduino IDE. There are some very conflicting examples around. It wasn't helped either by finding that my servo tester would randomly output rubbish.
The next project is a servo tester. I know I can buy one for  a couple of pounds, but that is the price of a Nano. :} There are plenty of examples of code to move a servo by potentiometer or do a sweep. I want to try and combine them.
Barrie


The Ramp code is available should anyone be interested.
Title: Re: ARDUINO any one?
Post by: C-3PO on January 02, 2016, 09:19:10 am
barriew,

It sounds like you are refining your ramp door solution...

A servo tester would be a great use for an Arduino - one quirk with the Arduino code you should be aware of depending which commands you decide to use (degrees vs. microseconds) many people have lost hours with this one!, is do not use option 1 below when you declare a servo if you want it to be 100% accurate. You need to use the 2nd command which declares the pin number and the minimum and maximum pulse width parameters in microseconds.
e.g. servo3.attach(5, 1000, 2000);


See this article - it explains it all  http://makezine.com/2014/04/23/arduinos-servo-library-angles-microseconds-and-optional-command-parameters/

C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on January 02, 2016, 09:56:32 am

C-3PO

So far I have converted the pulse to degrees and it seems to work OK, although as I say I have to find out what a real receiver is putting out, and also work out the half way stop point. That means taking the laptop and Arduino into the workshop, where I have just started building a new boat. I will check out the article - all relevant info greatly appreciated. There is so much out there its sometimes difficult to find the bit you want. O0
My idea for the servo tester is for a three function device - test using a pot., sweep to exercise a servo or ESC, and display of some kind to monitor the output from a Tx/Rx combo, particularly the mid-point. I have an ACTION R/C Master which sort of does those things, but it isn't very reliable.
I have ordered one Nano so far, if this works out I will order another. I think I managed to blow up my range finder so am waiting for another to come so I can progress my parking aid. I looked at the one Richald suggested but its a bit expensive compared to the HC-SR04, although it could be useful for a collision avoidance system as it would be easier to conceal.


Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on January 02, 2016, 10:12:07 am
barriew,

When you read the RX signal it might be easier to use microseconds as the unit. Mid point will be 1500us.

Code below should read signal from your RX and output value in microseconds in Serial Monitor

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

 // >>>>> Start of setup configuration
 void setup()
 {
   
   pinMode(receiverPin, INPUT); // configure Ardunio pin to be INPUT
   Serial.begin(9600); // start the serial link so we can view details (print) in the Serial Monitor
 }
// <<<<< End of setup configuration

  void loop(){
  duration = pulseIn(receiverPin, HIGH); // read PWM signal from the receiver pin and assign PWM value in microseconds to variable "duration"
  Serial.println(duration); // print duration value to serial monitor   
           
 } // end of loop

C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on January 02, 2016, 12:51:08 pm
C-3PO


Further to my PM, I have now read the article. I will be taking note - when I find the limits of the setup ;)


Barrie
Title: Re: ARDUINO any one?
Post by: richald on January 14, 2016, 12:52:55 pm
Interesting Arduino Link - Lists 25 Arduino Shields
(basically a shield is an Arduino dedicated I/O card)


http://randomnerdtutorials.com/25-arduino-shields/

Richard
Title: Re: ARDUINO any one?
Post by: johnredearth on February 02, 2016, 12:16:20 pm
Hi all

Love this topic about uses for Arduino.  I am starting a new build which has arduino at its core.  This vid (links) not finished yet but you get the drift.  I have the sketch on my website for my uboat.  This video describes what an arduino does without talking about arduino much.

https://youtu.be/pZ_MRMHgFDo

Here is another one.  Having auto control to keep to a compass bearing

https://youtu.be/l0VmTwCunBM
Title: Re: ARDUINO any one?
Post by: richald on February 02, 2016, 01:38:28 pm
John,

I am very interested in your compass guided tug Scuffy.

I have followed the link mentioned in your video to the resources section
but when I download the .rar file from "Scuffy sketch / code:  scuffy (http://scratchbuildwithjohn.com/wp-content/uploads/2015/10/scuffy.rar)" I only get the circuit diagram
the circuit diagram is (correctly) available under the "Scuffy circuit diagram  scuffy diagram (http://scratchbuildwithjohn.com/wp-content/uploads/2015/10/scuffy-diagram.rar)" link.

Is it possible to fix the sketch code link please ?

Richard

Title: Re: ARDUINO any one?
Post by: johnredearth on February 02, 2016, 10:22:14 pm
Hi there

Yes there was a mistake on my page.  Thanks for noting it and the 'scuffy' code is there.

I started a discussion btis on the Model Boats magazine and got a bit of mauling from some.  Fun to read though.

http://www.modelboats.co.uk/forums/postings.asp?th=112583

Cheers

Title: Re: ARDUINO any one?
Post by: johnredearth on February 02, 2016, 10:32:34 pm
 On this great theme:
I want to add to my sub code some stuff which will allow me to raise the bow planes on a sub.
My thought thus far are to have two servos, one for the plane as per normal and the other to raise and lock it into the side.
To use a channel to trigger the movement or routine which will then:
  When the trigger channel makes the appropriate signal:
  The idea of turning off the power is about saving current and also fixing the relative positions with NO juddering. 
I currently use that in my submarine anyway as I found the hydro servo, which runs through the Arduino judders during boot up.  So I have a relay to keep the power off the servo and the first thing the Arduino does is turn on the power to the servo
So, I am about to start to write the code and if anyone wants to help, you are very welcome!
 
Title: Re: ARDUINO any one?
Post by: C-3PO on February 02, 2016, 10:39:56 pm
Hello John,

You have some great ideas and achievements with Arduino and RC boats/subs and I am a fan from having watched your YouTube vids :)

Do you get your emails from your scratch build site email address?

I would love to compare notes etc..

I don't think you can PM on Mayhem until you have 5 or may be more posts - could be wrong

Regards
C-3PO
Title: Re: ARDUINO any one?
Post by: johnredearth on February 03, 2016, 03:27:10 am
HI

Yes use my website contact.  I am still getting things together.  I have been into arduino now for a year I guess.  Started writing code for the sub back then and got into all sorts of trouble. The only place to go was the arduino forum where I was treated a bit like the village idiot.  I really mean that!  It would have been nice to compare notes with someone who is at the same stage of un-certainty.  I guess the issue is that it is cheap, not hard and very satisfying.   It's a bit like electronic scratch building.  I have taken bits of code from all over the place to make the scripts work.  Sometimes I find I am cutting and pasting the order of events in scripts just waiting for the time it all works.  I am really that bad!

Cheers
Title: Re: ARDUINO any one?
Post by: Brian60 on February 03, 2016, 04:38:56 am
Just read the first couple of pages from the other site John. Seems nothing changes over there, a lot of the membership are blind to advances in technology, and as was pointed out to you, some consider soldering black magic. Just like the magazine of the same name seems to have devolved over the last few years ( been dumbed down) now caters for 10 year olds entering the model scene with no real attempt to cater to the more advanced modeller.

I know I'll get flack for that statement especially from the one or two main contributors that also frequent this forum, but even the most blinkered can see that the same few people use it as a 'closed shop' good luck to them. I prefer even at my age, to encompass anything that I can learn from or become more informed.
Title: Re: ARDUINO any one?
Post by: g6swj on February 03, 2016, 06:45:41 am
Hello John,

Are you able to PM me an email address so I can email you?

Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: barriew on February 03, 2016, 06:56:22 am
  The idea of turning off the power is about saving current and also fixing the relative positions with NO juddering. 
I currently use that in my submarine anyway as I found the hydro servo, which runs through the Arduino judders during boot up.  So I have a relay to keep the power off the servo and the first thing the Arduino does is turn on the power to the servo
So, I am about to start to write the code and if anyone wants to help, you are very welcome!
Hi John

Thanks for that idea :-))  I have a problem with my Arduino routine controlling the ramp on my ferry. As soon as power is applied, the ramp drops to its full extent, and then returns home at full speed. I was trying to think of a way of stopping the servo moving until the Rx and Arduino had fully booted. Seems like I need to incorporate a relay somehow ok2
As for cutting and pasting code on a trial and error basis, isn't that how all programmes are written %% %% {-) {-)


Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on February 03, 2016, 08:41:32 am
Barrie,

If you take the Arduino out of the equation does the servo still move on power-on? Do you use a separate power supply for the Arduino and servo? - if not worth a try.

Try using a pull-up or pull-down on the signal line to your servo. 10k is ok, the resistor eliminates the initial jerk.

Let me know if that works.

Without seeing the code I'm working in the dark - however to track down what's causing the movement try adding a delay at the beginning of the loop for example delay(2000); which is overkill and for debug purposes only but it would be interesting to see if this has an effect on the power-up movement.

My brain isn't engaged yet so I'll reflect on this to see if I can think of other obvious things.

Let us know the outcome as I am sure we can all learn from this.

C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on February 03, 2016, 08:53:53 am
Hi C-3PO


Yes - I it used to move before the Arduino. Spektrum Rxs can take several seconds to recognise the Tx and output a signal, which I believe is the cause of the problem. I did try a Delay at the beginning of the loop - it might be still there - but it has no effect. The servo is powered from the Rx at the moment, but I have some small relays which I can use for experiment. Powering direct from the battery via a relay should fix it.


Thanks for your interest - its not a big deal, but would be better if it didn't do it.


I hope to finally complete my servo tester today - the electronics have been ready for a while waiting for a suitable case which I started yesterday and should finish today.


Barrie
Title: Re: ARDUINO any one?
Post by: g6swj on February 03, 2016, 09:00:18 am
Hello Barrie,

Servo tester sounds interesting.

Re your servo I can understand an initial movement on power up that brings the servo in line with the PWM signal the Arduino is supplying as it first boots. So if at position of the servo is say at 90 degree and when the Arduino  powers on it is outputting 180 degree PWM signal you would expect to see movement but this would only be in one direction. If the servo goes both ways on power up something else is happening.

Regards
Jonathan

Title: Re: ARDUINO any one?
Post by: barriew on February 03, 2016, 09:11:58 am
Jonathan and C-3PO


Let me do some experiments with and without the Arduino - if I can. Before the Arduino I had a Servomorph in circuit to slow the movement and limit the travel. I'll get back to you, although today I have other priorities ok2


My servotester will have three functions - manually swing the servo using a Pot. Continuously sweep the servo through 180, and finally display the output from a Tx/Rx . Not really much of a challenge to an Arduino, and probably not cost effective given the price of these things on eBay. I do already have a simple tester and an Action device which does all these things, but I wanted to use the Arduino and this seemed a good project.

Barrie
Title: Re: ARDUINO any one?
Post by: NoNuFink on February 03, 2016, 03:45:00 pm
You might like to add an additional function for a servo tester.
I have, several times, had a faulty servo in which the motor would not start if stopped in a certain position.
They would run OK but sometimes would only start if 'helped' by hand.  Presumably the cause was with one faulty/dirty commutator segment.

I suggest a non-continuous sweep from end to end. I.E. make a very small step, wait for the servo to move and come to rest and then step again.  If there is a motor start problem the servo will just stop .  You can't pin it down to any particular servo arm position because of the gear ratio, the failure being dependent on the motor position.

Just a suggestion  Hope it helps

NNF
Title: Re: ARDUINO any one?
Post by: barriew on February 03, 2016, 06:03:35 pm
That should be quite easy to incorporate. One of the options on the servo write instruction is to wait for the servo to move to its directed position before continuing. Which effectively means it is a start-stop movement. I will experiment, although I don't have a sticking servo to test it properly %)


Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on February 06, 2016, 09:36:13 am
Hi johnredearth
Your submarine challenge sounds interesting. Do you know why the servos jitter on power Up?


Seen some of your YouTube videos - they are brilliant - I even found myself reaching for a glass of red!


Regards
C-3PO
Title: Re: ARDUINO any one?
Post by: johnredearth on February 06, 2016, 10:26:46 am
Hi there.  I have no idea about the jitter.  I have loaded them with capacitors but to no avail.  I finally got the idea to power them up through a relay as soon as the arduino boots up.  That way there are no issues at all.  I am now thinking of extending this with the extend / retract servo.  Playing as we speak.

Most of what I do is achieved by copying, shifting and then trying to think with a clear head.  It is logic after all!  Red helps though.

Cheers
Title: Re: ARDUINO any one?
Post by: C-3PO on February 06, 2016, 06:12:42 pm
Brainstorm re servo jitter:
If you have a program that causes jitter especially on startup I'd love to see the code ( perhaps send by PM) it would be very interesting to hook the pwm signal to a scope and understand more about what is going on


C-3PO
Title: Re: ARDUINO any one?
Post by: johnredearth on February 06, 2016, 09:12:21 pm
C 3PO

Your response is very C 3PO like.  I have got a sep power source etc.  The jitter is 'only' on boot up for me.  BTW got my retract script working on the bench last night.  Once it is ready I will reveal all as any contributions from people with much more experience than I would be soo  good.  Reaching fer the celebratory wine.

John
Title: Re: ARDUINO any one?
Post by: C-3PO on February 06, 2016, 09:42:01 pm
John,


that was quick with your submarine solution!



Do you have a pull down resistor ( 10k between each pwm pin and gnd)  on the pwm lines?


From memory (which is always dangerous!) the pwm line goes high low high as the Arduino boots. Adding the pull down resistor makes the pwm pin stops this. This also applies to barriew and his misbehaving servo on bootup
C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on February 07, 2016, 06:18:29 am
From memory (which is always dangerous!) the pwm line goes high low high as the Arduino boots. Adding the pull down resistor makes the pwm pin stops this. This also applies to barriew and his misbehaving servo on bootup
C-3PO


I hope to e able to clear my bench sometime Monday to do some testing on my Ramp Mover. I'll report back after that.


Barrie
Title: Re: ARDUINO any one? - Servo problem
Post by: barriew on February 09, 2016, 03:00:03 pm
I believe I have solved the problem. :-))  The ramp needs the full range of a channel to operate so I use the aircraft throttle channel as that is the one without a centring spring. Of course for an aircraft you want the throttle to start at the minimum don't you %) %) . Because of the constraint in mounting the servo, the channel needs to be reversed, hence the ramp drops to its maximum extent. O0


The answer is to use a separate power supply to the servo an use the Arduino to control a relay to supply that power.


Thanks to those who showed an interest in my problem.


Barrie
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 09, 2016, 03:43:17 pm
I wasted the last 3 evenings just sodding about with mine, seeing what I could make it do  :embarrassed:
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 09, 2016, 06:37:56 pm
I wasted the last 3 evenings just sodding about with mine, seeing what I could make it do  :embarrassed:


And the answer is "quite a lot" once I figured out it was the included stepper motor that was faulty and not my wiring lol
Title: Re: ARDUINO any one?
Post by: barriew on February 09, 2016, 07:09:05 pm
Yes - I've not had much success with the stepper. Not that I'm too worried as I can't at the moment see a use for it. %)


Barrie
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 09, 2016, 08:13:39 pm
Yes - I've not had much success with the stepper. Not that I'm too worried as I can't at the moment see a use for it. %)


Barrie


I can, and they are the reason for my dabbling with Arduino.
The one that came with my set was faulty (looks to be mis wired)
I bought another couple as I had plans and all of those work


What I am finding is that arduinoing (my new word for it) is a consumer of free time of the worst order  {-)  but satisfying all the same
Title: Re: ARDUINO any one?
Post by: dreadnought72 on February 10, 2016, 01:01:04 am
What I am finding is that arduinoing (my new word for it) is a consumer of free time of the worst order  {-)

Yup.  :-))

But here are some ideas on the programming side...

1/ Before you program, write down what you want to happen. If there are multiple inputs, write down what you want the end results to be in every circumstance. Programs are logical, we are not. Writing down can (and should) include sketch graphs of input-versus-output. If-then and logical maps are extremely useful.

2/ If you're copying and pasting program lines from third party sources, try to understand what these lines are doing. Don't work blind. You'll then get a grip of what each and every instruction is. Maybe you don't need/have to amend parts of it?

3/ Test the program in small chunks. Does a chunk behave the way you expect it to? If not, why not? If it does, move on...

4/ Programs longer than (in my professional experience) six to ten screens of code with, particularly, subroutines and branching become mentally unmanageable. You can't hope to grok it in one. It's like juggling jelly. Stop for tea and you've lost something.

This is why // and /* ... */ become essential. Note: I used pink in Actionscript for comments years ago, and I've hardwired myself to read anything in this colour as a comment, and nothing else. Your colour may vary. Comments are ignored by the processor, take just a little room, but allow you to tell yourself (and others) what a section of code actually does. For programs beyond the mentally unmanageable, a comment might be a lifeline after just a few days of programming.

My favorite example is // Andy, trust me, this works that after two days on a complicated ongoing project, meant that I could incorporate the routine that followed it without having to re-understand what the hell I'd written. A year later, I nodded at my then confidence and could move on!

There is nothing worse than looking at old code that you wish to adapt, code that you yourself have written, that no longer makes any sense, because there are no comments in it.

5/ When everything's written, and everything works, save your code. Save it all over the place. Print it out. Spend a while writing down what the code does and how it works, line by line. You will need this information at some point in the future.

Andy

Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 10, 2016, 08:12:00 am
Having done VB programming in the past I have to agree wholeheartedly with adding comments


Lots of the scripts I have done in VB have comments like "this routine works but could be tidied"
Title: Re: ARDUINO any one?
Post by: rickles23 on February 10, 2016, 01:58:31 pm
Hi,

Firstly I know little about computers and even less about Arduino.

If there is something I need to find out I will ask those better informed than I.

On a model ship I need music, shouted commands and various gun fire sounds.

Space and battery power are no problem as I use batteries for ballast.

I need a timer so that after an interval the various sounds can play one after the other but with a gap between them of a few minutes.

Would this be in the realms of Arduino or do I need to find another option.

Regards
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 10, 2016, 04:18:22 pm
Hi,

Firstly I know little about computers and even less about Arduino.

If there is something I need to find out I will ask those better informed than I.

On a model ship I need music, shouted commands and various gun fire sounds.

Space and battery power are no problem as I use batteries for ballast.

I need a timer so that after an interval the various sounds can play one after the other but with a gap between them of a few minutes.

Would this be in the realms of Arduino or do I need to find another option.

Regards


That would be pretty straight forward, you could even have the sounds set to play at random at a flick of a switch on your TX
probably cost less that £20.00 to build as well:-


Arduino Nano (the main processing bit) £3.50
MP3 Module loads the sounds from a memory card £3.50
some kind of Amplifier & Speaker £5.00-20.00
Smart box to fit it all in £2-5


The code wouldn't be that difficult either

Title: Re: ARDUINO any one?
Post by: richald on February 10, 2016, 04:50:35 pm
Rickles

3 links on using arduino to play audio files
 
Complete how-to project . . .
http://www.instructables.com/id/Playing-Wave-file-using-arduino/ (http://www.instructables.com/id/Playing-Wave-file-using-arduino/)

Another complete example but will need a bit of work.
https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer (https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer)

Sample hardware - would need investigating as to exact capabilities.
http://www.highqualitybuy.com/audio-player-mini-sd-card-sound-module-wtv020-sd-20s-wtv020-sd-16p-for-arduino-BI00734.html?currency=GBP&gclid=CPal6_LP7coCFQITwwodz4QD4g (http://www.highqualitybuy.com/audio-player-mini-sd-card-sound-module-wtv020-sd-20s-wtv020-sd-16p-for-arduino-BI00734.html?currency=GBP&gclid=CPal6_LP7coCFQITwwodz4QD4g)

You would need to convert each of your sounds into a .wav file, store it on the SD card, and then the arduino control
program would control which sounds are played and when.

Richard
Title: Re: ARDUINO any one?
Post by: C-3PO on February 10, 2016, 05:14:48 pm
The Rolls Royce of sound (wav file) trigger boards for Arduino

http://robertsonics.com/wav-trigger/

The sound out of this is truly remarkable ( almost HiFi like!) - 14 wav files can be played at the same time, I seem to remember each with their own adjustable (as they play) volume.

You can even pitch bend the output - sadly only the combined output.

C-3PO
Title: Re: ARDUINO any one?
Post by: rickles23 on February 11, 2016, 06:08:27 am
Hi,

Thank you for all your replies.

I now know more about Arduino.

I now have a lot of reading to do and a visit to my local Jaycar store.

Regards
Title: Re: ARDUINO any one?
Post by: johnredearth on February 16, 2016, 07:23:43 am
Hi

I have been working on a small video about boats and arduino.   I really want to get people into this.  Does this work for you??
https://youtu.be/_cJs9mqJWvI

Cheers

Title: Re: ARDUINO any one?
Post by: tsenecal on February 16, 2016, 11:30:17 am
I have added a little bit of code on a thread at two different submarine websites

it started at subcommittee.com, where a member started a discussion about using an arduino to create a Robbe multi-switch decoder:

http://subcommittee.com/forum/showthread.php?32808-Multiswitch-de-Robbe-y-Arduino (http://subcommittee.com/forum/showthread.php?32808-Multiswitch-de-Robbe-y-Arduino)

my newest sketch starts at post #24


and it has been replicated at subpirates.com

http://www.subpirates.com/showthread.php?5285-Arduino-based-Robbe-multi-prop-decoder (http://www.subpirates.com/showthread.php?5285-Arduino-based-Robbe-multi-prop-decoder)

as it sits, i have a fully functional replacement for a multi-prop or multi-switch decoder, with complete access to the source code for future enhancements and upgrades...
Title: Re: ARDUINO any one?
Post by: barriew on February 20, 2016, 03:12:12 pm
I have at last finished my Arduino based Servo and Transmitter Test and Calibrate unit. The difficulty was getting it to fit into the box I made for it. %)


(http://i1371.photobucket.com/albums/ag293/barrienw/100_1120_zpsivras10n.jpg) (http://s1371.photobucket.com/user/barrienw/media/100_1120_zpsivras10n.jpg.html)


I realise that these can be bought very cheaply from China or ebay, but this wasn't expensive and I made it myself :-))


I have also, thanks to an Instructable on making an Arduino Uno on Veroboard, worked out how to complete my Ramp Mover project and eliminate the unwanted drop of the ramp as soon as power is applied. I will order the parts when I return from holiday.


Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on February 20, 2016, 05:31:28 pm
Barrie, re Servo Tester
Wow - that looks pretty professional - sure this must have given you a real sense of achievement - lots of learning and a really useful piece of good looking kit as the outcome.

Well done that man!

C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on February 20, 2016, 07:28:19 pm
Thanks C-3PO :-))


Barrie
Title: Re: ARDUINO any one?
Post by: johnredearth on February 20, 2016, 09:45:15 pm
Yes fantastic work.  Well done
John
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 20, 2016, 09:55:47 pm
Nice work there Barrie,
A suggestion for V1.2....
Would it be possible to show current draw on the display?

I would be intetested in taking a look at the code and the schematics. I'll drop you a pm when you're back from hols
Title: Re: ARDUINO any one?
Post by: barriew on February 21, 2016, 06:47:51 am
E2V - I'm not sure about current draw - I guess if the Arduino can measure it, displaying it would be no problem. C-3PO or someone more experienced with Arduino would know. I can send you the code, but there are no schematics! I have been struggling to draw them myself. I didn't include a picture of the inside of the case because it is not a pretty sight %) %)


I'll let you have the code when I get back - I could probably post it here if anyone else is interested.


Barrie
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on February 21, 2016, 07:20:33 am
E2V - I'm not sure about current draw - I guess if the Arduino can measure it, displaying it would be no problem. C-3PO or someone more experienced with Arduino would know. I can send you the code, but there are no schematics! I have been struggling to draw them myself. I didn't include a picture of the inside of the case because it is not a pretty sight %) %)


I'll let you have the code when I get back - I could probably post it here if anyone else is interested.


Barrie


If you could,
Had a quick look online and it looks like there's a module for that ACS712
And some info here:-
http://henrysbench.capnfatz.com/henrys-bench/the-acs712-current-sensor-with-an-arduino/

Title: Re: ARDUINO any one?
Post by: barriew on February 21, 2016, 12:31:28 pm
E2V
OK - I have time to waste fill until its time to set out for Gatwick :-))  So I put together a sort of schematic. If you think this is a mess, you should see the actual wiring. I have left out the display, which is a 1602 with the piggy back driver so only 4 connections are required to the Nano. :o %)
I think that a different selection of pins may make for a neater layout. This was developed on a Uno and breadboard, but is built on a Nano with a screw terminal shield. I think I have worked out how to use the basic chip on veroboard for my ramp mover, and that could be a neater solution for this also.

I do need to verify that the pulse to degrees mapping is correct - there are differing figures used in the examples I have looked at.

I welcome your comments - when I return %)

Barrie
Title: Re: ARDUINO any one?
Post by: johnredearth on March 19, 2016, 11:56:23 am
HI all


An update on my arduino powered bow hydroplanes.  I have to say the coding was easy compared with the mechanics of this monster.  In the video you will see the closing action at different speeds.  This is just a change to the code.


https://www.youtube.com/edit?video_id=sezG86I8C_U&video_referrer=watch


Title: Re: ARDUINO any one?
Post by: richald on March 19, 2016, 12:26:54 pm
John

Couldn't get your Youtube link to work -
is this the one you were talking about ?
the system looks very good.

https://www.youtube.com/watch?v=sezG86I8C_U (https://www.youtube.com/watch?v=sezG86I8C_U)

Richard
Title: Re: ARDUINO any one?
Post by: barriew on March 25, 2016, 01:39:47 pm
Hi there.  I have no idea about the jitter.  I have loaded them with capacitors but to no avail.  I finally got the idea to power them up through a relay as soon as the arduino boots up.  That way there are no issues at all.  I am now thinking of extending this with the extend / retract servo.  Playing as we speak.

Most of what I do is achieved by copying, shifting and then trying to think with a clear head.  It is logic after all!  Red helps though.

Cheers


John


Did you ever implement your idea of using the Arduino to control a relay to switch on the Servo power supply? I have been trying to do this and have built the hardware, BUT I am struggling with the Sketch.
Does delay() work in setup? It doesn't seem to have any effect.
If I put the delay and relay activation inside the loop it will keep being obeyed. How do I do ensure it is only processed once?


Barrie
Title: Re: ARDUINO any one?
Post by: g6swj on March 25, 2016, 07:19:51 pm
Barrie,

The delay() command has no effect in setup

One way to get a section of code to run just once in the main loop is to use a flag.

e.g.  in setup set a flag  int myflag=0;

Then near the beginning of the loop

// run code below only if int myflag =0, set myflag to 1 at the end so this only runs once each time the program is started
if (myflag==0){

delay(200); // set your delay value here

myflag=1;
}
Title: Re: ARDUINO any one?
Post by: barriew on March 25, 2016, 07:22:00 pm
Thanks for that. I knew there must be a way, but couldn't quite figure it out.


Barrie
Title: Re: ARDUINO any one?
Post by: g6swj on March 25, 2016, 07:40:13 pm
Barrie,

Do be careful using delay() - we all do but remember that it halts the program for the delay duration and nothing else is processed which most of the time is fine until it's not!

A much better way is to use elapsed time eg. millis(); command which returns the number of milliseconds since the Arduino board began running the current program

This way the program continues to loop and never stops - it compares current millis() with a prev_time snapshot + our delay value

In setup declare a variable for storing the last time we ran a section of code e.g. unsigned long prev_time=0;
In the main loop

if (millis() >= prev_time +100) { // the 100 in this example is our delay in ms
  // Set our variable "prev-time" to the current time in elapsed ms so we can compare it the next trip through the loop

  prev_time = millis();
}


Title: Re: ARDUINO any one?
Post by: barriew on March 25, 2016, 08:10:58 pm
Yes - I know about the dangers of Delay, but in this case I specifically don't want anything else to happen :-))  I will however try both methods.


Thanks again,


Barrie
Title: Re: ARDUINO any one?
Post by: johnredearth on March 25, 2016, 08:28:16 pm
Barry


The answer is yes I have managed to get the sketch working.  If you look at my video arduino for boats 1 and 2 you can see it and also the sketch is on my website.  https://youtu.be/_cJs9mqJWvI
I have now integrated the sketch into the 'big one' that runs the entire submarine and all seems OK.  Turning the power off to the servos was an idea born of necessity as the servo jumped around during boot up.  Jonathan kindly showed me this was because of all output pins I was using 13.  Anyway, all done now and I am using the concept to control the retract also.  So all good.  Looking forward to getting the finished project on the water!


John

Title: Re: ARDUINO any one?
Post by: barriew on March 26, 2016, 07:59:17 pm
Thanks John. g6swj sorted me out. However, I did manage to select pin 13 when I designed the layout on veroboard <*<  Luckily there was room to put in a link and use pin 12 instead. I haven't installed it in the boat yet, but the test circuit worked delaying switching on an led. Provided my layout was correct it should work.


Barrie
Title: Re: ARDUINO any one?
Post by: g6swj on March 26, 2016, 08:18:46 pm
Barrie,

Pleased it all works - for anybody that doesn't know (and is interested) the issue with pin 13 - when the Arduino Uno powers up or is reset - it flashes an LED on the board which is attached to pin 13 to let you know that the board has got power and has booted - anything connected to pin 13 will get that on/off boot-up signal which may well be undesirable!!

Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: essex2visuvesi on March 26, 2016, 09:39:52 pm
Barrie,

Pleased it all works - for anybody that doesn't know (and is interested) the issue with pin 13 - when the Arduino Uno powers up or is reset - it flashes an LED on the board which is attached to pin 13 to let you know that the board has got power and has booted - anything connected to pin 13 will get that on/off boot-up signal which may well be undesirable!!

Regards
Jonathan


Saved that nugget of info for future reference
Title: Re: ARDUINO any one?
Post by: g6swj on April 05, 2016, 09:48:41 pm
I have started a new project - an Arduino Powered Autonomous Boat. - Why you may ask - just something to keep my grey matter on it's toes.

I have scratched the surface of this topic and now understand in a bit more detail some of the challenges involved which where certainly not obvious to me at the start. e.g. I thought that you expect the boat to be guided to the waypoint but did not realise that you need to accept that getting close to it (in the vicinity of waypoint) within a predetermined offset/tolerance is required and acceptable to stop the boat going round in circles trying to achieve a 100% location accuracy before moving on to the next waypoint - seems obvious now but not at the start of my journey with this subject.

I have GPS, compass sensor etc attached to an Arduino spitting out lat/long/heading etc. I have Googled the net and found some excellent code snippets, some fully working solutions but I wonder if any Mayhem user has already done this and would be willing to share their knowledge or be willing to point me in the right direction (excuse the pun!) when I inevitably get stuck.

Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: johnredearth on April 05, 2016, 10:51:01 pm
Jonathan


I am very interested in your progress.  As you know I have simply used a compass to automate a course and now I am busy with another project but I would love to see what you come up with.   The notion of needing approximation is one I had considered, but had no answer for.  Must admit though I haven't tried.  I also note the ardu-boat people have software packages so you can set your waypoints on google earth and then just go for it.  Is that how you see this working?  Another way for boats would be to sail your boat manually around a course and set waypoints as you go.  We have an island on our pond and it would be great to go into auto mode and come out at exactly the right place. 


Cheers


John
Title: Re: ARDUINO any one?
Post by: g6swj on April 06, 2016, 08:03:25 am
Hi John,

Every time I look at this type of kit I can't help but think of Star Trek and the phrase "Beam me up Scotty" - it still amazes me how it all works. I haven't scoped out the project yet in detail but I do want to have a go at live Google position mapping so I also will include telemetry to get data back to shore. I will record data to micro SD card as well so it can be mapped after the event - indeed the GPS has some internal memory that can automatically record position data every 15 seconds for approx. 16 hours.

I know you have mentioned this before but the accessibility to pre-written code on the internet is stunning - have a look at this example - http://www.instructables.com/id/Arduino-Powered-Autonomous-Vehicle/step5/Object-Avoidance/#step1  - step 3 of this project includes 700 lines of code which looks well thought out -  I will no doubt use most of this code as the starting place for my project - indeed it may involve very little tweaking

The aspect of "averaging or smoothing" various data reads is covered with the library "moving_average.h" - if you Google "arduino moving average library" you may find something that could help with your twitchy bow plane movement (does sound painful :) ) although you may need to go back to school to remember what Rolling average, Mean, Mode, Minimum, Maximum, Standard Deviation are all about - I certainly can feel the dread of my sons maths homework from years past coming back to haunt me...

I will be very interested to see how accurate the GPS is with regard to positioning - I think 5-10 meter accuracy is likely which could be difficult to use in the real world - we will see.

If the results are positive overall I would love to have a go a making it all into a library for ease of use

Jonathan
Title: Re: ARDUINO any one?
Post by: Brian60 on April 06, 2016, 08:33:41 am
Jonathan you are getting into the area that interested me when I was presented with a Arduino board a year ago, sadly it is still waiting for me to do something with it!

In my case I was looking more for dynamic positioning - holding a point against wind and water direction, just like full size anchor handlers/rig supply vessels do. In their case the ability to stay over a point is measured by the square metre, I'm not sure that the technology is available to hold a model ship in place down to say 20mm. I'm deducing this from a car satnav, the technology there can get you to within 20 -40ft of your destination but not to the actual door, you still need to do that last little bit yourself.
Title: Re: ARDUINO any one?
Post by: g6swj on April 06, 2016, 08:51:47 am
Hi Brian,

That's sounds an interesting project - I presume you would ideally need bow & stern thruster to make this possible. I seem to remember that GPS accuracy is determined by a "timing error" that is introduced so non military GPS is in-accurate by a factor where as military GPS is much more accurate. If the GPS data is static (may need some smoothing) whist the receiver is static then even if it's not reporting the exact position it may still be possible to hold that "reported position" - I will test this out and let you know.

I need to research what a second of lat/long relates to in terms of distance over the earth as this would also be a factor.

All good stuff on a rainy day :)

Jonathan
Title: Re: ARDUINO any one?
Post by: g6swj on April 06, 2016, 08:57:15 am
What ever did we do pre-internet?

The distances vary. A degree, minute or second of latitude remains fairly constant from the equator to the poles; however a degree, minute, or second of longitude can vary greatly as one approaches the poles (because of the convergence of the meridians). At 38 degrees North latitude, one degree of latitude equals approximately 364,000 ft (69 miles), one minute equals 6068 ft (1.15 miles), one-second equals 101 ft; one-degree of longitude equals 288,200 ft (54.6 miles), one minute equals 4800 ft (0.91 mile), and one second equals 80 ft.

Hmmmm.....

Jonathan
Title: Re: ARDUINO any one?
Post by: dreadnought72 on April 06, 2016, 09:40:41 am
Non-military GPS won't give you that amount of precisional accuracy, but the gyro stuff can: the accelerometer and heading info you can extract from the various inertial chips is plenty good enough for self-balancing robots. Holding a boat in one spot would be 'easy'.


Andy
Title: Re: ARDUINO any one?
Post by: g6swj on April 06, 2016, 11:53:07 am
Hi Andy,

My head hurts - I have yet to see the light! I sort of half get this I think.

I presume it sort of related to this type of thing - https://www.youtube.com/watch?v=7GVXqNLLH7Q

I need a "light bulb" moment

Jonathan

Title: Re: ARDUINO any one?
Post by: Brian60 on April 06, 2016, 12:24:14 pm
Andy have you some links to read up on the gyro stabilisation? I'll be beginning the build that all of this is supposed to go in next month. So I would like to find out if its going to be feasible to do.

This is what I am hoping for.... Anchor handler etc can be moved out on to lake via normal radio, then trigger whatever system will hold the ship in one spot. This would allow over the side/stern activity like lowering rov, crane derrick etc to be done while the ship is held by 'the system' switching on/off azimuthing pods bow and stern.
Title: Re: ARDUINO any one?
Post by: dreadnought72 on April 06, 2016, 12:32:19 pm
In the second part of your example the motion of the IMU is cancelled out for the camera by the movement of the servos.

You'd be using azipod thrusters (?) to rotate & translate the hull (with the IMU mounted in it) in order to return to the angle and location that the device was set to.I can't, following a quick look, find a figure for the minimum sensitivity of that accelerometer - but my experiments with the compass side of things on a near-identical chip demonstrates a (very) little drift: about a quarter of a degree per minute: pretty much unnoticeable.

Of course, a hardish part would be in determining the control signals required by the azipods to perform the correct manoeuvre. Lots of testing and programming required.


(And the really hard bit would be to program the device to work it out for itself: just let the program play with the azipods until it learns what works. That's the AI, fuzzy logic, here-comes-Skynet approach for advanced tinkerers.) :o


Andy
Title: Re: ARDUINO any one?
Post by: dreadnought72 on April 06, 2016, 12:43:45 pm
I see that there are some good guides on the Adafruit site for using their accelerometers. The Arduino forums are a good place to look, too.


And it might be worth taking a peek into what the drone-people are using for three-axis stability: though, being boats, we'll only need two.


Andy
Title: Re: ARDUINO any one?
Post by: tsenecal on April 06, 2016, 04:18:00 pm
Guys, another place i have found that has some nifty "IMU" gadgets is

http://pololu.com (http://pololu.com)

specifically:

https://www.pololu.com/category/80/accelerometers-gyros-compasses (https://www.pololu.com/category/80/accelerometers-gyros-compasses)

i currently am using their product #2127 for some onboard telemetry (magnetic heading, roll, pitch) for my model submarines.

i have a #2468 on order, it adds a gyro to the mix to give better readings, "synergy" is the phrase everyone uses...  but with all that, i should be able to make an onboard pitch and roll stabilizer, which also sends the data back to the transmitter...


I have looked at both adafruit and sparkfun ( http://sparkfun.com (http://sparkfun.com) ) and pololu seems to beat them on price.
Title: Re: ARDUINO any one?
Post by: tsenecal on April 06, 2016, 04:28:39 pm
another item that almost escaped me about using GPS.

1) most of the cheap GPS devices have about a 30 foot resolution.

2) I can't remember where i read this, but doubling up on some of the cheaper GPS devices was the idea, the basic design is to have two different GPS devices, and average the LAT and LONG readings from the two different devices, getting a more accurate set of values.  the more devices, the better the result.
Title: Re: ARDUINO any one?
Post by: g6swj on April 06, 2016, 09:55:45 pm
Hi Tim
Interesting info. I think I end my day more confused than I started it! Oh well listening to music drinking fine whisky so can all be bad!
The spec of the GPS I am using says accuracy 3 meters or better

I am waiting for some LCD backpack i2c boards to arrive so I can easily hook up a display to see what's going on rather than using a PC. Going to put the kit in a floating tray in the bath an observe the raw data maybe then the mist will dispell

Jonathan
Title: Re: ARDUINO any one?
Post by: g6swj on April 07, 2016, 09:26:38 am
Brian,

This is an interesting article https://en.wikipedia.org/wiki/Inertial_measurement_unit

So I think you need a TIMU not an IMU to hold position.

And I think you would need Azipod/Schottel type drives rather than bow/stern thruster would be needed.

I think I'll back track and keep things simple for now as IMU / TIMU is above my pay grade!

Jonathan
Title: Re: ARDUINO any one?
Post by: Brian60 on April 07, 2016, 01:25:52 pm
Thanks Jonathan I'll take a look. The build I have in mind has two azipods at the stern for manouvering and main drive and one at the bow along with two tunnel thrusters for manouvering only. The bow  azipod drops out of the hull when needed, the full size ship has three tunnel thrusters and two azipods up front. But in a model there is just not the room to fit it all in.
Title: Re: ARDUINO any one?
Post by: tsenecal on April 07, 2016, 02:45:11 pm
the Time portion of a TIMU could be picked up from the clock data in the GPS stream...  its supposed to be accurate to within 1ms of my nearest atomic clock, but the real "time" value returned is complicated...

from the web:

Quote
GPS has become the world's principal supplier of accurate time. It is used extensively both as a source of time and as a means of transferring time from one location to another. There are three kinds of time available from GPS: GPS time, UTC as estimated and produced by the United States Naval Observatory, and the times from each free-running GPS satellite's atomic clock.  The Master Control Station (MCS) at Falcon Air Force Base near Colorado Springs, Colorado gathers the GPS satellites' data from five monitor stations around the globe. A Kalman filter software program estimates the time error, frequency error, frequency drift and Keplerian orbit parameters for each of the satellites and its operating clock.   This information is uploaded to each satellite so that it can be broadcasted in real time. This process provides GPS time consistency across the constellation to within a small number of nanoseconds and accurate position determination of the satellites to within a few meters.


with a good GPS for arduino being $50, and the IMU from pololu being $12, i think that could be considered affordable by some.
Title: Re: ARDUINO any one?
Post by: g6swj on April 08, 2016, 07:47:04 am
Hi Tim,

To obvious for me to get time from GPS :) However if difficult I guess another way would be to use one of the many RTC boards to get the time simply. Adafruit's Chrono Dot claims 1 sec per year accuracy so may be good for the boating lake on a Sunday morning :)

Not sure if I confused things a little - my reference top "above my pay grade" was a reference to my ability (or lack of it)! - That said "I can't get you (concept) out of my mind" - I saw JL's ELO in concert last night and it hit me when this track played that I don't like walking away from things like this as my mind strays back to the challenge frequently - I would be happy to come to a point where I think I know how to do it rather than a collection of possibly related concepts.

I still do not grasp the concept completely - although the discovery that time is a required ingredient helped clear some of the fog of "how does this work" from the initial suggestion of just the raw triple sensors data fusion.

I am attempting to get it straight in my head how this could work - I presume the easiest way is to position the boat into the wind/tide and firstly maintain heading with thrust/azipod devices. Secondly you would then monitor the TIMU bit and correct the forward/backward & port& starboard movement.

Any thoughts?

Jonathan

Title: Re: ARDUINO any one?
Post by: dreadnought72 on April 08, 2016, 10:53:46 am
The thing about the time element is - your looping programming is counting time already. No need for a specific TIMU.

Just query/compare the state every hundredth/tenth of a second or so (you'd need a 'delay' in the loop), work out drift and yaw from the equations of motion, rotate the azipods to suit and fire 'em up. Sure, your mechanical azipods will be constantly changing/thrusting and playing 'catch up' with the electronic side of things, but who cares? You might need some maths to filter and smooth the data and output, but it really boils down to a negative feedback system.

Andy
Title: Re: ARDUINO any one?
Post by: g6swj on April 08, 2016, 11:11:20 am
Andy,

Yup obvious (now) and overlooked - thank you for words of wisdom - it does make me smile how it's possible to miss the really obvious

I would advise against delay() as such and use example below but I think that's what you meant - I just had it drummed into me "DON'T USE DELAY!"

compare current millis() with a prev_time snapshot + our delay value

In setup declare a variable for storing the last time we ran a section of code e.g. unsigned long prev_time=0;
In the main loop

if (millis() >= prev_time +100) { // the 100 in this example is our delay in ms
  // Set our variable "prev-time" to the current time in elapsed ms so we can compare it the next trip through the loop

  prev_time = millis();
}


Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: dreadnought72 on April 09, 2016, 02:20:44 pm
Hi Brian!


A few thoughts.


The IMU measures acceleration and rotation. Assume the IMU is centrally placed, with its Y-axis along the hull (bow is positive) and X-axis is across the hull (starboard positive). Z-axis rotations are the hull yawing. To keep it simple, we're only interested in these three things - disregard Z-axis motion and other axes' rotation (due to wave action, pitching and rolling in a sea).


If your loop queries the IMU at, say, a hundred checks per second, you'll get two lots of quite accurate acceleration information, and one of rotation.


How to use this data?


The area under a graph of acceleration/time is the velocity. This is not particularly interesting. However, the area under a graph of velocity/time is a displacement, a distance, and this is very interesting. We want to work the anchor handler to minimise/cancel out any displacements from our zero position.


So here's some pseudo code - you'd need to do this for both the x and y axes:


time = time since last checked
x_acn1 = IMU's current x-axis acceleration
x_vel1 = time * (x_acn1 - x_acn0)/2
x_displacement = time * (x_vel1 - x_vel0)/2
stuff here
x-acn0 = x_acn1
x_vel0 = x_vel1


...and repeat.


'Stuff here'?


The image shows our original position, that is, the point at which the system was switched on P0, and our current position at any point in time P1.


Since we can calculate the x and y displacements, and the current z-axis rotation, we can drive the boat back to P0.


All angles are measured clockwise from the positive y-axis and best worked in radians.


alpha is the angle of our displacement. It's given by pi/2-ATAN2(dx,dy).
beta is the hull rotation (heading).
So the angle we need to drive the boat (from the boat's point of view) is pi+alpha-beta. Let's call it gamma.

Given the layout of the proposed model, I suspect you'd rig the bow thrusters to correct for beta, and the three azipods to drive the hull along gamma.


As the heading changes over time, back to zero, gamma will change.


Now, the beauty of this is that, at high sample rates (fast loop times) the displacements will be far smaller than that shown in the diagram. I suspect your azipods' props will be barely turning (the bulk of their work will be in changing the angle of thrust).


And - perhaps - there lies the real problem. It would take some experimentation to determine the best angles for the azipods to move the vessel in the desired gamma, but a close guess around the compass might be enough, because the system will constantly be monitoring and measuring its current P1.


Andy
Title: Re: ARDUINO any one?
Post by: Brian60 on April 09, 2016, 08:52:58 pm
I'll need to go through that tomorrow Andy. A little too much to take in this late on a saturday night!
Title: Re: ARDUINO any one?
Post by: g6swj on April 11, 2016, 06:21:53 pm
GPS Autonomous Boat  - stage 1 basic GPS functionality seems to be working ok

Need to get my head around decimalisation of lat/long!

Title: Re: ARDUINO any one?
Post by: barriew on April 12, 2016, 02:55:32 pm
My Ramp Mover Project
I have finally completed my project to automate the ramp on my car ferry. I had the basic operation completed some time ago, but had a problem with the ramp dropping suddenly when the system was switched on. A comment on the forum lead me to realise that I should be able to use the Arduino to stop this. This involved routeing the servo power via the Arduino and inserting a delay to allow the receiver to initialise properly.
 I modified my veroboard layout to include a 5 volt relay for this purpose, but unfortunately the relay was a dud. I next ordered a relay module designed for Arduino . When it came it was quite bulky and would have been messy to incorporate and so I was going abandon the idea. Then I realised that I should be able to utilise a MOSFET to switch the power, so another re-design of the veroboard.
After various errors caused by lack of knowledge, I finally completed the board only to find the ramp still dropped when servo power was connected after the delay.  I have finally solved this by inserting a 'go to home' statement in the Sketch immediately after the delay - it may have been better before I suppose. The ramp now just does a quick 'jerk' once power is applied.
Having finally got this working I have also worked out the cause of the problem - Digital Servos <*< I have only just realised that the ramp servo is digital. It wasn't ordered specifically, it just happened to have the right power for the job. So that being the case, I can now remove the delay.
The photo is of the finished product - not the neatest board, but it has gone through lots of changes. The underside is even worse %) .
Thanks to all who offered help and advice.
Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on April 14, 2016, 11:28:14 am
Hi Barrie,

Dead impressed - even a bare bones, own build, cut down Arduino. Looks pretty neat to me. I have never done a "bare bones" Arduino build - you have inspired me to give it a go.

Looks like this really worked out well. Brick walls and stumbling blocks along the way (learning moments!) which in truth and with hindsight is a part of the challenge/fun and makes the grey matter work for it's money. Much more fun and rewarding this experiential stuff, having to work it out yourself rather than just making something from an existing design.

Good on you!

Regards
C-3PO
Title: Re: ARDUINO any one?
Post by: barriew on April 14, 2016, 05:28:52 pm
C-3PO


All is not as it seems :o  I tried removing the delay, and it was back to square one >>:-(  So, the delay will stay - shortened, but it will stay.


Barrie
Title: Re: ARDUINO any one?
Post by: g6swj on April 21, 2016, 07:07:59 pm
Autonomous boat project progressing well (I think)

Now working on telemetry link using 2 x RFM69CW 433mhz transceivers about £8 each - manufacturer quotes line of sight range >1km - we will see!

Jonathan

Title: Re: ARDUINO any one?
Post by: g6swj on May 10, 2016, 08:45:05 pm
Telemetry - one step closer to autonomous navigation
At last some success. If you have ever played around with technology/programming you will completely understand the experience of hitting a brick wall that just doesn't want to budge and your project grinds to a halt. Well after several precious hours of nothing I have at last got telemetry data flowing over the airwaves (433mhz) and now appearing on a remote shore based PC screen. It's rough (very) and needs thought but the basic concept is shown below - lucky it was only days before it hit the scrap heap...

Title: Re: ARDUINO any one?
Post by: tsenecal on May 10, 2016, 09:40:14 pm
Telemetry - one step closer to autonomous navigation
At last some success. If you have ever played around with technology/programming you will completely understand the experience of hitting a brick wall that just doesn't want to budge and your project grinds to a halt. Well after several precious hours of nothing I have at last got telemetry data flowing over the airwaves (433mhz) and now appearing on a remote shore based PC screen. It's rough (very) and needs thought but the basic concept is shown below - lucky it was only days before it hit the scrap heap...


i know exactly how you feel:  https://www.youtube.com/watch?v=fuX2pPjoMCY
Title: Re: ARDUINO any one?
Post by: g6swj on May 11, 2016, 06:55:30 am
Quote
i know exactly how you feel:  https://www.youtube.com/watch?v=fuX2pPjoMCY

Hi Tim,
Looks like you got your solution working - what was the display screen you where using?
Jonathan
Title: Re: ARDUINO any one?
Post by: Brian60 on May 11, 2016, 10:03:11 am
You guys are making massive advances that us lesser mortals can only stare and wonder at. %%
Title: Re: ARDUINO any one?
Post by: g6swj on May 11, 2016, 10:18:29 am
Hello Brian,

The funny thing about this is that most of the code I am using is not mine and is copied/patched together from the internet as most things with Arduino you copy and amend rather than start from scratch.

I am watching your progress with your dynamic positioning project - if you think the telemetry would be of use as you get further into your project ( so you can see on shore what is happening with sensor/gps data) then very happy to share code. (this doesn't sound quite right as it's not really my code in the first place!) - cost for the Telemetry transceivers (2x£8)

Like most things if you get a glance under the bonnet you will see that it's actually very simple and logical - easy for me to say now having wasted about 10 hours watching a blank telemetry less screen as I plugged away trying to get if to fire...

The application running on the shore based PC is written in VB.net using a free version of Microsoft Visual Studio. Whilst I can program in this with some effort 95% of the code was pasted from the internet. This could equally be an LCD screen attached directly to an Arduino. The reason I have gone for a pc based app is I want to do live Google mapping and like the idea of an animated compass and may even add a Radar section as well.

Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: tsenecal on May 11, 2016, 02:43:46 pm
Hi Tim,
Looks like you got your solution working - what was the display screen you where using?
Jonathan

Jonathan,

i am living within the constraints of the radio equipment i standardized on, i am using the OpenLRSng Transmitter module and Receiver with (in that video) a futaba 9cap radio.  in addition to that, the OpenLRSng protocol has "adopted" the FrSky telemetry protocol, so i am using the FrSky FLD-02 Telemetry Display Screen:

http://www.hobbyking.com/hobbyking/store/__40032__OrangeRX_Open_LRS_433MHz_Transmitter_100mW_compatible_with_Futaba_radio_.html (http://www.hobbyking.com/hobbyking/store/__40032__OrangeRX_Open_LRS_433MHz_Transmitter_100mW_compatible_with_Futaba_radio_.html)
http://www.hobbyking.com/hobbyking/store/__27096__OrangeRx_Open_LRS_433MHz_9Ch_Receiver.html (http://www.hobbyking.com/hobbyking/store/__27096__OrangeRx_Open_LRS_433MHz_9Ch_Receiver.html)
http://www.hobbyking.com/hobbyking/store/__19969__FrSky_FLD_02_Telemetry_Display_Screen.html (http://www.hobbyking.com/hobbyking/store/__19969__FrSky_FLD_02_Telemetry_Display_Screen.html)

on top of all that, i have built my own "hub" using an arduino that connects directly to the receiver and allows me to use some of the telemetry fields for my own purposes.  since that video was made, i have upgraded to the FrSky Taranis transmitter, still using the OpenLRSng TX module, allowing me to display a more comprehensive amount of telemetry data on that transmitter's built in display.   i use the OpenLRSng modules and receivers because i am using them to control submarines, which do not work with the new 2.4ghz radios.  like you, the core of the arduino code is a FrSky telemetry library i found online, that basically allows me to send data from an arduino to the receiver via serial comms, allowing me to take anything an arduino can collect and send it back to the transmitter for display.  Just took a look at my latest rev of the arduino code, and due to the use of that library, the total linecount on the arduino sketch i wrote is only 278 lines, including some comments.  it gives me 3 different battery voltages, amperage usage for my main battery, depth, main motor rpm, 2 temperatures, compass heading, a calculated speed, roll, pitch, and latitude and longitude.

an on-going thread on my construction of a second hub was finished recently on a website called "subpirates".  http://www.subpirates.com/showthread.php?5271-Custom-Frsky-Telemetry-Hub (http://www.subpirates.com/showthread.php?5271-Custom-Frsky-Telemetry-Hub)

what i have basically discovered is that for me, visual displays of data are often not useful, it takes your eyes away from the object you are controlling.  which is bad for model submarines.  the new transmitter allows me to take most of the telemetry data and use it to trigger audio warnings if values get below or above thresholds i decide upon.
Title: Re: ARDUINO any one?
Post by: Brian60 on May 11, 2016, 03:46:15 pm
Hello Brian,

The funny thing about this is that most of the code I am using is not mine and is copied/patched together from the internet as most things with Arduino you copy and amend rather than start from scratch.

I am watching your progress with your dynamic positioning project - if you think the telemetry would be of use as you get further into your project ( so you can see on shore what is happening with sensor/gps data) then very happy to share code. (this doesn't sound quite right as it's not really my code in the first place!) - cost for the Telemetry transceivers (2x£8)

Like most things if you get a glance under the bonnet you will see that it's actually very simple and logical - easy for me to say now having wasted about 10 hours watching a blank telemetry less screen as I plugged away trying to get if to fire...

The application running on the shore based PC is written in VB.net using a free version of Microsoft Visual Studio. Whilst I can program in this with some effort 95% of the code was pasted from the internet. This could equally be an LCD screen attached directly to an Arduino. The reason I have gone for a pc based app is I want to do live Google mapping and like the idea of an animated compass and may even add a Radar section as well.

Regards
Jonathan

I'm hoping that by the time I'm actually at the stage of needing to get the electronics up and running that all the problems have been solved and I can poach around and patch up code to see me through %) :} :}
Title: Re: ARDUINO any one?
Post by: g6swj on May 11, 2016, 09:01:50 pm
Tim,
I am aware of Frysky and OpenLRSng but know nothing about them. The little transceivers I am using are 100mw. Amazed that the Orange TX has frequency range of 400~460MHz.

Hope no one operates it anywhere near me as I can (not personally) have and ERP of 1KW at some of the frequencies it covers.

Totally agree about viewing the screen when you needs to be looing at the model. Part of the telemetry bit for me was so I could understand what the sensors where reading when the boat was out on the water - plus it's a bit of fun.

Just got a Google map to appear in my app before it rudely told me that my browser was out of date - so 6-8gb of Visual Studio 2015 now downloading.

Regards
Jonathan
Title: Re: ARDUINO any one?
Post by: tsenecal on May 11, 2016, 10:40:43 pm
Jonathon,


actually, i would love to see if your radio and an OpenLRSng system could co-habitate... the GUID based protocol that OpenLRSng uses should ignore any "interference" caused by an emitter nearby not using the GUID based protocol.  It would be interesting to see if their statements about robustness are true or not.


as to your browser being out of date....   isn't the map view "browser" just the "real" browser being used as an "object" embedded in your GUI?  i would hope that VB.net would have no bearing on that.
Title: Re: ARDUINO any one?
Post by: dreadnought72 on May 11, 2016, 11:35:52 pm
...poach around and patch up code to see me through %) :} :}


 :-))  It's the only way!


IF I get a chance over the next few days - real life is hectic - I'm going to try and 'IMU' what I've got - not least because I think it can work, but also because it's a damn-fine workout for the neurons. Stuff the cryptic crossword!


Andy
Title: Re: ARDUINO any one?
Post by: g6swj on May 12, 2016, 07:43:36 am
Andy,

Will be very interested in your endeavour with your IMU. Whilst Googling around I found these images -  quite useful for my simple mind. I would have as a priority to maintain heading first as adjustments after that are only in 2 axis (forward/backward and side to side). I am sure there is more to it than my simplistic view so will look forward to learning more about how this actually works.


Tim
Quote
as to your browser being out of date....   isn't the map view "browser" just the "real" browser being used as an "object" embedded in your GUI?  i would hope that VB.net would have no bearing on that
re browser I think it's an active X control - anyway it doesn't want to work in VS VB.net 2012 - now moved to 2015 and all working fine so I guess I will never know the answer.

Re
Quote
radio and an OpenLRSng system could co-habitate
- I would think that it would be a simple case of the strongest signal wins.

Regards Jonathan
Title: Re: ARDUINO any one?
Post by: Brian60 on May 12, 2016, 02:57:05 pm
Thats a damn fine illustration there Jonathon. It exactly explains all the inherant problems of setting up a dynamic positioning system using something as simple as an arduino.

When you think we are trying to emulate systems that cost in the tens of thousands of pounds yet we are using hardware that costs a couple of quid :o :D :D
Title: Re: ARDUINO any one?
Post by: dreadnought72 on May 12, 2016, 04:53:01 pm
That's 'cos they can charge tens of thousands!  ;)

 %%

Andy
Title: Re: ARDUINO any one? - Ramp Mover modification
Post by: barriew on May 29, 2016, 06:30:34 pm
In July my club will be exhibiting at a local fun day, where we have only a river on which to sail our models. This is not suitable for the Ferry, but I would like to show off the moving ramp. Rather than keep the transmitter and receiver on all day, I have made a modified version of my mover circuit which operates the ramp through its cycle of movements every two minutes. I may wear out the servo, but at least there should be no other damage. %)

Barrie
Title: Re: ARDUINO any one?
Post by: C-3PO on October 08, 2016, 08:27:27 pm
Want to know more about Arduino and how it can be used in radio control models

Have a look here for some ideas, inspiration, information - http://rchub.co.uk/

A collection of articles, web links, tutorials, concepts......

Regards
C-3PO
Title: Re: ARDUINO any one?
Post by: timgarrod on October 08, 2016, 09:39:44 pm
cheers for the link C-3PO, just about to order one for play and my next build.
Title: Re: ARDUINO any one?
Post by: Brian60 on October 12, 2016, 04:42:10 pm
Now thats a good link 3po, I'll spend the evening going through it. :embarrassed:
Title: Re: ARDUINO any one?
Post by: rcboater1 on June 17, 2020, 12:28:54 pm
Want to know more about Arduino and how it can be used in radio control models

Have a look here for some ideas, inspiration, information - http://rchub.co.uk/ (http://rchub.co.uk/)

A collection of articles, web links, tutorials, concepts......

Regards
C-3PO


I know this is an old thread, but that link doesn’t work.  Is there an updated one?
Title: Re: ARDUINO any one?
Post by: Dainesh on August 06, 2021, 09:08:08 am
Hello guys,


The Arduino is ok, but I much more like Teensy products from PJRC.com.
The reason is their products are much robust and faster.
The best thing is you are able to program them by the official arduino IDE.


Denes

Title: Re: ARDUINO any one?
Post by: C-3PO on August 06, 2021, 09:49:09 am
Hi Denes,

100% agree Teensy is a great product(s).

The vast range or boards available to the hobbyist from different stables is astonishing.

I still spend most of my time developing using the humble Arduino Uno or Nano and even then my code has events triggered on timers to "slow things down" as the loop is running to fast...

Not sure what you mean by Teensy being more robust - I have never had an issue with an Arduino that wasn't user error releasing the magic blue smoke.

Right now my favourite is definitley esp32 and want to get my hands on an esp32 s4 but they still don't seem to be released....

What type of RC model boat related projects are you creating?

Regards
C-3PO



Title: Re: ARDUINO any one?
Post by: Dainesh on August 06, 2021, 04:16:01 pm
Hi C-3PO,


Esp32 is nice 😊
I still have no any chance to play with it.


Oh I see you need slower things.
I use teensy at my workplace many different projects plus SPI and I2C busses, displays, stepper motors etc...


I start to use pics now.
I designed an Automatic Boiler Controller for my friends steam boat.
The other project is an ESC for RC boats.


Denes
Title: Re: ARDUINO any one?
Post by: tsenecal on August 07, 2021, 01:15:23 am
i have had some trouble with some of the extremely cheap chinese (under $2 a piece) arduino clones.  they seem to run fine for 30 minutes or so, then lock up.  not good for anything i want near a sub.