The Association of Model Submariners.

Would you like to react to this message? Create an account in a few clicks or log in to continue.

* THE FORUM FOR ALL THOSE INTERESTED IN BUILDING AND OPERATING MODEL SUBMARINES *



Join the AMS - Registered Forum users can become members of the AMS and it's free ...... To join send an email with your name , address and phone number to amstreasure@googlemail.com


For a guide to past events see the "Shows and Events" section.

Papplewick Pumping Station SUBMARINE Day. 31st March - 1st April 2024.

$$$

&&&

::::

Who is online?

In total there are 7 users online :: 0 Registered, 0 Hidden and 7 Guests

None


Most users ever online was 180 on Tue Nov 05, 2019 6:03 am

Latest topics

» Information on camouflage patterns for German seahund
PIC and Arduino microprocessors - Page 4 EmptyFri Mar 15, 2024 4:36 pm by david f

» WW2 mini sub build
PIC and Arduino microprocessors - Page 4 EmptyTue Mar 12, 2024 1:56 pm by geofrancis

» Not the hobby I expected :)
PIC and Arduino microprocessors - Page 4 EmptySun Mar 10, 2024 6:30 pm by cat

» 868/915 Mhz as a viable frequency for submarines.
PIC and Arduino microprocessors - Page 4 EmptyWed Mar 06, 2024 4:50 pm by tsenecal

» Sheerline gasket material
PIC and Arduino microprocessors - Page 4 EmptyMon Feb 19, 2024 9:24 pm by Michaelc

» Choice of CAD software and Printer for 3D printing
PIC and Arduino microprocessors - Page 4 EmptyThu Feb 15, 2024 1:53 pm by david f

» Engel Nautlus
PIC and Arduino microprocessors - Page 4 EmptyTue Feb 13, 2024 9:15 am by palmert6

» RF 27/433MHz maximum depth in pools (1-5 ppm chlorine, 6-8pH)
PIC and Arduino microprocessors - Page 4 EmptyThu Feb 08, 2024 2:05 pm by david f

» Arduino proportional control of a piston tank
PIC and Arduino microprocessors - Page 4 EmptyThu Feb 08, 2024 1:37 pm by david f

Statistics

Our users have posted a total of 12425 messages in 1980 subjects

We have 1003 registered users

The newest registered user is Stefan Udovenko КПДЮ

+6
tsenecal
profesorul
John Wrennall
bwi
Harry.Brash
david f
10 posters

    PIC and Arduino microprocessors

    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Sat Jan 14, 2017 2:28 pm

    Hi All, John and John,

    I'm interested that you have had the same experience with stepper motors - so not enough torque.

    Although in general terms I wouldn't believe everything you read on the internet. (A whole lot of fibbing going on in various other places!)

    It is a good time of year (in the Northern hemisphere anyway, 6 deg C outside) to get going with Arduinos again.

    If you are using the, rather useful, 16 x 2 lcd displays could I recommend these. I have just ordered and tested a batch of 6 from eBay:

    1.5'' Blue IIC I2C TWI 1602 16x2 Serial LCD Module Display for Arduino  New LU
    ( 192012748949 )

    About £2 each.

    These are serial (i2c) connected ones so only 2 signal connectors rather than the usual "tangle."

    I give a sketch for a temperature/humidity display because it mentions the lcd library to use and also a useful comment about lcd addresses. (They seem to be randomly provided.)

    /* YourDuino.com Example Software Sketch
    16 character 2 line I2C Display
    Backpack Interface labelled "A0 A1 A2" at lower right.
    ..and
    Backpack Interface labelled "YwRobot Arduino LCM1602 IIC V1"
    MOST use address 0x27, a FEW use 0x3F
    terry@yourduino.com */

    /*-----( Import needed libraries )-----*/
    //David's note look at: https://arduino-info.wikispaces.com/LCD-Blue-I2C#v1
    #include <Wire.h> // Comes with Arduino IDE
    // Get the LCD I2C Library here:
    // https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
    // Move any other LCD libraries to another folder or delete them
    // See Library "Docs" folder for possible commands etc.
    #include <LiquidCrystal_I2C.h>
    #include "DHT.h"
    #define DHTPIN 2 // what pin we're connected to

    #define DHTTYPE DHT11 // DHT 11

    DHT dht(DHTPIN, DHTTYPE, 30);

    /*-----( Declare Constants )-----*/
    /*-----( Declare objects )-----*/
    // set the LCD address to 0x27 for a 16 chars 2 line display
    // A FEW use address 0x3F
    // Set the pins on the I2C chip used for LCD connections:
    // addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
    LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
    //LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
    /*-----( Declare Variables )-----*/
    //NONE

    void setup() /*----( SETUP: RUNS ONCE )----*/
    {
    Serial.begin(9600); // Used to type in characters
    Serial.println("DHTxx test!");
    dht.begin();

    lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight

    // ------- Quick 3 blinks of backlight -------------
    for(int i = 0; i< 3; i++)
    {
    lcd.backlight();
    delay(250);
    lcd.noBacklight();
    delay(250);
    }
    lcd.backlight(); // finish with backlight on

    //-------- Write characters on the display ------------------
    // NOTE: Cursor Position: (CHAR, LINE) start at 0
    lcd.setCursor(0,0); //Start at character 4 on line 0
    lcd.print("Hello, world!");

    lcd.setCursor(0,1);


    delay(6000);



    }/*--(end setup )---*/



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

    // Wait a few seconds between measurements.
    delay(2000);

    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();
    // Read temperature as Fahrenheit (isFahrenheit = true)
    float f = dht.readTemperature(true);

    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
    }

    // Compute heat index in Fahrenheit (the default)
    float hif = dht.computeHeatIndex(f, h);
    // Compute heat index in Celsius (isFahreheit = false)
    float hic = dht.computeHeatIndex(t, h, false);

    Serial.print("Humidity: ");
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: ");
    Serial.print(t);
    Serial.print(" *C ");
    Serial.print(f);
    Serial.print(" *F\t");
    Serial.print("Heat index: ");
    Serial.print(hic);
    Serial.print(" *C ");
    Serial.print(hif);
    Serial.println(" *F");


    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Harmony Hill");
    delay(2000);
    lcd.clear();

    lcd.setCursor(0,0);
    lcd.print("Temp & Humidity");
    delay(2000);
    lcd.clear();

    lcd.setCursor(0,0);
    lcd.print(t);
    delay(2000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(h);

    }

    //* --(end main loop )-- */


    /* ( THE END ) */

    David
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Mon Jan 23, 2017 2:01 pm

    Just a little note for those "Arduino nuts" out there who I know are following the Everyday Practical Electronics, Arduino series.

    I have recently got an  Espduino working (Arduino with WiFi) on the IoT (Internet of Things) purchased from eBay on here:

    ESP8266 ESP-13 WIFI Development Board Module For ESPDuino Arduino UNO R3
    ( 401126351850 ) (From alice1101983)

    This refers to Part 12 in the series in the January 2017 issue.

    I initially had problems uploading sketches until I found that having the DHT-11 temperature and humidity sensor connected created errors (No idea why!?)

    I'm afraid I can't see any model submarine uses for the IoT and even the domestic use seems limited. (Do we really need to log our room temperature from anywhere in the world?!)

    On the sub front, Tim Senecal's telemetry proved it's worth at Barrow pond the other Sunday. I thought I'd lost my sub when I couldn't see it (glare from winter sunshine.) But the depth indicator said zero and of course there it was on the surface!
    avatar
    tsenecal
    Guest


    Posts : 305
    Join date : 2015-04-01

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  tsenecal Tue Jan 24, 2017 6:15 pm

    David,

    this is very odd... based on the info i have been able to see, the DHT-11 is basically a dumb device...  i am wondering if there is something else going on with how you were polling the DHT-11 that was causing trouble.

    on another topic, i have been basically taking a sabbatical from r/c for the last few months...  somewhat...   although i have kept up on some things, others have dropped off..  i haven't touched a submarine since august, for example...

    but, i did do a couple things, that i have video taped, so here are a couple arduino related youtube links...

    a two channel "expander" that will allow two 3-position switches on your transmitter to activate/de-activate 4 servo based switches independently:
    https://www.youtube.com/watch?v=WFS6oWq_k5Q
    https://www.youtube.com/watch?v=usOm3Nf-be4

    a single $2-$4 arduino pro micro (depending on where you buy it) running 8 servos - a DIY robbe/futaba F series multi-prop decoder:
    https://www.youtube.com/watch?v=e43NpJ262sg

    I am wondering what everyone else uses to "store" their code?  are we going to just keep posting in the content of these threads? or should we try to create something more formal for an archive of the code and associated data for these sketches?


    I am also toying around with one of these:
    http://ar9x.net/index.php?route=product/product&product_id=57

    it is basically a full-blown 16/32 channel transmitter motherboard built, ready to have gimbals and switches soldered to it, capable of running all our wonderful toys, just like the latest and greatest radios...  I decided that the existing crop of high-end radios work 90% of what i want them to do, but i am willing to DIY an entire radio to get something that works 100% for me.

    i found the AR9x after "upgrading" a couple Turnigy 9x transmitters with this: http://ar9x.net/index.php?route=product/product&path=25&product_id=50  which basically upgrades a Turnigy 9x to about 95% of what a Taranis x9d can do...  including working with the 433mhz modules, and telemetry from those modules/receivers.  for a grand total of $80 each, since i bought both Turnigy 9x radios used on ebay for $40 a piece...

    https://www.youtube.com/watch?v=hq2THgZzmSw
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Thu Feb 02, 2017 4:44 pm

    I have just been repeating my DHT 11 sketch uploads with the same (perplexing!) result. You have to disconnect the +5v input to the DHT-11 sensor to upload the sketch. The DHT 11 device is not completely dumb it puts out a digital signal.

    Tim and any others. What are you thinking of with regard to posting software?

    You are very welcome to post files etc. on here:

    http://associationofmodelsubmariners.com/pages/software.html

    The Webmaster would have to post them for you.

    Or were you thinking of a GiThub section?(I don't know much about this.)

    (BTW That new Taranis RX looks just the job!)

    David
    John Wrennall
    John Wrennall
    AMS member


    Posts : 157
    Join date : 2011-11-16
    Age : 77
    Location : Leyland

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  John Wrennall Sun Feb 19, 2017 12:33 pm

    Hi all

    Just a thought for those using Hall effect switches with arduinos and piston tanks, it seems to me that the software for this has to measure and convert pulses to determine position.

    Optional suggestion which I've not seen anywhere else:-
    Not tried this (yet) but has no-one considered attaching a 10 turn potentiometer via a suitably calculated gear to the piston gear train. This will give a voltage directly proportional to the piston position to feed to the one of the arduino's analogue inputs. This signal could then be mapped as per the receiver signal so that a simple subtraction/comparison would provide a differential signal, the value of the difference determining the pulse rate required to send to the piston motor (large difference = fast piston travel, ditto medium etc and very small difference (for system hysteresis)giving motor stop. This should give a nice leisurely dive control for gentle Tx movements but retain the option for a faster "crash dive". Probably better to use a rotary pot TX channel rather than a joystick for safety.

    Duplicating the installation if your boat uses twin tanks should be straightforward although the front tank speeds(pulse rates) could be programmed as faster than those for the rear tank to give the impression of all those little men inside dashing to the front.....

    Hope this provides food for thought .

    John
    avatar
    timgarrod
    AMS Website Webmaster


    Posts : 259
    Join date : 2013-04-23
    Age : 43

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  timgarrod Sun Feb 26, 2017 9:32 pm

    Really got into the Arduino bug now and don't know I lived with out one :)

    so far I got my Robbe 8 ch multi switch work working with it just finising fitting it in my boat.
    now started on replacing the blown TT Neptune control board. very early days but got the relay wired up and working, think i got the presure switch working was it should. Just got to figure out the low voltage and fail safe part.

    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Sat Mar 04, 2017 11:55 am

    Glad you have the Arduino bug, Tim! I haven't had much time yet to check out the new site you have mentioned but I have registered.

    John. Multi turn pots should be OK. I think that Nigel and John R have talked about it. My view is that a pot is still a pot though! Not as reliable as, say, a completely sealed Hall switch and magnet. (Although I had "hot melt adhesive failure" on my sub last month and the magnet fell off!)

    Also a Hall switch gives a nice, clean pulsed output (debounce is taken care of internally ). It's already digital, if you see what I mean.

    David
    John Wrennall
    John Wrennall
    AMS member


    Posts : 157
    Join date : 2011-11-16
    Age : 77
    Location : Leyland

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  John Wrennall Wed Mar 15, 2017 9:45 pm

    David.
    Just bought some Hall switches for my next "Playtime"

    John
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Thu Oct 04, 2018 9:30 am

    The nights are creeping in so time to have a look at Arduinos again.

    I'm having another look at the lsm303 compass modules from Pololu. I have never got them to work well in a submarine (stray magnetic fields??)

    John W has got one working nicely on a surface boat - demonstrated at the Barrow Regatta.

    I'm maybe looking to having it feeding into it's own Arduino which then sends the heading to the Telemetry one by an i2c link.

    I have also just received a Neo-7M gps module from China. Only working into a laptop so far through a UART USB link but it seems to work well and I have located Milnthorpe!

    I know they don't work underwater but they now cost less than £10!

    David
    avatar
    tsenecal
    Guest


    Posts : 305
    Join date : 2015-04-01

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  tsenecal Fri Oct 05, 2018 8:32 pm

    David,

    two suggestions...


    1) does the lsm303 work correctly when you have it running on the workbench? if yes, then, yep, i guess something is causing problems in the sub.

    2) if the gps is used in a submarine, how long will it take for it to lock onto satellites? if its fast enough, why not use it? you can get a corrected location every time you surface, and use speed and heading to fake the data while submerged. I know some of the GPS devices have some sort of accelerated connection method.


    lastly... i love pololu, wouldn't have the geeky toys i have without it. i love their r/c switches, they are incredibly inexpensive, and work fantastically.

    i also love their A-Star 32U4 Micro. it is the reason i am having all the trouble adapting your arduino ballast tank controller. the code as it exists won't compile. (timer 2 problems)
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Tue Oct 09, 2018 3:31 pm

    The compass module did give intermittent results in the sub - so presumably stray magnetic fields.
    I intend to try the module outside the wtc more or less "on deck" with it's own Arduino and send the signal via a short cable using i2c. (Oddly I note that some pre-world war 1 subs had external compass binnacles. I think they could read it with the periscope to avoid getting wet!)

    I've got the Arduino software working reliably on the bench and sending data from one Arduino to the "main" telemetry Arduino. I've hit a snag in that the data prints out using the serial data but I haven't got anything back to the transmitter yet using an early version of your telemetry data, Tim. Does the FrSky LCD require data in a particular form?? (I'm trying integer.)

    I am very impressed with the price/performance of the Neo-7M GPS module. It works feeding a laptop and now an Arduino (running TinyGPS++)  It gives a position in about 30 seconds out in the street and after startup will work indoors. But the very accurate clock could also be very useful. (I'm thinking about sound triangulation.) Yes, I suppose at the very least the GPS units could give a "last known position" etc.!

    I'm interested that you are using a different 32U4 micro. Is this because of its smaller size or performance?

    David
    avatar
    tsenecal
    Guest


    Posts : 305
    Join date : 2015-04-01

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  tsenecal Wed Oct 10, 2018 3:34 am

    david f wrote:...But the very accurate clock could also be very useful.

    ...I'm interested that you are using a different 32U4 micro. Is this because of its smaller size or performance?

    David


    I hadn't even thought of using the high precision clock of the GPS data stream... many interesting possibilities there.

    as to why/what the 32u4 brings to the table... built in usb primarily, no need to go fishing around with an FTDI board to update or "program" different things. instead of having switches of some sort taking up space for setting paramaters, i plug in a micro usb cable, open either the arduino IDE or a terminal program connected to the arduino's com port, and set the parameters using a human readable menu. the extremely tiny size of the pololu A-star 32u4 micro also makes it extremely handy.
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Fri Oct 26, 2018 10:49 am

    Just an update on GPS modules.

    I've just received a  VK2828U7G5LF  GPS module from China (via ebay!) and it worked straight out of the box with the same connections and setup as  Neo-7 GPS module. Slightly cheaper at about £7 and more compact with the very useful 1 second clock output more easily accessible.

    I am using the Tiny GPS++ software with a nano and a 16x2 LCD display.

    (The earlier problems getting compass data through to the Transmitter via Telemetry are now solved (by converting characters to integers).

    Now about time to get the stuff out on the water using the CSS Pioneer as a test bed!

    David
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Thu Jun 25, 2020 2:21 pm

    Hi All,

    I have just been having a go at PICs again (MPLAB X IDE, Pickit 3 programmer and a 12f683 programmed in C) and it is driving me mad!

    One programming attempt in 10 seems to work. Various error messages:

    "Target has invalid calibration data (0x00)."
    "Wrong voltage."
    "Wrong type." etc etc.


    I can see why I moved to the Arduino!  "Lock-down" with time on my hands is a plus but development is still a slow process. (Days go by!)

    I am trying to make the Ultrasonic Pinger smaller and less power consuming and PICs look good for this.

    The problem with the PIC is too many processors and too many options.

    If any one has any surefire methods of PIC programming let us all know.

    David

    Later edit: Curiouser and curiouser, Programming works absolutely fine with all my 16 and 18f devices but not the 12f683, 12f629 and a (newly delivered) 12f1501. (The 8 pin devices I want to use!)
    Later Later edit(27/6/2020): Some fairly old 16f88 devices are programming just fine so I will stick with them for the development. Reasonably small even though they have 18 pins rather than 8. So it seems that the latest Microchip X ide software has problems with the 12f (legacy?) devices
    Final Edit(29/6/2020): Developed the new software for the Pinger in C on the 16f88 but it didn't offer any advantage over the Arduino with a current draw of,still, about 18mA. Before putting the programmer away I tried the 12f683 and 12f1501 and they programmed fine! Sometimes programming seems to be in the lap of the gods!
    david f
    david f
    AMS Treasurer


    Posts : 2395
    Join date : 2010-11-10
    Age : 73
    Location : Cumbria

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  david f Sat Jul 04, 2020 11:57 am

    Actually one final contribution to this thread. I have found out how to program the legacy PICs. You need to erase the memory first. Using the "Erase Device Memory" command which is hidden away in the Toolbars.

    This is one of the problems with the PIC as compared with the Arduino. They are used much more by professionals, I think, and so have many more options. The net result is that you can struggle away for weeks as opposed to days with the Arduino!

    David
    avatar
    timgarrod
    AMS Website Webmaster


    Posts : 259
    Join date : 2013-04-23
    Age : 43

    PIC and Arduino microprocessors - Page 4 Empty Re: PIC and Arduino microprocessors

    Post  timgarrod Thu Jul 09, 2020 10:59 pm

    I'm now looking into PIC's :(

    david f likes this post


      Current date/time is Tue Mar 19, 2024 8:20 am