How to use Spotify API on ESP32 with NFC Reader to control Echo Dot

  Рет қаралды 13,728

Maker At Play Coding

Maker At Play Coding

Күн бұрын

Learn how to program an ESP32 microcontroller to read a Spotify Playlist link form an NFC tag and make Spotify play that playlist on an Amazon Echo Dot.
Source Code on GitHub: github.com/makeratplay/esp32S...
Other Videos:
• How to Build a Retro C...
• Magical Alexa-Spotify-...
• How to Authenticate an...
Parts:
esp32: amzn.to/37c61mM
NFC reader: amzn.to/3d8m6xy
NFC tags: amzn.to/3tXHBa7
00:00 intro
00:08 the project
00:47 use visual studio code
01:30 project hardware
02:45 code time
03:32 setup()
04:37 fun fact 1
05:04 loop()
05:14 read NFC tag
06:01 parse NFC data
06:53 now call play on Spotify
07:54 fun fact 2
08:36 deep dive on Spotify API
09:49 fun fact 3
10:34 down load ssl certificate
11:55 back to the code
12:47 fetch access token
13:34 play API
15:04 fun fact 4
16:19 get Spotify devices API
16:30 janky sh!t
17:12 wrap up
18:01 ask me for help
This is my second KZbin Channel where I focus on software development. My other channel 'Maker At Play' is where i share my maker projects related to woodworking and electronics. / makeratplay
Want to support my Diet Dr Pepper addiction?
/ makeratplay
buymeacoffee.com/makeratplay
Follow:
/ makeratplay
/ makeratplay
/ makeratplay1
You can find me here as well:
makeratplay.com/
/ hawkinsmlh
about.me/michaelhawkins/
Tools used to make my videos:
Video Editor Software: Davinci Resolve
Camera Samsung Galaxy S8 Phone & Canon EOS M50
Mic: Rode Videomic Shotgun microphone with Rycote Lyre Suspension
If you appreciate this content and would like to help give back FREE OF CHARGE, simply give this video a “thumbs up”, leave a positive comment, subscribe to my KZbin channel and share this video with someone who you think would enjoy it. Some of the links that I’ve provided are affiliate links. That means that when you make purchases through those links, I earn a small commission. I only list products or services that I believe in.
#arduino #esp32 #spotify

Пікірлер: 50
@ronnyceballoperez2834
@ronnyceballoperez2834 Жыл бұрын
This is so much useful, thanks you so much, i was building something like this and this video help me with that http client bug LOL
@makeratplaycoding2666
@makeratplaycoding2666 Жыл бұрын
Glad it helped!
@smellygoober7358
@smellygoober7358 3 жыл бұрын
love your work!!! :p
@makeratplaycoding2666
@makeratplaycoding2666 3 жыл бұрын
Thanks
@christophhelms4905
@christophhelms4905 16 күн бұрын
Great, thanks for the thorough walkthrough. I'm just working on the same idea but for Raspberry Pi and I have a ESP32 on the way to try out your project. To get the "Next song" feature working might be tricky... I guess you need code that checks if the RFID tag is continuously read (which means ignore these calls). If it stops being read for a certain interval, we can read it as a new tag. Just in general, is everything else still working for you or did the API change?
@maguiresciberras1247
@maguiresciberras1247 6 ай бұрын
Hey mate, love your work. I'm building a similar device for which I've written the code. The only part I haven't written is the Spotify API library. I'm encountering an issue: on the first boot, I need to have Alexa already playing, otherwise the device ID becomes outdated. I'm also using the device name; I get the player details and then grab the device ID based on the specified device name. However, this doesn't seem to work unless Alexa is playing first. After that initial step, I have no more issues. I can play on my phone and then hit play on my little device, and it will transfer and work fully as intended. It's just that initial boot that's problematic.
@luigicicatiello3991
@luigicicatiello3991 2 жыл бұрын
That's awesome. Thanks a lot for you sharing it. just to ask, is there a reason to use vs code/arduino-cli and not vs code/platformIO? Keep up the great work!
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
They all achieve the same end goal of putting a program on your microcontroller. They each just offer different helping tools to get you there. I like VS Code because I use it to program for other platforms as well like windows, web, AWS. I don't have to learn a new IDE/Tool set each time I switch target platforms.
@Ivance1
@Ivance1 2 жыл бұрын
You are incredible
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
Thanks for the kind words.
@moetij
@moetij 2 жыл бұрын
This is awesome. I knew I kept all my records, cassettes, and cd's for a reason. Ordered the parts and got the info needed from spotify. New to Visual Studio Code, how do I flash the code to the ESP32?
@makeratplaycoding2666
@makeratplaycoding2666 2 ай бұрын
Glad it inspired you to build your own. Share your results. Would love to see how it turned out.
@roboticflamingo234
@roboticflamingo234 11 ай бұрын
Freakin awesome.😀
@makeratplaycoding2666
@makeratplaycoding2666 2 ай бұрын
Thanks
@spandankumar6497
@spandankumar6497 6 ай бұрын
I like this man
@makeratplaycoding2666
@makeratplaycoding2666 2 ай бұрын
Thanks
@DrMohammadArifulHoque
@DrMohammadArifulHoque 7 ай бұрын
I have two questions. 1. How to write the links on rfid cards. 2. My serial monitor only shows nfc card present. Nothing else is happening. What am I doing wrong?
@nerissacheung
@nerissacheung 2 жыл бұрын
Hi! Thanks for the code, i watched the video but probably didnt understand how to deal with the deviceName. Can you help me?
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
In my example I had to use the device_id query parameter to ensure that Spotify played the music on the echo dot I wanted since I have multiply devices connected to my Spotify account. I believe you can make the API calls without the device Id and Spotify will just default to the last device that was playing Spotify music. If you give me a more detailed question, I might be able to help.
@Kodiak1806
@Kodiak1806 2 жыл бұрын
do you have a video creating projects and importing libraries like wifi.h into visual studio code?
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
I have not created a video on that topic. I assume it is something you are interested in. Exactly what are you wanting to understand?
@Kodiak1806
@Kodiak1806 2 жыл бұрын
@@makeratplaycoding2666 I'm new in vs code and Arduino, I would like to know how to import libraries and send code to esp32, I have very little time working with esp and the Arduino app
@jessehowell2382
@jessehowell2382 3 жыл бұрын
i am getting a return 400 and return 403 on the spotify nfc project. what do i set for redirect upi's?
@makeratplaycoding2666
@makeratplaycoding2666 3 жыл бұрын
Did you create yourself an app in the Spotify Dashboard? For the code ESP32 it doesn't matter what the redirect url is as long as you use the same when in the api calls that you used when you created the app in the Spotify Dashboard.
@MPElectronique
@MPElectronique Жыл бұрын
You are not implementing Auth 2.0 in your code?
@hendrikj5169
@hendrikj5169 2 жыл бұрын
do the code to which it redirects one after providing redirect_url and clientId and the refresh token expire? I got my redirect token using Spotifys own example in GitHub aß well as your application from the other video but i cant get it to work. it always says "failed to connect to..."
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
Yes the code / auth token you get from Spotify does expire every 60 minutes or so. That is why you have to use the refresh token to get a new token when it does expire.
@azerty-by4yh
@azerty-by4yh 2 жыл бұрын
Could you give us a hint on how to write the spotify link onto the NFC tags. I'm currently using an app on my Android but it seems to corrupt my card
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
I created a TikTok video on this topic. www.tiktok.com/@makeratplay/video/6926358046079716613?sender_device=mobile&sender_web_id=6934138888244823558&is_from_webapp=v1&is_copy_url=0
@azerty-by4yh
@azerty-by4yh 2 жыл бұрын
@@makeratplaycoding2666 I followed exactly the steps on the TikTok but once I write the Spotify link my whole nfc card becomes unreadable. It gives this error on each sector: PCD_Authenticate() failed: Timeout in communication
@azerty-by4yh
@azerty-by4yh 2 жыл бұрын
hey actually my cards were defective managed to grab new ones
@dhruvajindal4932
@dhruvajindal4932 3 жыл бұрын
How do you program esp32 with VS Code. Isn't the Arduino IDE the only which is supported?
@makeratplaycoding2666
@makeratplaycoding2666 3 жыл бұрын
You can use VS Code, but it still requires the Arduino tools to be installed. I enjoy it a lot more than using the Arduino IDE. Here is a link to how to setup VS Code for Arduino learn.sparkfun.com/tutorials/efficient-arduino-programming-with-arduino-cli-and-visual-studio-code There are lots other help on the web too if you search for 'use visual studio code for Arduino'
@dhruvajindal4932
@dhruvajindal4932 3 жыл бұрын
@@makeratplaycoding2666 Thanks :)
@robertschumacher9640
@robertschumacher9640 Жыл бұрын
Did someone get it up and running? I tried it with an ESP8266 i had lying around. I have no experience with programming an ESP. However, my approach seems to be correct. First I downloaded Arduino IDE, adjusted the Seetings.h file with my values and loaded the board software of an ESP2866 into IDE. Then I added the .ino file and in the Library Management I added the WiFi.h and the rest of the .h files from the folder. Unfortunately, I get a error message in IDE afterwards
@robertschumacher9640
@robertschumacher9640 Жыл бұрын
EDIT: I did not connect the RFID Reader. Could this be a part of the problem
@robertschumacher9640
@robertschumacher9640 Жыл бұрын
C:\Users\Rob\Desktop\esp32SpotifyEchoDot-main\esp32SpotifyEchoDot\esp32SpotifyEchoDot.ino: In function 'bool readNFCTagData(byte*)': C:\Users\Rob\Desktop\esp32SpotifyEchoDot-main\esp32SpotifyEchoDot\esp32SpotifyEchoDot.ino:143:1: error: no return statement in function returning non-void [-Werror=return-type] 143 | } | ^ cc1plus.exe: some warnings being treated as errors exit status 1 Compilation error: no return statement in function returning non-void [-Werror=return-type] Is the ESP2866 perhaps to small and out of memory?
@frontendboys2792
@frontendboys2792 2 жыл бұрын
can I use an ESP8266 for this project?
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
You should be able too as long as you have enough IO Pins.
@MPElectronique
@MPElectronique 2 жыл бұрын
bad boy ahhaha :)
@makeratplaycoding2666
@makeratplaycoding2666 Жыл бұрын
I am going to take that as a compliment. 😀
@jakemeyer8188
@jakemeyer8188 2 жыл бұрын
All your talk of nerds using a "real IDE like VS Code", and not one person has dropped an elitist, snide comment about VIM? *sigh*. "Pfft. VS Code is a REAL nerd IDE? I only use VIM, because a GUI that makes sense with a mouse to click on stuff is for LOSERS". Now your comment section is complete...and I hate myself a little...
@makeratplaycoding2666
@makeratplaycoding2666 2 жыл бұрын
Yes, I agree VIM takes you to a higher level of nerdism. 😂
@__3093
@__3093 3 жыл бұрын
me >:)
@makeratplaycoding2666
@makeratplaycoding2666 3 жыл бұрын
Use your new knowledge wisely. 😁
@oscarho1505
@oscarho1505 Жыл бұрын
amazing work!!! but i keep getting "abort() was called at PC 0x40154642 on core 1" after getting the deviceID. can you offer some advice thank you
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 9 МЛН
Automating My Morning Routine - Modern-Day Record Player
8:58
From Start to Finish: ESP32 Internet Radio with a Roberts RM20
42:44
DIY haptic input knob: BLDC motor + round LCD
2:11
scottbez1
Рет қаралды 2,1 МЛН
We built a Drone using ESP32 for less than Rs.1000!
9:37
Circuit Digest
Рет қаралды 113 М.
You don't need this
0:23
Rillo
Рет қаралды 3 МЛН
ESP8266 based Spotify currently playing track display
1:05
Andrei Mehiläinen
Рет қаралды 27 М.
Building a MIDI Controller Using Arduino
15:41
Switch & Lever
Рет қаралды 623 М.
E-Paper Price Tags controlled via Arduino ESP32
9:31
Aaron Christophel
Рет қаралды 24 М.
#419 ESP32 Audio Tutorial with lots of examples
13:48
Andreas Spiess
Рет қаралды 229 М.
Samsung S24 Ultra professional shooting kit #shorts
0:12
Photographer Army
Рет қаралды 18 МЛН
i like you subscriber ♥️♥️ #trending #iphone #apple #iphonefold
0:14
WWDC 2024 - June 10 | Apple
1:43:37
Apple
Рет қаралды 10 МЛН
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 37 МЛН