Model Boat Mayhem

Please login or register.

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

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

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #100 on: February 20, 2016, 07:28:19 pm »

Thanks C-3PO :-))


Barrie
Logged

johnredearth

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 33
  • Scratch building obsession
  • Location: Australia
    • ScratchbuildwithJohn
Re: ARDUINO any one?
« Reply #101 on: February 20, 2016, 09:45:15 pm »

Yes fantastic work.  Well done
John

essex2visuvesi

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 6,148
  • Location: Finland, England, Finland!
Re: ARDUINO any one?
« Reply #102 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
Logged
One By One The Penguins Steal My Sanity
Proud member of the OAM  (Order of the Armchair Modeller)
Junior member of the OGG  (Order of the Grumpy Git)

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #103 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
Logged

essex2visuvesi

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 6,148
  • Location: Finland, England, Finland!
Re: ARDUINO any one?
« Reply #104 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/

Logged
One By One The Penguins Steal My Sanity
Proud member of the OAM  (Order of the Armchair Modeller)
Junior member of the OGG  (Order of the Grumpy Git)

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #105 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
Logged

johnredearth

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 33
  • Scratch building obsession
  • Location: Australia
    • ScratchbuildwithJohn
Re: ARDUINO any one?
« Reply #106 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


richald

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,941
  • Retired and loving it!
  • Location: Driffield, East Yorks.
Re: ARDUINO any one?
« Reply #107 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

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

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #108 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
Logged

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #109 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;
}
Logged

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #110 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
Logged

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #111 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();
}


Logged

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #112 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
Logged

johnredearth

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 33
  • Scratch building obsession
  • Location: Australia
    • ScratchbuildwithJohn
Re: ARDUINO any one?
« Reply #113 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

barriew

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 2,111
  • Location: Thaxted, Essex
Re: ARDUINO any one?
« Reply #114 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
Logged

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #115 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
Logged

essex2visuvesi

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 6,148
  • Location: Finland, England, Finland!
Re: ARDUINO any one?
« Reply #116 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
Logged
One By One The Penguins Steal My Sanity
Proud member of the OAM  (Order of the Armchair Modeller)
Junior member of the OGG  (Order of the Grumpy Git)

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #117 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
Logged

johnredearth

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 33
  • Scratch building obsession
  • Location: Australia
    • ScratchbuildwithJohn
Re: ARDUINO any one?
« Reply #118 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

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #119 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
Logged

Brian60

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 3,315
  • Location: Hull,UK-but currently residing in Los Martinez, Spain.
Re: ARDUINO any one?
« Reply #120 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.

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #121 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
Logged

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #122 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
Logged

dreadnought72

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 1,892
  • Wood butcher with ten thumbs
  • Location: Airdrie, Scotland
Re: ARDUINO any one?
« Reply #123 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
Logged
Enjoying every minute sailing W9465 Mertensia

g6swj

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 313
  • Short Wave Jammer! -.-
  • Location: Northamptonshire, UK
Re: ARDUINO any one?
« Reply #124 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

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

Page created in 0.111 seconds with 23 queries.