* 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 register on the forum first then follow the forum link to our membership form which is on our website


For further details of any events shown here also see the "Shows and Events" section on the forum

Let us know of your plans for 2018 and we will promote them on this Forum

.

, Papplewick Pumping Station Easter Sunday & Monday 1,2 April 2018

.

. .

.Norwich MBC Weekend 28,29 July 2018

.

.

,The Model Show,Poynton, Stockport (with swimming pool) 15,16th September 2018

Who is online?

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

None


Most users ever online was 37 on Sun Mar 13, 2011 11:27 am

Statistics

Our users have posted a total of 10398 messages in 1691 subjects

We have 739 registered users

The newest registered user is paulstel


    PIC and Arduino microprocessors

    Share
    avatar
    david f
    AMS Treasurer

    Posts : 1920
    Join date : 2010-11-10
    Age : 67
    Location : Cumbria

    Re: PIC and Arduino microprocessors

    Post  david f on 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
    avatar
    david f
    AMS Treasurer

    Posts : 1920
    Join date : 2010-11-10
    Age : 67
    Location : Cumbria

    Re: PIC and Arduino microprocessors

    Post  david f on 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!

    tsenecal
    Guest

    Posts : 88
    Join date : 2015-04-01

    Re: PIC and Arduino microprocessors

    Post  tsenecal on 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
    avatar
    david f
    AMS Treasurer

    Posts : 1920
    Join date : 2010-11-10
    Age : 67
    Location : Cumbria

    Re: PIC and Arduino microprocessors

    Post  david f on 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
    avatar
    John Wrennall
    AMS member

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

    Re: PIC and Arduino microprocessors

    Post  John Wrennall on 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

    timgarrod
    AMS Website Webmaster

    Posts : 179
    Join date : 2013-04-23
    Age : 37

    Re: PIC and Arduino microprocessors

    Post  timgarrod on 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.

    avatar
    david f
    AMS Treasurer

    Posts : 1920
    Join date : 2010-11-10
    Age : 67
    Location : Cumbria

    Re: PIC and Arduino microprocessors

    Post  david f on 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
    avatar
    John Wrennall
    AMS member

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

    Re: PIC and Arduino microprocessors

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

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

    John

    Sponsored content

    Re: PIC and Arduino microprocessors

    Post  Sponsored content


      Current date/time is Sun Dec 17, 2017 11:18 pm