Menu

Bluetooth connection

2024-08-07
2024-08-17
  • Klaus-Peter Kuehne

    Hi!
    I already build your MyDewController and I'm thrilled!!!! Since my USB ports are very limited I was happy to connect the dew controller by using the Bluetooth module HC-05 to connect to the PC. Can I also add the HC-05 to the myRotator layout/PCB and run the Arduino/WIN SW - ordo I have to adapt the sketch?
    Thanks
    Klaus

     
  • brownrb

    brownrb - 2024-08-08

    Hi Klaus

    Not so easy as I thought. The below is fairly long, comparing myFP2 against myRotator comparing pin usage etc.

    Should be simple if using UL2003 of L298N, difficult using DRV8825.
    I have never tried using different pins for Software Serial other than the ones for myFP2 (d10-d11)
    so cannot say for sure if other pins work. I seem to recall that sw uses a group of 8 pins and would not work if the pins were not in the same PCINT group, this 0-7 and 8-13 meaning you cannot have D2 and D10 as they are not in the same PCINT group. Now I could have that totally wrong because this was wayback around 2014 and much has changed since then, as well as my memory of these things.

    Speed must be kept low at 9600 - I gave up around 57600bps

    I attahed a file instead. I gave up adding HC-05 Bluetooth to myRotator because I started looking at an ESP32 Wifi version instead.

    Oh, and 1 last thing. If you have some spare myFP2 PCB's lying around, it should be relatively simple to change the pins myRotator uses to match the myFP2 PCb and you would also get access to fit the BlueTooth at the same time.

    Regards
    Robert

     
    • Klaus-Peter Kuehne

       

      Hi Robert.

      Thank you for your immediate answer.

      This means that with a Bluetooth connection no change/alteration of the Arduino code/Windows SW would be necessary….

      The rotator will work the same as with the USB cable – as discribed in your myDewController pdf (sorry I’m not that comfortable with such Topics…😊)

       

      Regarding the PINs for the HC-05….. why not use the Arduino PINs RX0 and TX1 with a resistor divider (1k and 2k Bridge) on TX of the HC-05

      Hi Robert.

      Thank you for your immediate answer.

      This means that with a Bluetooth connection no change/alteration of the Arduino code/Windows SW would be necessary….

      The rotator will work the same as with the USB cable – as discribed in your myDewController pdf (sorry I’m not that comfortable with such Topics…😊)

       

      Regarding the PINs for the HC-05….. why not use the Arduino PINs RX0 and TX1 with a resistor divider (1k and 2k Bridge) on TX of the HC-05

      OR as the wiring on your dew heater controller were you used the PINs D12 and D13 with the resistor divider????

       

       

      o.k.! after I read the attached file I am aware of the issue with the DRV8825 (were PIN 12 is already in use) . As a consequence for me either using RX0 and TX1 OR using the UL2003 or L298N remains.

       

      Thank you again for your help.

      Best

      Klaus-P

       

      OR as the wiring on your dew heater controller were you used the PINs D12 and D13 with the resistor divider????

       

       

      o.k.! after I read the attached file I am aware of the issue with the DRV8825 (were PIN 12 is already in use) . As a consequence for me either using RX0 and TX1 OR using the UL2003 or L298N remains.

       

      Thank you again for your help.

      Best

      Klaus-P

       

       
      Gesendet: Donnerstag, 08. August 2024 um 13:25 Uhr
      Von: "brownrb" <brownrb@users.sourceforge.net>
      An: "[arduino-myrotator:discussion] " <general@discussion.arduino-myrotator.p.re.sourceforge.net>
      Betreff: [arduino-myrotator:discussion] Bluetooth connection

      Hi Klaus

      Not so easy as I thought. The below is fairly long, comparing myFP2 against myRotator comparing pin usage etc.

      Should be simple if using UL2003 of L298N, difficult using DRV8825.
      I have never tried using different pins for Software Serial other than the ones for myFP2 (d10-d11)
      so cannot say for sure if other pins work. I seem to recall that sw uses a group of 8 pins and would not work if the pins were not in the same PCINT group, this 0-7 and 8-13 meaning you cannot have D2 and D10 as they are not in the same PCINT group. Now I could have that totally wrong because this was wayback around 2014 and much has changed since then, as well as my memory of these things.

      Speed must be kept low at 9600 - I gave up around 57600bps

      I attahed a file instead. I gave up adding HC-05 Bluetooth to myRotator because I started looking at an ESP32 Wifi version instead.

      Oh, and 1 last thing. If you have some spare myFP2 PCB's lying around, it should be relatively simple to change the pins myRotator uses to match the myFP2 PCb and you would also get access to fit the BlueTooth at the same time.

      Regards
      Robert

      Attachments:


      Bluetooth connection


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/arduino-myrotator/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
       
  • brownrb

    brownrb - 2024-08-11

    Hi

    Why not use the Arduino PINs RX0 and TX1 with a resistor divider (1k and 2k Bridge) on TX of the HC-05

    Because those pins are used by the USB connection. to read and control the focuser. I am not sure using 3v3 on those pins are a good idea.

    This means that with a Bluetooth connection no change/alteration of the Arduino code/Windows SW would be necessary….

    The rotator code would need firmware changes to support bluetooth

    OR as the wiring on your dew heater controller were you used the PINs D12 and D13 with the resistor divider????

    Yes it has to use the resistors to drop the voltage 5v from the arduino transmit pin going to the receive pin on the HC05

    Regards
    Robert

    If you are wiring you own board, then you could change the pins to free up d10-d11 and use other pins for the motor etc.

    You reallu are stuck with those pins because I had so much trouble getting it working, and I try not to change things that I find work well

    Regards
    Robert

     
    • Klaus-Peter Kuehne

       
       

      Hi Robert!

      Since I’m a bloody beginner in respect to programming Arduino (honestly spoken -I have no idea 😊) I will stick with the USB-connection.

      I downloaded the Sketch – and it works (almost). However, there is the following issues…

      1. I cannot activate the home sensor. In the Windows application it says „true“ and „moving“ even though there is no movement at all. In the Sketch I type „:421#“ and it still tells „$0“ when I check with „:43#“.
      2. There is no change in speed no matter what I use (slow, medium or fast).....

       

      I can live with that but still I want to know what I’m doing wrong.

       

      May be there is a quick fix. I know that the Problem sit’s always in front of the PC 😊

       

      Best

      Klaus-P.

      Gesendet: Sonntag, 11. August 2024 um 16:58 Uhr
      Von: "brownrb" <brownrb@users.sourceforge.net>
      An: "[arduino-myrotator:discussion] " <general@discussion.arduino-myrotator.p.re.sourceforge.net>
      Betreff: [arduino-myrotator:discussion] Bluetooth connection

      Hi

      Why not use the Arduino PINs RX0 and TX1 with a resistor divider (1k and 2k Bridge) on TX of the HC-05

      Because those pins are used by the USB connection. to read and control the focuser. I am not sure using 3v3 on those pins are a good idea.

      This means that with a Bluetooth connection no change/alteration of the Arduino code/Windows SW would be necessary….

      The rotator code would need firmware changes to support bluetooth

      OR as the wiring on your dew heater controller were you used the PINs D12 and D13 with the resistor divider????

      Yes it has to use the resistors to drop the voltage 5v from the arduino transmit pin going to the receive pin on the HC05

      Regards
      Robert

      If you are wiring you own board, then you could change the pins to free up d10-d11 and use other pins for the motor etc.

      You reallu are stuck with those pins because I had so much trouble getting it working, and I try not to change things that I find work well

      Regards
      Robert


      Bluetooth connection


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/arduino-myrotator/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
       
      • brownrb

        brownrb - 2024-08-17

        Hi Klaus

        I cannot activate the home sensor. In the Windows application it says „true“ and „moving“ even though there is no movement at all. In the Sketch I type „:421#“ and it still tells „$0“ when I check with „:43#“.
        There is no change in speed no matter what I use (slow, medium or fast).....

        Home Switch
        I think there is a typo wrong there, Looking at the protocol

        :41# $int# Get Stepmode
        :42int# Set Stepmode
        :43# $byte# Read Home Sensor logic state (true, false)

        :42x is used to se the STEPMODE. so has nothing to do with the HPSW.

        The steps for the home switch HPSW are as follows
        Make sure it is installed and working. You can manually move the rotator so that the sensor is on the magnet

        :31# $byte# Get Home Sensor Enabled State
        :32byte# Set Home Sensor Enabled State to state(byte 0 | 1)
        Warning: Only do this if a home sensor has been added
        :43# $byte# Read Home Sensor logic state (true, false)

        First you must enable the HPSW
        :321#
        will enable the sensor

        To find out if the sensor is enabled use
        :31#
        which should return 1

        To find the state (open close) of the Home Switch use
        :43#
        which will return 1 if the switch is closed and 0 if the switch is open

        NOTE
        You can use the windows app to do all this.
        Connect to controller
        Click on the Settings tab
        Click Get button at top right of the tab
        If Enabled is unchecked after the Get updates the tab values, check the box for Enabled and then click Set

        Then repeat the Get button to see of the the HPSW gets enabled, and if that worked the checkbox will be checked. The value should be 1, indicating that the switch is closed (because you had already manually position the sensor over the magnet.

        If it says 0, it means that the switch is not closed, and you might need to move a fraction more either way, then click Get again to update the sensor reading. If you keep moving the position and cant seem to find home (value is always 0) then there is a problem with the switch or magnet or wiring.

        Motor Speed
        For speed, the motor speed delay is
        :16# $int# Get Motorspeed, 0 = Slow, 1 = Med, 2 = Fast
        :17int# Set MotorSpeed, 0 = Slow, 1 = Med, 2 = Fast

        :18# $long# Get MotorSpeed delay value, 1000 - 15000 microseconds, default = 4500
        :19long# Set MotorSpeed delay value

        You can check with the windows app
        When connected
        Click on the Motor Control tab

        Set the speed to fast
        Click Set to update the motor speed setting in the controller

        Click Get
        The motorspeed should say Fast

        try a move using one of the motor control buttons, like +500
        If moving too slow,
        Look at the motor delay value and decrease by 500, If the speed delay was 1600, type 1000. Then click Set
        If the motor was moving way too fast,then increase the value by 500. Then click Set

        It may take a number of iterations to get it set okay. By now you should have a good idea of how long it takes the motor to rotate 500 steps.

        Finally, click speed slow and then click Set
        Next try another move of +500 steps. And you should now see that slow is slower.

        There is only 1 motor speed delay value, The firmware derives the speed delay of slow and medium from the fast value.
        medium = fast * 2
        slow - fast * 2.5

        Let me know what happens,

        Regards
        Robert

         

Log in to post a comment.