thotro / arduino-dw1000

A library that offers functionality to use Decawave's DW1000 chips/modules with Arduino.
Apache License 2.0
516 stars 288 forks source link

Does this code work on an ESP8266 or ESP32 programmed w/ Arduino IDE? #156

Open nodemand opened 7 years ago

nodemand commented 7 years ago

I'm curious if anyone has tested this code on an ESP8266 or ESP32 connected to a DWM1000 module. The extra processing power of these modules combined with Wi-Fi (and Bluetooth on the ESP32) might make for a great anchor and/or tag being able to calculate ranges and such on its own and connect to a central server through Wi-Fi.

Rotzbua commented 7 years ago

I tried to port it. Changes are in the actual library. But I never got it stable on a Wemos D1 mini. So you have to invest time for debug and code changes.

nodemand commented 7 years ago

Thanx for your reply! May I ask what problems did you encounter? Where they the common ESP8266 issues like WDT reset and such?

Rotzbua commented 7 years ago

WDT reset with an older ESP-SDK, with newer not but randomly the dwm1000 drop connection or did not start up. Maybe my hardware/connection was not good.

Another issue on this library mention that they changed the spi-speed, but I never tried.

nodemand commented 7 years ago

Ok thank you!

andrespineda commented 7 years ago

I tried and tried to get the DWM1000 to work with the ESP8266 and it worked for brief periods. The ESP8266 kept rebooting at random times. I finally broke down and bought the SparkFun ESP32 Thing and connect pins as follows:

const uint8_t PIN_SCK = 18; const uint8_t PIN_MOSI = 23; const uint8_t PIN_MISO = 19; const uint8_t PIN_SS = 2; const uint8_t PIN_RST = 15; const uint8_t PIN_IRQ = 17;

I no longer have issues with the ESP32, but my connection using wires to the DMW1000 is flaky. I just created some new circuit boards and will mount the DMW1000 and the ESP32 WROOOM-32 on the same board (antennas facing away from each other). The ESP32 runs much faster and has more memory than any arduino. Hope this is a good combination.

Rotzbua commented 7 years ago

@andrespineda So in conclusion it works with a esp8266?

andrespineda commented 7 years ago

I could never get the DWM1000 to work on ESP8266; the ESP8266 keeps crashing every few seconds. The ESP32 is very stable with both the DWM1000 and Wifi. Eventually, I moved away from this code and used the C code provided by Decawave as it provides more detailed functionality.

aacton commented 7 years ago

I can confirm that the DWM1000 works well with the ESP8266. The system is very stable but does require good power, which I believe is the cause of 99% of the reset issues people generally report. I use a 1-A regulator and make sure that the input voltage is high enough to keep a steady 3.3V out even with current spikes.

Oli-M commented 7 years ago

On ESP8266 you need a 'delay(1)' (ESP-chip will do some 'own' things then) in loop() to avoid WDT resets. This works for me but for 'range'-values I always get random numbers - some with neg sign. No idea.

khawajamechatronics commented 7 years ago

@Oli-M Hi, Can you please let me know wiring for NodeMCU. as I am trying to connect dwm1000 but receiving image

also did you used power from nodemcu or external power?

Any changes in library code to make it work? Thanks

Oli-M commented 7 years ago

This works for me:

Wiring DWM->NodeMCU GPIO-#:

SPI: 20 (CLK), 19 (MISO), 18 (MOIS), 17 (CSn) -> 14 (CLK), 12 (MISO), 13 (MOSI), 15 (SS) RST: 2 (RSTn) -> 5 IRQ: 22 (IRQ) -> 4 PWR: 7 (VDD3.3) -> 3.3V
GND: 8 (VSS) -> GND

NodeMCU: USB-powered max. 1A source. +- 300mA max measured. WiFi.mode(WIFI_OFF); inserted top of setup() - no other changes to src.
Use short wiring and proper connections - <15cm jumper wire are ok. Use DW1000.begin(PIN_IRQ, PIN_RST); // dont' forget RST! SPI-connection-success if Device ID comes with 'DECA1'. RangingTag & RangingAnchor are working OK with stable ranges, but only 1 to 1; any 2nd anchor is showing wrong range-values. DW1000Ranging-Examples are all showing wrong and permanently changing random ranges.

Hope you'll have success...

Oli.

AnhDongNguyen commented 7 years ago

@andrespineda Hi can you provide me the code and the library which is working with ESP32+DWM1000? Is it able to build a network includes of 3 anchors + 1 tag using ESP32+DWM1000?

hdineth commented 7 years ago

@Oli-M can you provide a sample code please?

rahulbhagat8 commented 7 years ago

hi can i have a sample code please

Oli-M commented 7 years ago

I used sucessfully RangingAnchor and RangingTag from 'here' in original with RST and IRQ pin changed to GPIO-# 5 and 4. (ESP8266).

rahulbhagat8 commented 7 years ago

Hi Oli-M, i am a hardware guy i don't have much idea about coding. can I have your code i am making it for my college project

SIVAComtustec commented 7 years ago

@Oli-M can you please make sure about pin connection with nodemcu, i have that pin, do i need any changes in code and api . also i have doubt about rstn pin, u said rst pin in dw1000 is 2, but in module it is 3rd pin, 2 nd pin is wakeup,so where shuld i connect.

khawajamechatronics commented 7 years ago

Hi @Oli-M

I solved the issue by adding a capacitor near power pins. Unfortunately its still not reliable as it hits WDT Resets a lot.

Is there any other ARM based board that can work smoothly with this library?

Oli-M commented 7 years ago

@SIVAComtustec Sorry - RST is Pin 3 on DWM. Use this. @khawajamechatronics I had trouble using ESP8266 and DWM1000 connected with (short) jumperwires. I now made a pcb with ESP, DWM and USB 5V to 3.3V DC, some capacitors - everything works fine. Error is about 50cm...1m (everytime more than real) on starting, getting better to 20...50cm after 2..3 sec. You can calibrate chip on antenna-delay-time by cmd - or - what I do - subtract error against 'mechanical' measure as constant. Sure it's better to calculate errors 'away' by some algorithms/statistics I have to find out. Next I'll check WIFI (now OFF) and com to a cloud service. I'm hopeful ESP8266&DWM would be a nice pair for this task.

gabdsg commented 6 years ago

'class SPIClass' has no member named 'usingInterrupt' i get this error with the esp32

werty37 commented 6 years ago

Hi,

I was wondering if anybody made the DWM1000 work with WeMos D1 Mini. I am using the DWM1000 Wayne breakout board and I have my connections as follows:

RST - RST 3.3v - External 3.3v LM2596 1A GND - GND IRQ - D1 (330 Ohm in parallel to ground) CLK - D5 MISO - D6 MOSI - D7 CS - D8

I am trying to run the basic connectivity test on the esp8266. But it keeps getting resetting. Any pointers please?

ets Jan  8 2013,rst cause:2, boot mode:(7,6)

waiting for host

Thanks S

curlyz commented 6 years ago

Add delay or yield, just random everywhere anh for optimize , slowly tune the delay shorter, but neh, getting it works is amazing af already XD On 27 Sep 2017 00:47, "werty37" notifications@github.com wrote:

Hi,

I was wondering if anybody made the DWM1000 work with WeMos D1 Mini. I am using the DWM1000 Wayne breakout board and I have my connections as follows:

RST - RST 3.3v - External 3.3v LM2596 1A GND - GND IRQ - D1 (330 Ohm in parallel to ground) CLK - D5 MISO - D6 MOSI - D7 CS - D8

I am trying to run the basic connectivity test on the esp8266. But it keeps getting resetting. Any pointers please?

ets Jan 8 2013,rst cause:2, boot mode:(7,6)

waiting for host

Thanks S

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thotro/arduino-dw1000/issues/156#issuecomment-332279289, or mute the thread https://github.com/notifications/unsubscribe-auth/AVt0w1iSJQhSMg2D9HcZ8gyQoTpX78Vtks5smTicgaJpZM4LmnfG .

werty37 commented 6 years ago

Hi @curlyz

Thank you. I will give it a shot. It would be of help if you can provide the pin mapping of WeMos D1 with the DWM1000.

Cheers S

werty37 commented 6 years ago

Hi,

I can confirm that ESP8266 WeMos D1 Mini works with the DWM1000. I powered the esp and dwm with LM2596. I was able to run the basic connectivity and the two way ranging examples. I will create a wiki with the pin mappings soon.

Cheers S

werty37 commented 6 years ago

Here are the pin mappings. I am using Wemos D1 Mini and Wayne DWM1000 Adapter.

DWM1000 Adapter - ESP8266 WeMos D1 RST - D2 IRQ - D1 CLK - D5 MISO - D6 MOSI - D7 CS - D8

Add a 10K resistor between IRQ and GND.

Here is source code mappings for Wemos D1 Mini. This might change depending on the type of ESP you are using.

// connection pins
const uint8_t PIN_RST = D2; // reset pin
const uint8_t PIN_IRQ = D1; // irq pin
const uint8_t PIN_SS = D8; // spi select pin

Hope this helps.

jat1n commented 6 years ago

I tried and tried to get the DWM1000 to work with the ESP8266 and it worked for brief periods. The ESP8266 kept rebooting at random times. I finally broke down and bought the SparkFun ESP32 Thing and connect pins as follows:

const uint8_t PIN_SCK = 18; const uint8_t PIN_MOSI = 23; const uint8_t PIN_MISO = 19; const uint8_t PIN_SS = 2; const uint8_t PIN_RST = 15; const uint8_t PIN_IRQ = 17;

I no longer have issues with the ESP32, but my connection using wires to the DMW1000 is flaky. I just created some new circuit boards and will mount the DMW1000 and the ESP32 WROOOM-32 on the same board (antennas facing away from each other). The ESP32 runs much faster and has more memory than any arduino. Hope this is a good combination.

@andrespineda it shows esp modules dnt support can u help???

hazee007 commented 5 years ago

Hello Guys i just want to embark on this project Nodemcu with DWM1000 One thing i learned from this post is that its possible but i have a few question

  1. is it possible to store the output of the DWM1000 from the serial monitor to an sd card or
  2. will the Nodemcu wifi work at the same time with the DWM1000 so i can just send the data to database and
  3. am trying to make indoor(DWM1000) and Outdoor(GPS) position tracking and some other voice recognition included which means i need the sd card to save the data when wifi is not available and when wifi is available all this information are sent to database. so i will like to know if this is all possible with the nodemcu or not. if not can you suggest another MCU capable of this. Any suggestion is appreciated.

regards A.

Yashvardhan-A commented 3 years ago

I could never get the DWM1000 to work on ESP8266; the ESP8266 keeps crashing every few seconds. The ESP32 is very stable with both the DWM1000 and Wifi. Eventually, I moved away from this code and used the C code provided by Decawave as it provides more detailed functionality. @andrespineda Can you provide link to this code(decawave code for dwm1000) or any newer version to it if available.

andrespineda commented 3 years ago

Attached is some old code that worked for me on the ESP32. I could never get the ESP8266 to work reliably.

Best, Andres

On Sat, Sep 11, 2021 at 1:47 PM Yashvardhan Agarwal < @.***> wrote:

I could never get the DWM1000 to work on ESP8266; the ESP8266 keeps crashing every few seconds. The ESP32 is very stable with both the DWM1000 and Wifi. Eventually, I moved away from this code and used the C code provided by Decawave as it provides more detailed functionality. @andrespineda https://github.com/andrespineda Can you provide link to this code or any newer version to it if available.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thotro/arduino-dw1000/issues/156#issuecomment-917477619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWGEZRNX3HNY62KIKOQZGLUBO56FANCNFSM4C42O7DA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Best, Andres

kyuhyong commented 2 years ago

I tried and tried to get the DWM1000 to work with the ESP8266 and it worked for brief periods. The ESP8266 kept rebooting at random times. I finally broke down and bought the SparkFun ESP32 Thing and connect pins as follows:

const uint8_t PIN_SCK = 18; const uint8_t PIN_MOSI = 23; const uint8_t PIN_MISO = 19; const uint8_t PIN_SS = 2; const uint8_t PIN_RST = 15; const uint8_t PIN_IRQ = 17;

I no longer have issues with the ESP32, but my connection using wires to the DMW1000 is flaky. I just created some new circuit boards and will mount the DMW1000 and the ESP32 WROOOM-32 on the same board (antennas facing away from each other). The ESP32 runs much faster and has more memory than any arduino. Hope this is a good combination.

@andrespineda Thanks for sharing your experience with esp-32. I am also trying to use ESP32 board and could not get it to work with SPI. Can you tell me which SPI library did you use for ESP32 board?

kyuhyong commented 2 years ago

I tried and tried to get the DWM1000 to work with the ESP8266 and it worked for brief periods. The ESP8266 kept rebooting at random times. I finally broke down and bought the SparkFun ESP32 Thing and connect pins as follows:

const uint8_t PIN_SCK = 18; const uint8_t PIN_MOSI = 23; const uint8_t PIN_MISO = 19; const uint8_t PIN_SS = 2; const uint8_t PIN_RST = 15; const uint8_t PIN_IRQ = 17;

I no longer have issues with the ESP32, but my connection using wires to the DMW1000 is flaky. I just created some new circuit boards and will mount the DMW1000 and the ESP32 WROOOM-32 on the same board (antennas facing away from each other). The ESP32 runs much faster and has more memory than any arduino. Hope this is a good combination.

@andrespineda I made a board for DWM1000 with ESP32 and have been testing. TAG and ANCHOR works as expected however ANCHORs keeps crashing after about 100 seconds or so. It doesn't happens while not connected to any TAGs but it become unstable and eventually crash as soon as a TAG is connected. TAG doesn't crash that much but it does crash when multiple of ANCHORs crashes. I disabled any WIFI this time. Can you share part of your code for establishing connection between TAG and ANCHOR?

AlistarStefan commented 1 year ago

Here are the pin mappings. I am using Wemos D1 Mini and Wayne DWM1000 Adapter.

DWM1000 Adapter - ESP8266 WeMos D1 RST - D2 IRQ - D1 CLK - D5 MISO - D6 MOSI - D7 CS - D8

Add a 10K resistor between IRQ and GND.

Here is source code mappings for Wemos D1 Mini. This might change depending on the type of ESP you are using.

// connection pins
const uint8_t PIN_RST = D2; // reset pin
const uint8_t PIN_IRQ = D1; // irq pin
const uint8_t PIN_SS = D8; // spi select pin

Hope this helps.

Hi, I was wondering if you powered the dwm1000 from the wemos via the LM2596 (connected lets say: PC usb -> wemos 5V output pin -> LM2596 -> dwm1000). I am trying to power the dwm1000 from the wemos d1 mini and I'm not sure whether those 500mA from the esp will fry my dwm. Thank you for your help!

andrespineda commented 1 year ago

The important thing is the voltage. I believe the DWM1000 operates at 2.8 to 3.6 Volts. Be sure to measure the voltage out of the LM2596 is within this voltage. The DWM1000 or any other device will ONLY draw the milliamps that it needs. So if the LM2596 can output 3 amps, the DMW1000 will only pull about 160ma. In that case you are OK. Best, Andres

On Fri, Jan 20, 2023 at 8:31 AM AlistarStefan @.***> wrote:

Here are the pin mappings. I am using Wemos D1 Mini and Wayne DWM1000 Adapter.

DWM1000 Adapter - ESP8266 WeMos D1 RST - D2 IRQ - D1 CLK - D5 MISO - D6 MOSI - D7 CS - D8

Add a 10K resistor between IRQ and GND.

Here is source code mappings for Wemos D1 Mini. This might change depending on the type of ESP you are using.

// connection pinsconst uint8_t PIN_RST = D2; // reset pinconst uint8_t PIN_IRQ = D1; // irq pinconst uint8_t PIN_SS = D8; // spi select pin

Hope this helps.

Hi, I was wondering if you powered the dwm1000 from the wemos via the LM2596 (connected lets say: PC usb -> wemos 5V output pin -> LM2596 -> dwm1000). I am trying to power the dwm1000 from the wemos d1 mini and I'm not sure whether those 500mA from the esp will fry my dwm. Thank you for your help!

— Reply to this email directly, view it on GitHub https://github.com/thotro/arduino-dw1000/issues/156#issuecomment-1398634578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWGEZRGCZLYSFOTOWNME2DWTK4VLANCNFSM4C42O7DA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best, Andres

abidshahriar commented 5 months ago

@andrespineda hi, i am trying to work it on ESP32 with Dw1000 module, can you please share a schematic or kindly tell me how did you connect it with the ESP-32 MCU ? Thanks

andrespineda commented 4 months ago

@abidshahriar See my attached images. Hope that helps. DW1000 PCB Terminal Wiring

abidshahriar commented 4 months ago

@andrespineda hey the pictures are blurry, if you have done it in easy eda then can you share the schematic directly ?

andrespineda commented 4 months ago

Sorry, I had to replace my computer and lost a lot of my old files.


From: abidshahriar @.> Sent: Thursday, April 25, 2024 10:54 PM To: thotro/arduino-dw1000 @.> Cc: Pineda, Andres @.>; Mention @.> Subject: Re: [thotro/arduino-dw1000] Does this code work on an ESP8266 or ESP32 programmed w/ Arduino IDE? (#156)

@andrespinedahttps://urldefense.com/v3/__https://github.com/andrespineda__;!!BeImMA!7ZKCoM5Q_2oVvdamRGf4YlGwixBoi1FPUwoAhCdsQj10NQKXfYccJBdExDV90_f5fxgTWCWsz8OzhcOx8q8lBz4GTby_$ hey the pictures are blurry, if you have done it in easy eda then can you share the schematic directly ?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/thotro/arduino-dw1000/issues/156*issuecomment-2078681534__;Iw!!BeImMA!7ZKCoM5Q_2oVvdamRGf4YlGwixBoi1FPUwoAhCdsQj10NQKXfYccJBdExDV90_f5fxgTWCWsz8OzhcOx8q8lBwCWNg9m$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AAWGEZXJNG4HN2FTXORNSYTY7HTYDAVCNFSM4C42O7DKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBXHA3DQMJVGM2A__;!!BeImMA!7ZKCoM5Q_2oVvdamRGf4YlGwixBoi1FPUwoAhCdsQj10NQKXfYccJBdExDV90_f5fxgTWCWsz8OzhcOx8q8lB16CR9OM$. You are receiving this because you were mentioned.Message ID: @.***>