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

Thread: Using Dshot and a Teensy

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    19

    Using Dshot and a Teensy

    Hey guys,

    This is an issue I've been banging my head against for the last few weeks. I'm trying to control a dshot ESC with my teensy board. The project requires an update rate of 1-10 khz. I have an ESC that can handle dshot1200 apparently, but here's the problem, I don't know how to output dshot protocol bits. Frankly I'm not very good at using the buffers/shift registers, and I was hoping to find a solution. I was hoping to find a library but I haven't been able to find any.

    I tried using the teensyshot library but wasn't able to get it to work. That is a potential solution if anyone wants to go using that route.

    There is a cash reward, $75 and up, for anyone who manages to get my motor spinning (preferably under arduino IDE serial control)

  2. #2
    How far did you get with attempting to use the teensyshot library? At first glance it looks as if once you load the program on to the Teensy you need to write a program on the pc which sends data to the Teensy over usb serial at 115200 baud with this struct
    Code:
    // Host->teensy communication data structure
    // sizeof(Host_comm)=64 to match USB 1.0 buffer size
    typedef struct {
      uint32_t      magic;                        // Magic number
      int16_t       RPM_r[ESCPID_MAX_ESC];        // Velocity reference (10 rpm)
      uint16_t      PID_P[ESCPID_MAX_ESC];        // PID proportional gain
      uint16_t      PID_I[ESCPID_MAX_ESC];        // PID integral gain
      uint16_t      PID_D[ESCPID_MAX_ESC];        // PID derivative gain
      uint16_t      PID_f[ESCPID_MAX_ESC];        // PID filtering pole
    } Hostcomm_struct_t;
    where magic number is defined in ESCPID.h as 0x43305735 and ESCPID_MAX_ESC is set to 2 by default which you could change for only 1 ESC.

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Quote Originally Posted by Spencez View Post
    How far did you get with attempting to use the teensyshot library?
    yup, so there's actually a second, simpler library in there under "Ardo", which is muuuuch easier to use but unfortunately not easy enough for my 1 brain cell. It also, conveniently, does exactly what I need, offering to control an ESC with just the serial port.

    What ends up happening is that I get the esc "Power up" tone (three beeps ascending in pitch) when plugging it into pin 9 which I discovered after much consternation, but pretty much nothing I ever do after that works. The throttle commands I'm sending it are making it to the teensy and my modified code ends up pinging back the throttle command I sent it, but I never get anything other than that "power up" tone.

    Anyway, I also contacted the makers of the software who won't help lol.

    So thank you.

  4. #4
    Did you try pin 4? It looks like ESC 1 should be on pin 4 according to the readme on github.
    Click image for larger version. 

Name:	teensyshot.PNG 
Views:	19 
Size:	34.6 KB 
ID:	25421

    Sorry for the simple question, I will try and look deeper into it tomorrow.
    Which version Teensy are you using? It's possible the simple library is written for a different Teensy.

    Also it looks like others have had issues getting teensyshot running. Someone did write their own code for a Teensy 3.2, it would need to be updated if you are using a different Teensy.

    https://forum.pjrc.com/threads/45083...l=1#post225414
    Last edited by Spencez; 07-30-2021 at 07:20 AM.

  5. #5
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Hey Spence, I did try every pin on the board and 9 was the only one that could coax a "power up" tone out of the ESC.

    I'm using a 3.6 but have access to a 4.1 and honestly I can get any as long as they maintain a high update rate as that is very important for the project.

    thank you again for the help.

  6. #6
    Are you using a KISS ESC? If so, Give this a shot.
    https://sbasami-tech.hatenablog.com/...0/08/23/095106
    Specifically this ino.
    https://gist.github.com/sbasami/06c4...5d60622069f288

    He used a teensy 4.1 but I would assume a 3.5 should work if you wire to pins 22 and 0 instead of 4 and 0.

  7. #7
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Quote Originally Posted by Spencez View Post
    Are you using a KISS ESC? If so, Give this a shot.
    https://sbasami-tech.hatenablog.com/...0/08/23/095106
    Specifically this ino.
    https://gist.github.com/sbasami/06c4...5d60622069f288

    He used a teensy 4.1 but I would assume a 3.5 should work if you wire to pins 22 and 0 instead of 4 and 0.
    No, but I have no problem getting one. I'll do that and check back here. Thanks for this pointer.

    EDIT: I assume the libraries he's adding are the ones from teensyshot?

  8. #8
    You could try his code before going ahead and buying one although he explains how he only could get it to work with a KISS ESC, not sure the reason. It should work on either of your Teensy versions, I would follow the pins on the teensyshot GitHub or his guide.

    Here is what he said, I wonder if it has anything to do with why your code does not work.
    In my case, I wanted to implement the control myself, so I used only the communication-related programs between Teensy and ESC. As far as I can confirm, this program only works with ESC of KISS firmware . I also tried ESC with BlHeli32 firmware but it didn't work.

  9. #9
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Fair point, I have a BLHeli ESC.

    I ordered a KISS ESC (I don't want to mess with burning KISS lol) and a teensy 4.1 so we'll see if I can replicate the results with that hardware. If so, I'll be getting your paypal info =D but if not I'll message here again.

  10. #10
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Hey guys. So I just got my board and the ESC. When I wired everything together, including the ESC and the teensy, it would get extremely hot and shut down. I double checked all the solder joints and it all looks good, but it seems like something is shorting inside the ESC. So, yeah gotta deal with that lol.

    EDIT: Yup checked it and it seems like there's a short between the esc signal and the esc ground. I'll be checking to make sure it's inside the esc and then write a bad review on amazon.
    I hope I didn't burn up my teensy.

  11. #11
    Are you powering it with a LiPo? I remember reading that the ESC has regenerative braking and it could damage a power supply so you had to use a LiPo to power it. If so disregard, I just remember reading the warning.

  12. #12
    Junior Member
    Join Date
    Nov 2020
    Posts
    19
    Yessir it is using a lipo, but there is also a power distribution board in there. I wonder if I should try wiring it directly to the battery. but I doubt that'll fix it tbh.

Posting Permissions

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