Building a custom I2C chip for Wokwi simulation - PCF8575 [full walkthrough]

Поділитися
Вставка
  • Опубліковано 19 січ 2025

КОМЕНТАРІ • 50

  • @ben.alldridge
    @ben.alldridge 9 місяців тому +6

    Dude, if you were teaching them how, so many more people would want to learn code and hardware. You're a delight to watch.

  • @rvowles99
    @rvowles99 Рік тому +7

    Somehow this popped up in my feed and now i know how I'm going to spend my xmas break - this is fantastic!

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому

      Hah, that's great--I was just thinking of what I'll be playing with during the holidays as well (seems I *will* get those PCBs in time, so I need to get moving and order some parts, like right now...). I love these periods, where you can just ignore the inbox and focus on pure fun stuff. Hope you have a blast--wokwi has a discord thing you might want to check for help, inspiration or to share what you make. Cheers

    • @Wokwi
      @Wokwi  Рік тому

      So how was you xmas break? 😉

  • @DFX2KX
    @DFX2KX Рік тому +2

    That is honestly... surprisingly reasonable as a process. My C is terrible but I was able to follow along.

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому

      I sometimes really zip through things (an excessive zeal at trying to keep things interesting), so that's awesome to hear :) I hope it helps kickstart you on your way to creating your own simulations. Cheers

    • @imacubsfan23
      @imacubsfan23 10 місяців тому

      @@PsychogenicTechnologiesI can't seem to implement this for a PCF8574. What variables in .chip.c would I need to change, and what in sketch.ino?

    • @PsychogenicTechnologies
      @PsychogenicTechnologies 10 місяців тому

      Hello @@imacubsfan23/Tim, could you hint me as to what type of problem you are encountering? I would think that if you changed the example by making NUM_GPIO 8 rather than 16, and rearranging the chip.json file to get rid of the "P1*" pins, you'd basically have yourself a PCF8574. Since, AFAIK, the function is the same and the i2c address is the same, not much would change in the ino, but of course, you'd need to remap the circuit and testing to do things using a single port. Is there anything I'm missing?
      Of course if you want it clean, you should rename everything in there called "pcf8575" to "pcf8574", and that includes in both json files, as well as the file names themselves. Please let me know if there's anything I've missed there. Cheers

  • @MichaelSamerski
    @MichaelSamerski Рік тому +4

    I just discovered you. Fabulous content mate!

  • @Uncle-Duncan-Shack
    @Uncle-Duncan-Shack Рік тому +3

    Nicely done Pat, appreciate the effort you put into making the video.
    This one got seriously interesting.
    Worth watching a few times to take it all in.
    Regards,
    Duncan

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому +1

      Many thanks Duncan! I'll admit, I went a bit deeper than originally planned with this one and it wound up making for a lot of work and a longer video but I thought it'd be worth looking at the whole process, and I really appreciate you confirming 😀 Let me know if any questions are left unanswered or if there are ways I could make it better next time. Cheers!

  • @originuk
    @originuk Рік тому +1

    Thanks for making this video. I'm loving Wokwi and a happy paying customer. That said, setting up VS Code was tricky (although you make it look easy!) Using custom chips in VS Code was weird for me too. Figuring out how to configure VS Code and Dev Containers was a bit of a shock to my system -Docker Desktop and WSL wasn't playing nicely at the time, and caused a few crashes. Virtualising is defo the right way to go, but man, what a journey to get there!

    • @Wokwi
      @Wokwi  Рік тому

      Thanks for the feedback! Yeah, using llvm-clang to compile the chips makes it kind of tricky to get the setup right. Dev containers are nice, but they got their own gotchas. What is your use case for custom chips?

  • @blvckbytes7329
    @blvckbytes7329 Рік тому

    I really love your way of narrating your thoughts and actions, it feels to me just as if I was hacking away myself! Our thought processes are quite alike, and I really develop some interest in hardware-projects again. I stopped them a while ago, due to the fact that software and logic like math in general are way less resource intensive than hardware tinkering, but with this software it looks like I can really have the best of both worlds and avoid building like two or three less-than-ideal prototypes in real life.
    You most definitely gained a long-term subscriber. Thank you for these high quality videos, this one really lightened the day! :)

    • @Wokwi
      @Wokwi  Рік тому +1

      Thanks for sharing this feedback with us! Reading this really lightened the day :)

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому

      Hi! Wow, that's awesome :) It's funny: one of the big benefits of doing more stuff "publicly", with videos and open hardware etc, is that we get to find the like minded (yes, others exist!! hah). Seriously, I spent years working in my own corner... making stuff behind the scenes can be challenging and fun, but it's 10x when knowledge and ideas start flowing between us all. I actually got back into, and fully committed to, hardware after kickstarting some random ATTiny module and playing with it. Maybe this will rekindle that fire for you in the same way.
      Anyway, thanks for the comments: being helpful/useful/entertaining to the yous in the world is the main reason I do all of this stuff.
      Cheers!

  • @AFSMG
    @AFSMG Рік тому

    Your works are incredible. Please continue like this. Congratulations.

  • @ArduinoGreeks
    @ArduinoGreeks Рік тому +1

    Dear friend, is it possible for a club member to use unsupported libraries like UTFT and URTouch and how this can be done? Thannk you.

    • @Wokwi
      @Wokwi  Рік тому

      Yes, you should be able to upload them through the "Library Manager" tab. Note that you also need to make sure that the libraries support the hardware we're simulating

    • @ArduinoGreeks
      @ArduinoGreeks Рік тому +1

      @@Wokwi Although i add the correct libraries, i get error: /libraries/URTouch/URTouch.cpp:27:11: fatal error: hardware/avr/HW_AVR.inc: No such file or directory
      #include "hardware/avr/HW_AVR.inc"
      ^~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      Error during build: exit status 1. What to do to working correctly? Any example?

    • @Wokwi
      @Wokwi  Рік тому +1

      @@ArduinoGreeksIf you uploaded it as a custom library, the source files must end with .c / .cpp / .h / .S. You can rename the file to have a ".h" extension and update the references in the source code, and then it should work.

  • @Sourabh-jv2ip
    @Sourabh-jv2ip 7 місяців тому

    Really great content, helps a lot to understand stuff!!

  • @whac-a-robot
    @whac-a-robot 10 місяців тому

    I am trying to read a analog value and print it in chip console. I get the value as either 0 or 5 instead of other values. Is there any other way to do it?

  • @onurates9311
    @onurates9311 Рік тому

    Thnak you so much for these videos. Love it

  • @bluebull1985
    @bluebull1985 Рік тому +1

    this was great! please do more coding! maybe more basic coding - I love watching it, and improved my C just by watching you write code...!

  • @khroomlet8821
    @khroomlet8821 11 місяців тому

    Is there any way to use this tool to test DC motors and or other things like 12V DC LED arrays for power consumption or circuit integrity? This popped up on my feed and looks perfect.

  • @lecturerintisaar3015
    @lecturerintisaar3015 9 місяців тому

    Is it possible to do biometric simulation like palm, face , iris or fingerprint into wokwi simulator??

  • @flashcorp76
    @flashcorp76 Рік тому +1

    New to the Channel, for me … a little bit involved ´C’ wise, ( I have No programming background),I’m more electronics… but brilliant. Pause-rewind, that’s what YT is all about😊 learning curve slightly high in programming (for me!), but Go WOKWI ! (Maybe make the pip insert smaller ?) 🤓👍🏻

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому +1

      Hello! Yes, wokwi brings in people from both ends -- programmers that want to play with hardware, and electronics folks who want to leverage digital sims. I tried to keep the focus balanced in these, but no matter what, there'll probably be some pause-rewind involved! If you haven't seen it, the previous video does go into a bit more detail with some of the programming related bits (the chip state structure, the typedefs like pin_t, the initializations), so do check it out if you haven't already. Glad you enjoyed, thanks for the feedback :)

  • @katiareginahostiliocervant2096

    Datasheet simplified schematic diagram is wrong. The IOH current source value is 0.1mA (100uA), not 100mA.
    100mA is too much to drain if the pin is grounded when reading it.

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому

      hum, yeah, that makes sense--didn't even notice the unlikeliness of 100mA. Thanks!

  • @jonasfelipe777
    @jonasfelipe777 2 місяці тому

    Is this guy really fast on coding? I would like to be like him when I become senior.

  • @criznach
    @criznach Рік тому +1

    Supa cooooool!

  • @fensrg
    @fensrg Рік тому

    Hi, how to connect oled 0.96 I²C, ADS1115 I²C, 2 x tm1637 and 2 x Rotary Encoder to Wemos D1 Mini and leave 4 pin for PWM?
    Wemos D1 Mini have 9 digital pins, 2 pin connect I²C (oled 0.96 and ADS1115), 3 pin for TM1636 (common SCL), and 4 pin for Rotary Encoder, summary 9 pins, need more 4 pin for PWM... =(

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому

      Hello Fens! Well, this actually looks like a good place to use an I/O expander... so all your I2C stuff basically shares 2 pins, no problem. Is it the TM1637 or TM1636? In any case, you can put the rotary encoders on an I/O expander (maybe the PCF8574 since you don't seem to need 16 pins), have that on I2C bus as well and only use one more pin to keep an eye on the interrupt.
      So, if all your chips are I2C, that's only 3 pins, and you have plenty left over for PWM or whatever. The only thing is you'll have to be fast enough to see the interrupt and read the i/o expander before the next rotary encoder pulse comes in.
      Does that answer your question or did I miss something?

    • @fensrg
      @fensrg Рік тому

      @@PsychogenicTechnologies TM1637 7-seg module

    • @fensrg
      @fensrg Рік тому

      ​@@PsychogenicTechnologies thanks for the tip

  • @stevenheynderickx583
    @stevenheynderickx583 Рік тому +5

    Hi, brilliant way of trying to teach, but the learningcurve is very steep. I am a programmer and not an expert on electronics. If you can't slow down, maybe you have some good references to me get up to speed. And if you would be afraid of beeing boring, be assured, people that want to learn are interested in what an expert has to say, so please take your time to explain. I listen to conversations with Lex Fridman on youtube that are more than 3 hours long. Anyway thanks for sharing your knowledge!

    • @PsychogenicTechnologies
      @PsychogenicTechnologies Рік тому +2

      Hello Steven. Thanks for the feedback: I admit, I'd usually rather have a video that people pause to have a better look at some part than get bored with... it's hard to strike the right balance though, that's certain.
      If you're good with the C code but only getting up to speed on the electronics, a few worthwhile resources to start might be:
      Pull-ups and pull-downs: ua-cam.com/video/5vnW4U5Vj0k/v-deo.html
      Open-collector (basically same as open drain) outputs: ua-cam.com/video/7zGw70Pbggw/v-deo.html
      I2C protocol for comms between chips: ua-cam.com/video/j9yx8LOslng/v-deo.html
      Another look at the I/O expander (PCF8574, basically the little brother of the chip here): ua-cam.com/video/mXMkgQf3fqU/v-deo.html
      Let me know if there are any other bits that could use extra resources.

  • @mdzubaer8934
    @mdzubaer8934 2 місяці тому

    very nice.... thanks

  • @jumadhaheri
    @jumadhaheri Рік тому +1

    Nice 😊

  • @Gamestersaify
    @Gamestersaify 7 місяців тому

    hello from discord

  • @timecapsule324
    @timecapsule324 2 місяці тому

    ভাই রে ভাই। কি জিনিস তুমি।

  • @terrybailey2769
    @terrybailey2769 7 місяців тому

    I've no doubt that to those who are familiar with this, it all makes sense, but for me who is still trying to learn this it is way way too fast. Please can you do something that is a little more sedate for us mere mortals.

  • @ttac2011
    @ttac2011 Рік тому

    The man is strugling over his OWN Words and dienst lecture but studies info he seems to look The frist time in life

  • @HarveyChen253
    @HarveyChen253 Рік тому +2

    Nice work! this is Harvey from PCBWay and we really want to work with you on some project. How can we reach u if you are interested in this!