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.

Who is online?

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

None


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

Latest topics

Statistics

Our users have posted a total of 11475 messages in 1887 subjects

We have 935 registered users

The newest registered user is geofrancis

+2
Tom(ADMIN)
david f
6 posters

    LEVEL CONTROLLER DIY

    david f
    david f
    AMS Treasurer

    Posts : 2187
    Join date : 2010-11-10
    Age : 71
    Location : Cumbria

    LEVEL CONTROLLER DIY Empty LEVEL CONTROLLER DIY

    Post  david f Fri Feb 04, 2011 10:19 am

    LEVEL CONTROLLER DIY Image210

    I sent this for discussion with fellow AMS members Alf and Paul last summer to see what they might come up with. Paul has just contacted me with his encouraging findings. He has used the accelerometer chip in combination with his design oiginally published in the mag. He tackled the tricky SMD soldering without any problems, seemingly. The original note follows and I will put some photos and details from Paul up later today:

    (Note to Brian - maybe time for another magazine article!)

    DIY Level Controller – David Forrest, June 2010
    OVERVIEW
    This is quite a simple circuit really with few components. The main issue is the soldering of an SMD (Surface Mount Device) accelerometer chip.
    The complete prototype unit does work nicely (See the video of my Charlie 2 class sub at high speed at ALFOLD on Facebook.)
    The unit contains the following stages:
    Accelerometer chip – produces a small voltage (~0.1 v) in response to tilting the device.
    Amplifier (op-amp) to boost the level signal from 0.1v to about 0.5 to 4.5 volts.
    PIC microprocessor combines the signal from the receiver with the level signal to give an output to the elevator servo.
    + a voltage regulator to give about 3v for the accel chip supply.
    The PIC takes its reference voltage from the supply so it needs a fairly “clean” voltage from a BEC. (If the supply is noisy you can try capacitors, chokes and ferrite rings or all of them to clean it up.)
    COSTS (I used Farnell for supply)
    Accel chip £3.50
    Voltage reg ~£1.50
    Op amp ~£2
    PIC pre-programmed from AMS £5
    ALTERNATIVE COMPONENTS
    You can get a nice breakout boarded accel chip on ebay for about £10. I haven’t tried it but I enclose the data sheet. Useful if SMD devices are frightening.
    The TLV2451 is one I had available but probably any good quality “rail to rail” op amp designed for battery supply would do.
    Resistor values may need tweaking. To change the gain of the op amp change R6. If the output voltage stays at about 5v change the voltage divider resistors R2, R5. One or two variable resistors are a possibility.
    Capacitors are mainly to decouple the chip supplies so keep them close to the chips.
    I used stripboard (See photo)
    MAIN CHALLENGES
    Soldering the SMD accel chip. I stuck the chip on its back and wired it up with fine copper stands taken from screened cable. (See top LHS of photo – its small!)
    Perhaps you could make up a little board and reflow it. If so how about selling some?
    Do make sure that you connect the “sleep” pin 7 to +3v. That foxed me for a day or two and I had to retrieve the chip from the bin!
    SUMMARY
    A challenging project because of the SMD. I suggest that you get the front end (up to the PIC) working before you buy the PIC)
    Let me know how you get on!

    David


    Partlist exported from C:/Users/David/Desktop/Level Controller/level.sch at 2/4/2011 9:55:46 AM

    Part Value Device Package Description
    ACCEL-PIN-1 LSP10 LSP10 LSP10 SOLDER PAD drill 1.0 mm, distributor Buerklin, 12H555
    ACCEL-PIN-2 LSP10 LSP10 LSP10 SOLDER PAD drill 1.0 mm, distributor Buerklin, 12H555
    ACCEL-PIN-6,7 LSP10 LSP10 LSP10 SOLDER PAD drill 1.0 mm, distributor Buerklin, 12H555
    C1 0.1mF C5/2.5 C5B2.5 CAPACITOR
    C2 0.1mF C5/2.5 C5B2.5 CAPACITOR
    C3 0.1mF C5/2.5 C5B2.5 CAPACITOR
    C4 0.1mF C5/2.5 C5B2.5 CAPACITOR
    C5 0.1mF C5/2.5 C5B2.5 CAPACITOR
    FROM-RECVR LSP10 LSP10 LSP10 SOLDER PAD drill 1.0 mm, distributor Buerklin, 12H555
    IC1-TLV2451 DIL8 DIL08 Dual In Line / Socket
    IC3-PIC12F675 DIL8 DIL08 Dual In Line / Socket
    R1 1.75k R-EU_0309/10 0309/10 RESISTOR, European symbol
    R2 62 R-EU_0309/10 0309/10 RESISTOR, European symbol
    R3 1k R-EU_0309/10 0309/10 RESISTOR, European symbol
    R4 4.7k R-EU_0309/10 0309/10 RESISTOR, European symbol
    R5 62 R-EU_0309/10 0309/10 RESISTOR, European symbol
    R6 200k R-EU_0309/10 0309/10 RESISTOR, European symbol
    TO-ELEVATOR-SERVO LSP10 LSP10 LSP10 SOLDER PAD drill 1.0 mm, distributor Buerklin, 12H555
    V-REG-3V LM317L 317L VOLTAGE REGULATOR


    Last edited by david forrest on Fri Feb 04, 2011 10:25 am; edited 1 time in total (Reason for editing : better resolution on circuit diagram)
    avatar
    Tom(ADMIN)
    AMS Forum Owner

    Posts : 3004
    Join date : 2010-11-05
    Age : 61
    Location : Nevada, USA

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  Tom(ADMIN) Fri Feb 04, 2011 11:00 am

    Maybe someone with electronical knowledge could assemble these for sale to members? I can't make any sense of the diagram, let alone understand the assembly instructions, and I'm sure there's many like me who struggle with electronics in any shape or form, and who would be first in the queue to buy one.

    As with everything nowadays, the price would be the controlling factor. I had a word with Ron Perrott recently about buying a fully assembled SALCON, he quoted £35 for one ready to go, so I guess that would be a start price?

    Do we have anyone who would be interested in making them to order?
    david f
    david f
    AMS Treasurer

    Posts : 2187
    Join date : 2010-11-10
    Age : 71
    Location : Cumbria

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  david f Fri Feb 04, 2011 12:16 pm

    LEVEL CONTROLLER DIY Paul_b10

    This is Paul B's circuit, as promised, note the accelerometer chip ( and its little connections!) on the top RHS.

    He reports that the chip I originally specified has been discontinued and he used a LIS302G from RS and this uses 6v , which is good. He says that the board uses 20mA - twice his original circuit but is very stable and an improvement.

    Good news!

    He now wants to try the PIC chip with it from the AMS.

    We will give more on all this in the (next?) magazine.
    alf
    alf
    Guest

    Posts : 16
    Join date : 2010-11-10
    Age : 73
    Location : Teddington Middlesex

    LEVEL CONTROLLER DIY Empty level.com

    Post  alf Sun Feb 06, 2011 3:20 am

    hi dave thanks for info on mxa2500g/m it looks good to me i will look in to pcb.layout i got pics level 1
    Wheelerdealer(Ramesh)
    Wheelerdealer(Ramesh)
    Guest

    Posts : 33
    Join date : 2010-11-06
    Age : 47
    Location : London

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  Wheelerdealer(Ramesh) Sun Feb 06, 2011 5:57 pm

    I am using the excellent new Micro Gyro pitch controllers http://www.microgyros.com/index.html
    Costs from just £17 built and deliveved.
    The bit I like the most is you can make all the adjustment (sensitivity, response time, level set etc) on the fly from the transmitter whilst the sub is in the pool. Works when going astern too.



    LEVEL CONTROLLER DIY 4ff75ae9


    Last edited by Wheelerdealer(Ramesh) on Sun Feb 06, 2011 7:33 pm; edited 1 time in total
    avatar
    Tom(ADMIN)
    AMS Forum Owner

    Posts : 3004
    Join date : 2010-11-05
    Age : 61
    Location : Nevada, USA

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  Tom(ADMIN) Sun Feb 06, 2011 7:00 pm

    Hmm..that's interesting Ramesh, the MicroGyros leveller does seem to work well, very impressive piece of hardware. I was going to get a SALCON from Ron Perrott for the LA, but this one seems a far better piece of kit, plus it's half the cost.

    Does it matter where it's installed in the WTC...and does it need to be level on the tech tray? I'm guessing the answer to the last question is 'yes'....?
    Wheelerdealer(Ramesh)
    Wheelerdealer(Ramesh)
    Guest

    Posts : 33
    Join date : 2010-11-06
    Age : 47
    Location : London

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  Wheelerdealer(Ramesh) Sun Feb 06, 2011 7:13 pm

    Richard(Admin) wrote:Hmm..that's interesting Ramesh, the MicroGyros leveller does seem to work well, very impressive piece of hardware. I was going to get a SALCON from Ron Perrott for the LA, but this one seems a far better piece of kit, plus it's half the cost.

    Does it matter where it's installed in the WTC...and does it need to be level on the tech tray? I'm guessing the answer to the last question is 'yes'....?

    No you can instal it anyway you like and just press a button to set the level. If you have a spare channel you can even set the level from the Tx when the sub is in the water and trimmed out correct.
    avatar
    Tom(ADMIN)
    AMS Forum Owner

    Posts : 3004
    Join date : 2010-11-05
    Age : 61
    Location : Nevada, USA

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  Tom(ADMIN) Sun Feb 06, 2011 7:16 pm

    That's amazing...I think I'll go for the MG one over the SALCON, sounds a much better bet (hope Ron doesn't read this)

    Thanks Ramesh...
    david f
    david f
    AMS Treasurer

    Posts : 2187
    Join date : 2010-11-10
    Age : 71
    Location : Cumbria

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  david f Mon Feb 07, 2011 3:20 pm

    If you want a commercial product they are certainly a good way to go. I know a lot of people who use them.
    david f
    david f
    AMS Treasurer

    Posts : 2187
    Join date : 2010-11-10
    Age : 71
    Location : Cumbria

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  david f Tue Feb 23, 2021 12:39 pm

    Seemed worth an update on this from 2011 !

    For commercial offers I think Tim Garrod is still offering one.

    I was recently doing a "lock down play around" with the ADXL345 accelerometer chip and I was really impressed by it. The i2c interface makes it a doddle to use compared with the earlier chips.

    Some very simple code if you are interested ( also on my Github https://github.com/rdforrest )


    // Very useful guide to ADXL345 for use as level sensor with Nano:
    // https://www.best-microcontroller-projects.com/adxl345.html
    // By John Main © best-microcontroller-projects.com
    // This sketch outputs serial data as 2 parameters (roll and pitch)
    // for display in processing code on PC.
    // Outputs roll value to servo on D5

    #include "math.h"
    #include "Wire.h"
    #include "I2Cdev.h"
    #include "ADXL345.h"
    #include <Servo.h>

    Servo myservo; // create servo object to control a servo
    //Servo servo1;
    int pos; // Servo postion
    #define LED_PIN LED_BUILTIN
    // Macros to allow 0 ~ 180 mapped to -90 to 90

    ADXL345 accel;

    bool blinkState = false;

    void setup() {

    Wire.begin();
    Serial.begin(9600);

    myservo.attach(5); // attaches the servo on a pin to the servo object. Using pin 4 gives jitter problems.

    accel.initialize();

    accel.setRate(ADXL345_RATE_100); // This is default but shows the value.
    accel.setFullResolution(1); // 0 => 10 bit mode.
    accel.setLowPowerEnabled(0);
    accel.setRange(0); // 0 => 2g, 3 => 16g

    pinMode(LED_PIN, OUTPUT);
    }

    void loop() {
    float r, x, y, z;
    int16_t ax, ay, az;

    // Datasheet: OPERATION AT VOLTAGES OTHER THAN 2.5 V
    // 3v3 X,Y 25mg too high, z 20mg too low
    // 3V3 lsb value 265/g c (g/265)=0.03698
    // 2V5 lsb value 256/g (g/256)=0.03828 z axis unaffected by voltage supply.
    #define ADXL345_LSBVAL_3V3 3.698E-3
    #define ADXL345_LSBVAL_2V5 3.828E-3

    accel.getAcceleration(&ax, &ay, &az);
    x = ax * ADXL345_LSBVAL_3V3 - 25E-3;
    y = ay * ADXL345_LSBVAL_3V3 - 25E-3;
    z = az * ADXL345_LSBVAL_2V5 + 20e-3;

    r = sqrt(x * x + y * y + z * z);
    // Angle from x,y axis to gravity vector.
    int roll = 180 / M_PI * ( M_PI / 2 - (acos(y / r) ) );
    int pitch = 180 / M_PI * ( M_PI / 2 - (acos(x / r) ) );

    Serial.print(roll); Serial.print(' ');
    Serial.print(pitch); Serial.print(' ');
    Serial.print('\n');

    // servo.writes to (pos);
    pos = pitch + 90; // Adjust servo output
    Serial.print("Servo output""\t"); //tab
    Serial.print(pos);
    Serial.print('\n'); // New line
    myservo.write(pos);
    delay(15); // waits for the servo to get there

    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
    delay(50);
    }
    avatar
    timgarrod
    AMS Website Webmaster

    Posts : 253
    Join date : 2013-04-23
    Age : 41

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  timgarrod Wed Apr 07, 2021 6:13 pm

    Hi David,

    Cheers yea still making them :)

    Mk 3 will be out soon with alot of new functions. so there will be two version budget and more expensive version if needed.


    Cheers

    avatar
    tsenecal
    Guest

    Posts : 157
    Join date : 2015-04-01

    LEVEL CONTROLLER DIY Empty Re: LEVEL CONTROLLER DIY

    Post  tsenecal Thu Apr 08, 2021 12:36 am

    i don't know how i missed your feb 23 post... but looking at trying my hand at making one of these... i ran across this:

    https://www.adafruit.com/product/4097

    significance being it is supposed to be a plug and play swap for the adxl345, but it is 1/3 the price (at adafruit breakout pricing)

    https://www.adafruit.com/product/1231

    david f likes this post


      Current date/time is Fri Oct 22, 2021 7:59 am