Shop OBEX P1 Docs P2 Docs Learn Events
SPI SOLVED - Page 2 — Parallax Forums

SPI SOLVED

2456711

Comments

  • or if windows 10, just print it and select the "print to PDF" printer which will cause the image to be printed to a PDF you can directly upload.
  • PublisonPublison Posts: 12,366
    edited 2020-07-25 17:55
    Seems you might have used Eagle? Since it now is pay program people may not use it.
    Use this program. Select classic. A lot of people here use it. It's free.

    https://www.expresspcb.com/
  • bbrienbbrien Posts: 561
    edited 2020-07-25 18:56
    Used KICAD. Here's the schematic you asked for ,some of the pin numbers may not match the program, it is only a preliminary drawing.
  • to DigitalBob I checked the "st4" but the autoguider outputs a pulse which turns on the output pins just like using a switch instead of an opto-isolator in the input circuit.
  • You really don't need two prop flip modules for this project, however its not a big issue. We'll start with the push button controller flip. I see your using an Onan RV generator push button pendant for the hand control. Again no issue with that since your only using it for the push buttons and Led's. So what do you expect to see out of the hand controller prop? A 1 or a 0 sent out by a serial start for each button that is pressed. And what are you plugging into J2 that interfaces with the hand controller prop. On Flip two I'm guessing you are going to drive the motors with the PWM signal, and interface the ST-4 autoguider. Is this correct
  • bbrien wrote: »
    Used KICAD. Here's the schematic you asked for ,some of the pin numbers may not match the program, it is only a preliminary drawing.

    bbrien, this is a breakthrough.
    After countless posts, you have finally provided a schematic, and now we can see what is going on;

    I can see that your "Mount Brain" is the LX50 Control Panel with the PIC16C57 substituted by FLIP_2.

    I can see you use the 4 pin Handbox connector with FLIP_1 and 5 pushbuttons for your "Hand Control" to emulate the 5 button Meade LX50 handbox.

    From the coding posts, it seems that you elect to communicate between FLIP-1 and FLIP-2 by standard serial interface. That is fine, 5 buttons and two speed PWM values require a simple message protocol of a few bytes.
    You could do this as a simple parallel interface as well.

    I see you do not make use of the 8pin encoder connector or 6pin autoglider connector.

    I attach the LX50 Control Panel schematic as a reminder.

    I could never find the LX50 Handbox schematic, so I post the Op Manual, also as a reminder.

    Your problem is a common configuration - you are attempting to drive two brushed motors bi-directionally and at varying speeds through an H bridge chip using a hand controller.

    There are many documented robot examples and modules which you can leverage off.
  • Yes, finally, a schematic! It looks confusing with two separate circuits as one schematic. Normally you'd have one for each, plus one for the interconnection if need be. But with only 5 buttons and 4 leds I wonder why you needed another FLIP just for this. Sure, I'd use a small 50 cent chip and send it serially but then again it is just a easy to have a 6 way connector and combine the 4 leds and 5 buttons and then have the one flip run it.

    btw, to use a 6 way connector for a passive hand-controller circuit your would have a 220R or so pullup on the flip side and on the hand controller side this would connect to the switch with an led in parallel to ground. The initialized state of the I/O is a low output so the led is turned off so to read the switch you just float the pin momentarily then read the pin and turn the pin back into a low output. An open switch will be around 1.8V or more due to the led clamping voltage and that is above the P1 threshold. To turn an LED on you just float the pin so when you want to read it, you just read it as is without driving the pin. The software for this is very trivial and the hardware is even simpler.

  • I do use the auto guider port . in the test bed I use switches to emulate the signals from auto guider. My next question is when communicating between the two props and the terminal do I need two cogs and two FDSerials.
  • JonnyMacJonnyMac Posts: 9,159
    edited 2020-07-26 19:12
    Since you have refused to follow good advice given as words and code, I drew a picture.
    attempting_to_fix_stupidity.png
  • bbrien wrote: »
    My next question is when communicating between the two props and the terminal do I need two cogs and two FDSerials.

    You need to instances of of the serial driver if it's a single port driver.
    If you don't need high data rates on both lines at the same time, you could use one of the multi port serial drivers.

    I posted an example of using a serial bridge here. The serial bridge used two instances of FDS. The bridge would pass characters from one line to the other. It allowed me to listen in on serial exchanges between the computer and the SayIt module.
  • jonnymac; Is the remote that you show my hand controller or something else. I also run two motors and the two motors have to be controlled by the(remote) The serial monitor is only used for diagnostics.
  • Duane; I believe I will be wiring the two props together with a 4 conductor data cable about 5ft long . I'll only use the serial port for diagnostics during the initial development
  • I cam using a 4 conductor data cable about 5 ft long to connect the two props together and using the serial port for diagnostics only.How do I access the the serial receive buffer to send the values to the motors. The values range between 0 and 255.
  • When I get a chance I'll post my two prop serial. In your case I'd program my pushbutton control prop to send a number constant or string down the serial for each button north, south, etc. and program the led to blink if you have a in syn serial connection. In my two prop spin you can disconnect and reconnect the serial with no trouble. Even power prop 1 or prop 2 on and off and the serial with run again in syn. So the base prop or prop 2 I'd program the different pwm speeds and autoguider. You can code a ser.start pins 9,10 or any pin, then ser.stop and ser.start pins 30,31 in a loop. So you'll have PC terminal and prop to prop in one cog.
  • DigitalBob wrote: »
    When I get a chance I'll post my two prop serial.
    In your case I'd program
    . . . my pushbutton control prop to send a number constant or string down the serial for each button north, south, etc.
    . . . and program the led to blink if you have a in syn serial connection.

    DigitalBob, thank you for having the courage and commitment to step in and help.

    HAND CONTROLLER

    Before you start coding, please could I suggest that you read the hand controller operating instruction from a post above.
    I repeat the Hand Controller Normal Operating Instructions;

    1. Keypad Hand Controller: Normal Operations

    Direction Keys: Four keys, labeled N, S, E, and W on the hand controller (1), Fig. 14, are used to move, or microslew, the telescope in a specific direction. When pressing a direction key, the only feedback is the motion of the telescope.

    Speed Key: The SPEED key (2), Fig. 14, is used to adjust the speed at which the telescope moves when pressing one of the direction keys. The current speed will be indicated by one of four LEDs located next to the SPEED key. An illuminated LED indicates the current speed. Pressing the SPEED key will cycle the hand controller through the four speed options.
    The four speeds are:
    32X sidereal rate useful for centering the object in a viewfinder.
    16X sidereal rate useful for centering the object in a wide-field eyepiece.
    8X sidereal rate useful for centering the object in a high-power eyepiece.
    2X sidereal rate useful for guiding during astrophotography.

    There are a lot of complicated settings achieved by multiple button pressings, but I think the Normal Button Operations are all that is needed to start.

    I understand you will send the status of the 5 buttons by serial link to the Control Panel Prop.

    LX50 CONTROL PANEL

    I understand the user requires the Control Panel Prop to have
    1 - a Terminal debug screen and
    2 - serial link from the hand controller which decodes the button status periodically.
    3 - two brushed motors driven bidirectionally with a common speed setting from the current button status.
    The motors are driven through the outdated UDN2993B H-bridge chip. You will have to get the datasheet of this chip.

    As far as the PWM speed for the motors is concerned, I guess the 32x speed option corresponds to nearly 100% PWM. If you make it 32x equivalent to 96% PWM, it will make the proportioning simple. Make this an adjustable variable so the user can modify it to his liking.

    The motor is only driven when a particular button is pressed. The Operation Manual is not very clear on this, but I do not think it allows both motors to run simultaneously. i.e. N and E button pushed together.

    Once again, thanks for stepping in to help, and good luck!



  • bbrien wrote: »
    jonnymac; Is the remote that you show my hand controller or something else. I also run two motors and the two motors have to be controlled by the(remote) The serial monitor is only used for diagnostics.

    I believe JonnyMac's block diagram is correct;

    CONTROLLER BLOCK; this is your LX50 control panel. It is serially connected via two FDS methods to
    - a debug screen and
    - the Remote (LX50 HandBox).

    REMOTE BLOCK; this is your LX50 Handbox with the 5 buttons and speed LED's. It could also have a FDS method for serial transmission of button status to the LX50 Control Panel, but this is not shown in the block diagram.

  • In this project he is not using a meade button hand control, but an Onan RV generator button panel, so there are no 32x, 16x etc. led's, just 4-5 basic buttons. The PC serial port is not really needed, but a port for autoguider is.
  • bbrienbbrien Posts: 561
    edited 2020-07-28 01:05
    The remote is the button panel which emulates the original hand controller.pictures being sent.
  • JonnyMacJonnyMac Posts: 9,159
    edited 2020-07-27 19:55
    I believe JonnyMac's block diagram is correct;
    It is correct -- well, as correct as any one can deliver considering the OP's obstinate refusal to provide accurate information about this project; something that could probably be coded and operational in an hour our two if we knew all the details.
  • DigitalBob wrote: »
    In this project he is not using a meade button hand control, but an Onan RV generator button panel, so there are no 32x, 16x etc. led's, just 4-5 basic buttons. The PC serial port is not really needed, but a port for autoguider is.
    bbrien wrote: »
    The remote is the button panel which emulates the original hand controller.pictures being sent.

    DigitalBob,
    I understand that bbrien is not using the Meade handbox, but as he says, he is trying to emulate it.
    Now I understand the Onan RV button panel has 5 buttons. This will be identical to the Meade handbox.

    As per the operating manual
    [quote=
    Speed Key: The SPEED key (2), Fig. 14, is used to adjust the speed at which the telescope moves when pressing one of the direction keys. The current speed will be indicated by one of four LEDs located next to the SPEED key. An illuminated LED indicates the current speed. Pressing the SPEED key will cycle the hand controller through the four speed options.
    The four speeds are:
    32X sidereal rate useful for centering the object in a viewfinder.
    16X sidereal rate useful for centering the object in a wide-field eyepiece.
    8X sidereal rate useful for centering the object in a high-power eyepiece.
    2X sidereal rate useful for guiding during astrophotography.
    [/quote]

    So, the Speed button actually has one of four values which must be transmitted together with the value given by pressing one of the N, E, S, W buttons.

    The LED's on the Handbox only give the operator local Handbox feedback on the current speed value - nothing else. They are not fed back from the Control Panel.

    Maybe bbrien does not want speed LED's on his handbox - his schematic does not show it, but how will he know the current speed? Let us hear from him.
  • bbrienbbrien Posts: 561
    edited 2020-07-28 01:30
    Hand control has the leds on the board and the speed settings are arbitrary at this time. Will send schematics again and also program from Hand controller again.No drawing of connection or motors included.
  • Both programs are posted (this Thread: 2020,7-21:17:59) . Do not contain working Serial.
  • Ok this is my hand button control spin program. I wrote it the long way so you can follow line by line and understand how it works. All you need to do is load this into prop flip 1, and disconnect your serial pins going to prop 2 for now. The serial works It runs good on the Parallax serial terminal, Tera terminal, and Putty terminal. If it doesn't work it's you, or maybe you spiked some of your flip pins. I put LCD's in there because I like LCD's
  • You'll have to change the pin numbers to match your pins for the buttons and LED's. Or rewire it for mine
  • bbrien wrote: »
    Hand control has the leds on the board and the speed settings are arbitrary at this time. Will send schematics again and also program from Hand controller again.No drawing of connection or motors included.

    bbrien,

    From your Hand Control program;

    1) In the "ReadDirectionalPins" coding I can see you decode the N, W, S, E buttons as pressed

    2) In the "ReadModePin" coding I cannot clearly see what you are trying to do. You read 4 mode states in a circular fashion.
    I would expect "ReadSpeedPin", with four speed states in a circular fashion.


    3) In "sendSerialData" I can see you intend to transmit 4 bytes, which seem to be direction and speed of both motors;
    R speed
    R direction
    D speed
    D direction
    I would expect one direction and speed for one motor only.

    Please could you describe exactly what you are trying to achieve, because it is different to the Meade Operating Manual for the Handbox.

    Could you answer the following questions clearly;

    1) By "mode" do you mean "speed"?

    2) exactly what do you wish to occur in the following combinations?;
    N button pressed while speed is in mode 1
    N button pressed while speed is in mode 2
    N button pressed while speed is in mode 3
    N button pressed while speed is in mode 4

    3) exactly what do you wish to occur in the following combinations?;
    E button pressed while speed is in mode 1
    E button pressed while speed is in mode 2
    E button pressed while speed is in mode 3
    E button pressed while speed is in mode 4

    4) exactly what do you wish to occur in the following combinations?;
    S button pressed while speed is in mode 1
    S button pressed while speed is in mode 2
    S button pressed while speed is in mode 3
    S button pressed while speed is in mode 4

    5) exactly what do you wish to occur in the following combinations?;
    S button pressed while speed is in mode 1
    S button pressed while speed is in mode 2
    S button pressed while speed is in mode 3
    S button pressed while speed is in mode 4

    6) exactly what do you wish to occur in the following combinations?;
    N and E button are pressed simultaneously while speed is in mode 1
  • DigitalBob wrote: »
    Ok this is my hand button control spin program. I wrote it the long way so you can follow line by line and understand how it works. All you need to do is load this into prop flip 1, and disconnect your serial pins going to prop 2 for now. The serial works It runs good on the Parallax serial terminal, Tera terminal, and Putty terminal. If it doesn't work it's you, or maybe you spiked some of your flip pins. I put LCD's in there because I like LCD's

    DigitalBob, your SPIN program is well written and easy to follow.
    I can see that you only decode the 4 direction buttons and transmit their values.
    However, you do not seem to handle the 5th Speed button with 4 values in a circular array.
    bbrien will clarify his intentions regarding the 5th Speed button, then you can perhaps modify your program, if you have time.
  • I'm just giving the basics here. If you can't get one button to do what you in your project, your not going to get five buttons to work. I'm pretty sure I know how the Meade LX50 system works, but if you want to have all of these special functions, like when you hold certain buttons it changes the speed or flips the direction, you will have to do that yourself. I'm not the paid consultant here, I'm just helping out here by tossing in my two cents of knowledge.
  • In your schematic don't run four LED's off of one resistor. Have a resistor for each LED, And run your H-bridge off of Prop flip two. Let prop flip one handle your button control, and Prop flip two handle your H-bridge, Autoguider, encoder, and external RS232 PC terminal. Prop one can still run RS232 for firmware updates etc. I'm aproaching the layout like the original meade LX50 control. And you should have two wires Prop to Prop for Tx and Rx. (Although one wire is OK if you only want to send serial one way Prop to Prop)
  • Under 'read mode pin' coding all that's happening is I am setting a ratchet for speeds. and assigning a led for each press of mode switch.Read direction pins is in two sections . In the first I am setting direction flags and the second part sets the speeds according to which mode we are operating in, low to high. Last four bytes for four output pins. W; Rmotor + Rdirect.(+) , E; Rmotor + Rdirect.(-), N; Dmotor + Ddirect.(+), S; Dmotor + Ddirect.(-)
    1; Speed is mode.
    2a;w,hen North button is Pressed The Dec motor will rotate low speed northward and in mode 2 , the same but a little bit faster, in mode 3 ,a lot faster and mode 4 almost full speed.
    3 a; east button similar but the R motor will be the one turning in an easterly direction. speed same as in
    north.
    4 a;copy north but direction is south
    5 a; copy east but direction is west.
    6; don't plan on it but it is doable since I use both counters in a cog.
  • Have no lcd's and cannot afford any . unable to work and only a small amount coming from social security. Thats why I'm begging.I have two programs and only one works. if I use Start serial then it quits.
Sign In or Register to comment.