Тёмный

How to make an Arduino custom I2C slave sensor/device 

Taste The Code
Подписаться 10 тыс.
Просмотров 3,8 тыс.
50% 1

Video sponsored by PCBWay. Visit PCBWay and get $5 off from your first order:
www.pcbway.com/setinvite.aspx...
In this video, I'm exploring the idea of having your own I2C slave devices and sensors where a helper Arduino is used just for the sensor and the main controller does all of the control logic.
In my case, the slave I2C device is a dedicated controller for a motor speed controller (AC dimmer) that monitors the AC zero-crossing point and it listens on a specific I2C address for the speed at which the motor should run.
By using two separated Arduino Nanos, I can utilize the interrupt pins on both controllers where the one on the slave device will monitor the zero-crossing signal and the other one can be used for interfacing with the UI through a rotary encoder.
The Arduino code used can be found on the Instructable for the project:
www.instructables.com/Custom-...
Tools and materials used in the video:
Arduino Nano - s.click.aliexpress.com/e/_Aey8wk
AC Dimmer Module - s.click.aliexpress.com/e/_A2DIQ4
Mini Breadboards - s.click.aliexpress.com/e/_A69aO4
Jumper Wires - s.click.aliexpress.com/e/_AFkya8
Alternative links on Banggood:
Arduino Nano - www.banggood.com/custlink/3GG...
WiFI Triac Dimmer - www.banggood.com/custlink/3D3...
Mini breadboard - s.click.aliexpress.com/e/_ol4...
Jumper Wires - www.banggood.com/custlink/Dvm...
Support my work on Patreon so I can continue producing free content and tutorials!
/ taste_the_code
My recording gear:
GT10 Pro 5G Android Phone - s.click.aliexpress.com/e/_oDn...
Dragon Touch 4K Action Camera - s.click.aliexpress.com/e/_mrc...
USB Condenser Microphone - s.click.aliexpress.com/e/_mq5...
Tripod - s.click.aliexpress.com/e/_ooa...
Phone tripod mount - s.click.aliexpress.com/e/_s9WaiJ
How to make an Arduino custom I2C slave sensor/device
#arduino #i2c #sensors #custom #tastethecode
Main Site and blog: www.tastethecode.com
Facebook: / tastethecode
Instagram: / taste_the_code
Twitter: / taste_the_code
Get exclusive Taste The Code t-shirts and merch at
teespring.com/taste-the-code
Click on the link below to get two months of free premium access to Skillshare and start learning today!
skl.sh/37LnRua
Get $50 off your order on hosting for all of your website needs and learning projects on Dreamhost!
www.dreamhost.com/r.cgi?24057...

Наука

Опубликовано:

 

9 июл 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@SlavkosHobbyChannel
@SlavkosHobbyChannel 3 года назад
Great project Balich! My solution for the communication between the nano (your mainboard) and the attiny (the board that you use just for the module) would be just using an analog voltage or PWM signal between them, what do you think? I think that it is worth trying. I think just that 0-100 value for the percentage that the module's library asks, can be sent just by "sending" a PWM signal between them, and some sort of mapping will do the job. if we need to send more data, so it is not applicable, but as I can see you will use the attiny just to control the module. I have used this method, and it worked fine for me, just needed to have a common ground between the two boards, so I created a "protocol" with my rules :P haha Have fun :D
@TasteTheCode
@TasteTheCode 3 года назад
Thanks Slavko! I thought about using analog/PWM voltage but that will only work for a one way communication. In this case it will work but I wanted to have more flexibility for future applications.
@MatsK007
@MatsK007 Год назад
You mentioned that ATTiny 85 uses the same pin for interrupt as for I2C. But isn't the ATTiny85 fast enough to do zero crossing detection without interrupt pin but do the zero detection with software ?
@TasteTheCode
@TasteTheCode Год назад
I did not tried that but there is a risk to miss it by just a little bit and not turn on the light on time.
@abusukar
@abusukar 3 года назад
Thank you for your efforts in teaching us about Arduino. I have benefited a lot from you. I am grateful to you.. I have a small project, but I could not do it.. Not because it is difficult, but maybe I am not good at programming ..Can you help me please..thanks Abu I'm trying to upload a link to the pdf file but youtube won't allow
@TasteTheCode
@TasteTheCode 3 года назад
Hi Abu, thanks for the great words! You can contact me through FB messenger but I can only provide general guidance.
@abusukar
@abusukar 3 года назад
Yes, of course. All I need is instructions only - but unfortunately I do not have Facebook - I will try to explain to you I just want to send a wired signal from pin No. 4, for example, to pin No. 5, and the signal is from an external source.. For example, I want the Arduino to press a button on the TV remote by connecting two wires from the remote control motherboard button to two of the Arduino pins, and the Arduino will connect between the two pins As if someone is pressing the button..I hope you understand me.. I will put for you a link to a video that I just uploaded on RU-vid, not exceeding a minute.. It has an explanation with pictures. Watch it if you have time.. Thanks for replying to me Abu
@TasteTheCode
@TasteTheCode 3 года назад
You will need to use an opticoupler for that. The Arduino will turn on the LED on it, and the optocoupler will "press" the button.
@TasteTheCode
@TasteTheCode 3 года назад
OK, I checked the video and you definitely need optocouplers in order to have isolation between the remote and the Arduino. Each button will need it's own optocoupler that will connect in between the two lines on each of the buttons and will be controlled from a pin on the Arduino. Since you want to have multiple buttons pressed at the same time, you can control multiple optocouplers from the same Arduino pin in order to simplify your code.
@abusukar
@abusukar 3 года назад
I am very grateful to you for your advice. I did not know the function of the optocoupler, but after looking at it and watching several videos, I understood what you mean.. The world of electronics is very vast.. Thank you.. I wish you all success in your life. Abu
Далее
How To Find Unknown I2C Addresses Several Ways
17:32
Просмотров 19 тыс.
БАТЯ И ТЁЩА😂#shorts
00:58
Просмотров 1,4 млн
Я читаю переписки сына
00:18
Просмотров 748 тыс.
Sensors - which one to use
17:06
Просмотров 1,3 млн
I2C Part 2 - Build a I2C Sensor
33:47
Просмотров 130 тыс.
I2C Part 1 - Using 2 Arduinos
25:51
Просмотров 408 тыс.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00