Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Signal Problem Joystick axis with Loadcell and HX711

  1. #1
    Junior Member
    Join Date
    Mar 2019
    Posts
    6

    Signal Problem Joystick axis with Loadcell and HX711

    Hello together,

    im new to the forum and i hope to find a solution for a rather special problem.

    Background:
    Im currently designing Pedals for use in Racing Simulations on PC.
    The Brake Pedal uses a loadcell, amplified via a HX711.

    I first started to wire up everything directly between the HX711 and the Teensy via jumper cables.
    Everything worked fine.

    I then used a breadboard for each component (Teensy and HX711) to have it more clear and to play around with it.
    That was the first time i encountered a problem in the axis signal for my brake pedal.

    In the diagram you can see in blue how the signal should be and in red how it looks unfortunately.

    Click image for larger version. 

Name:	Sugnal-Problem.jpg 
Views:	10 
Size:	19.8 KB 
ID:	16066

    After that i tried again the "direct connected" way via jumper cables without the use of breadboards. Everything was fine again.

    So based on that i thought, it would be best to design a breakout board where i can directly solder the teensy and the hx711 on.
    This to make it a beautiful, directly connected solution.

    Now with the breakout board i have the same problem as before (shown in the diagram).

    The sketch on the teensy is as followed (even if it should be correct since it is working):


    #include "HX711.h"

    #define DOUT1 0
    #define CLK1 1

    HX711 scale1(DOUT1, CLK1);

    float calibration_factor1 = 150; //Kalibriefaktor fr Scale1 Bremskreislauf vorne

    void setup() {

    scale1.set_scale();
    scale1.tare();

    }

    void loop() {

    Joystick.Zrotate(scale1.get_units()); // Bremskreislauf vorne

    delay(50);
    }


    The breakout board connections between teensy and hx711 is all fine.
    The cable from the loadcell is connected to the breakout board with RJ45 Socket/Plug. This connection to the HX711 is also correct.

    For GND i use a mass plane where the ground pins of the teensy and HX711 is connected to eachother.

    Can anyone guess what the problem could be? Or maybe had a similar one?
    Is there a component of some sort missing in between?
    Can i somehow solve it in the sketch?

    Im really drivinbg crazy right now, and hope somebody could help.
    Thanks a lot in advance!!

    Cheers Dan

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,899
    This may need a photo of your setup along with a schemetic. As a basic step you can look at the voltage out of the amp unit with a multimeter, and depending on your design use a variable resistor to apply a test voltage to the Teensy pin. My guess at the moment without seeing the hardware is that as your pedal comes down something shorts to supply or looses ground reference.

  3. #3
    Junior Member
    Join Date
    Mar 2019
    Posts
    6
    Quote Originally Posted by GremlinWrangler View Post
    This may need a photo of your setup along with a schemetic. As a basic step you can look at the voltage out of the amp unit with a multimeter, and depending on your design use a variable resistor to apply a test voltage to the Teensy pin. My guess at the moment without seeing the hardware is that as your pedal comes down something shorts to supply or looses ground reference.
    Hi,
    Thank you very much for that first suggestion. I will try it and if the problem still occurs i would get a bit more in detail with pictures etc.

    Cheers Daniel

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,701
    Is the power up sequence different now that it is not direct connected? That is: is the load cell powered before or after when it was before - is the Teensy doing a cold or warm start different than it was?

    If that were the case perhaps a delay(5000); in setup() like this would change behavior:
    Code:
    void setup() {
      delay(5000);
      scale1.set_scale();
      scale1.tare();
    }
    5,000 is extreme - can be adjusted down if it shows signs of helping - but the Teensy maybe be up and running ( < 400 ms after power up ) before the load cell is ready for commands and the .scale() and .tare() are not computing properly. That could explain the unit working in loop() - but not returning expected values.

  5. #5
    Junior Member
    Join Date
    Mar 2019
    Posts
    6
    Quote Originally Posted by defragster View Post
    Is the power up sequence different now that it is not direct connected? That is: is the load cell powered before or after when it was before - is the Teensy doing a cold or warm start different than it was?

    If that were the case perhaps a delay(5000); in setup() like this would change behavior:
    Code:
    void setup() {
      delay(5000);
      scale1.set_scale();
      scale1.tare();
    }
    5,000 is extreme - can be adjusted down if it shows signs of helping - but the Teensy maybe be up and running ( < 400 ms after power up ) before the load cell is ready for commands and the .scale() and .tare() are not computing properly. That could explain the unit working in loop() - but not returning expected values.
    Hi, very good suggestion, will try!! Thank you very much

  6. #6
    Junior Member
    Join Date
    Mar 2019
    Posts
    6
    Hi guys,

    the suggestions from you above unfortunately didnt solve the problem.
    Therefore i will post some more information about the project.

    In the pictures you can see the breakout board with the soldered components and without.

    Unfortunately i choosed black so its a bit hard to see.
    When i check the routing for connection with a multimeter everything is fine.
    On the rear side you can see some jumper cables.
    Reasons for them:
    - one black is for getting VUSB (5V)
    - one black is for a ground pin that was not connected to the ground plane (my fault)
    - yellow is to get DOUT to a different pin on the Teensy because i originally accidently routed it to PIN13 (LED) on the Teensy.

    Click image for larger version. 

Name:	IMG_20190312_061236.jpg 
Views:	9 
Size:	86.9 KB 
ID:	16123

    Click image for larger version. 

Name:	IMG_20190312_061302.jpg 
Views:	6 
Size:	41.3 KB 
ID:	16124

    Click image for larger version. 

Name:	IMG_20190312_061349.jpg 
Views:	7 
Size:	102.6 KB 
ID:	16125

    Click image for larger version. 

Name:	IMG_20190312_061357.jpg 
Views:	4 
Size:	89.7 KB 
ID:	16126

    Click image for larger version. 

Name:	IMG_20190312_061518.jpg 
Views:	6 
Size:	98.5 KB 
ID:	16127

    Click image for larger version. 

Name:	IMG_20190312_061538.jpg 
Views:	5 
Size:	86.7 KB 
ID:	16128

    The order from the loadcell is as followed:
    Loadcell (4 wire) -> RJ45 plugs -> HX711 (E-, E+, A-, A+) -> DOUT, SCK, VCC, GND (via ground plane/jumper) to Teensy 3.2.

    On the other picture you can see the routing as it "is" on the breakout board.

    Click image for larger version. 

Name:	Schema.jpg 
Views:	10 
Size:	192.1 KB 
ID:	16129

    Hope this helps a bit...

    Cheers Daniel

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,701
    Found the HX711 at sFun - their part will run from 2.7V -- 5V. Would your load cell work if the HX711 you have would work and was run at 3.3V?

    Not sure that would explain why it was working in one setup then not working if it was at 5V before - but if the signal coming back is 3.3V based you'd have more usable signal without it pegging at anything over 3.3V. Same with the throttle. Any chance the unshown working setup was running off of 3.3V?

  8. #8
    Junior Member
    Join Date
    Mar 2019
    Posts
    6
    Quote Originally Posted by defragster View Post
    Found the HX711 at sFun - their part will run from 2.7V -- 5V. Would your load cell work if the HX711 you have would work and was run at 3.3V?

    Not sure that would explain why it was working in one setup then not working if it was at 5V before - but if the signal coming back is 3.3V based you'd have more usable signal without it pegging at anything over 3.3V. Same with the throttle. Any chance the unshown working setup was running off of 3.3V?
    hmm...i always ran them with 5 Volts.

    How do you mean exactly, i think it lacks in my basic understanding of useing 3,3 or 5Volts. Why exactly would 3.3V be better?

    Anyway i will check if the loadcell also works with 3.3V.

    Thank you!

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,701
    Teensy 3.1/3.2 have 5V tolerant pins - but any voltage applied to read as analog at or over 3.3V will simply show as MAX value for the current analog resolution.

    So any voltage over 3.3V will only be sensed as 1024 at 10 bits. I'm not sure if the load cell measure output is linear - but the OP drawing doesn't indicate this is the problem where the upper range over 3.3V would be expected to be full scale after output goes over 3.3/5 if so.

  10. #10
    Junior Member
    Join Date
    Mar 2019
    Posts
    6
    Quote Originally Posted by defragster View Post
    Teensy 3.1/3.2 have 5V tolerant pins - but any voltage applied to read as analog at or over 3.3V will simply show as MAX value for the current analog resolution.

    So any voltage over 3.3V will only be sensed as 1024 at 10 bits. I'm not sure if the load cell measure output is linear - but the OP drawing doesn't indicate this is the problem where the upper range over 3.3V would be expected to be full scale after output goes over 3.3/5 if so.
    Ok, i think i understood. Will try. Thank you very much!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •