Programming an ATtiny85, Part 1: Using C with a USBtinyISP Arduinos are great for prototyping, but for a small, low-power, cheap and simple design, an ATtiny chip seems like just the ticket. For just a few dollars you can do most of what you could with an Arduino and use a lot of the same code, as long as you can make do with a little less memory and fewer pins. I've been wanting to try them, and recently I ordered a few ATtiny85 chips. There are quite a few ways to program them. You can buy programmers specifically intended for an ATtiny, but I already had a USBtinyISP, a chip used to program Arduino bootloaders, so that's what I'll discuss here. Wiring to the USBtinyISP The best reference I found on wiring was Using USBTinyISP to program ATTiny45 and ATTiny85. That's pretty clear, but I made my own Fritzing diagram, with colors, so it'll be easy to reconstruct it next time I need it. The colors I used: MISO yellow VCC red SCK white MOSI green RESET orangeor red/black GND black Programming the ATtiny in C I found a couple of blink examples at electronut.in, Getting Started with ATtiny AVR programming, and in a Stack Exchange thread, How to program an AVR chip in Linux Here's some basic blink code: #include <avr/io.h> #include <util/delay.h> int main (void) { // Set Data Direction to output on port B, pins 2 and 3: DDRB = 0b00001000; while (1) { // set PB3 high PORTB = 0b00001000; _delay_ms(500); // set PB3 low PORTB = 0b00000000; _delay_ms(500); } return 1; } Then you need a Makefile. I started with the one linked from the electronut page above. Modify it if you're using a programmer other than a USBtinyISP. make builds the program, and make install loads it to the ATtiny. And, incredibly, my light started blinking, the first time! Encouraged, I added another LED to make sure I understood. The ATtiny85 has six pins you can use (the other two are power and ground). The pin numbers correspond to the bits in DDRB and PORTB: my LED was on PB3. I added another LED on PB2 and made it alternate with the first one: DDRB = 0b00001100; [ ... ] // set PB3 high, PB2 low PORTB = 0b00001000; _delay_ms(500); // set PB3 low, PB2 high PORTB = 0b00000100; _delay_ms(500); Timing Woes But wait -- not everything was rosy. I was calling _delay_ms(500), but it was waiting a lot longer than half a second between flashes. What was wrong? For some reason, a lot of ATtiny sample code on the web assumes the chip is running at 8MHz. The chip's internal oscillator is indeed 8MHz (though you can also run it with an external crystal at various speeds) -- but its default mode uses that oscillator in "divide by eight" mode, meaning its actual clock rate is 1MHz. But Makefiles you'll find on the web don't take that into account (maybe because they're all copied from the same original source). So, for instance, the Makefile I got from electronut has CLOCK = 8000000 If I changed that to CLOCK = 1000000 now my delays were proper milliseconds, as I'd specified. Here's my working attiny85 blink Makefile. In case you're curious about clock rate, it's specified by what are called fuses, which sound permanent but aren't: they hold their values when the chip loses power, but you can set them over and over. You can read the current fuse settings like this: avrdude -c usbtiny -p attiny85 -U lfuse:r:-:i -v which should print something like this: avrdude: safemode: hfuse reads as DF avrdude: safemode: efuse reads as FF avrdude: safemode: Fuses OK (E:FF, H:DF, L:62) To figure out what that means, go to the Fuse calculator, scroll down to Current settings and enter the three values you got from avrdude (E, H and L correspond to Extended, High and Low). Then scroll up to Feature configuration to see what the fuse settings correspond to. In my case it was Int. RC Osc. 8 Mhz; Start-up time PWRDWN/RESET; 6CK/14CK+ 64ms; [CKSEL=1011 SUT=10]; default value and Divide clock by 8 internally; [CKDIV8=0] was checked. More on ports and pins There's more info on ATtiny ports in ATTiny Port Manipulation (Part 1): PinMode() and DigitalWrite() Nobody seems to have written much about AVR/ATTINY programming in general. Symbols like PORTB and functions like _delay_ms() come from files in /usr/lib/avr/include/, at least on my Debian system. There's not much there, so if you want library functions to handle nontrivial hardware, you'll have to write them or find them somewhere else. As for understanding pins, you're supposed to go to the datasheet and read it through, all 234 pages. Hint: for understanding basics of reading from and writing to ports, speed forward to section 10, I/O Ports. A short excerpt from that section: Three I/O memory address locations are allocated for each port, one each for the Data Register - PORTx, Data Direction Register - DDRx, and the Port Input Pins - PINx. The Port Input Pins I/O location is read only, while the Data Register and the Data Direction Register are read/write. However, writing a logic one to a bit in the PINx Register, (comma sic) will result in a toggle in the corresponding Data Register. In addition, the Pull-up Disable - PUD bit in MCUCR disables the pull-up function for all pins in all ports when set. There's also some interesting information there about built-in pull-up resistors and how to activate or deactivate them. That's helpful, but here's the part I wish they'd said: PORTB (along with DDRB and PINB) represents all six pins. (Why B? Is there a PORTA? Not as far as I can tell; at least, no PORTA is mentioned in the datasheet.) There are six output pins, corresponding to the six pins on the chip that are not power or ground. Set the bits in DDRB and PORTB to correspond to the pins you want to set. So if you want to use pins 0 through 3 for output, do this: DDRB = 0b00001111; If you want to set logical pins 1 and 3 (corresponding to pins 6 and 2 on the chip) high, and the rest of the pins low, do this: PORTB = 0b00001010; To read from pins, use PINB. In addition to basic functionality, all the pins have specialized uses, like timers, SPI, ADC and even temperature measurement (see the diagram above). The datasheet goes into more detail about how to get into some of those specialized modes. But a lot of those specialties are easier to deal with using libraries. And there are a lot more libraries available for the Arduino C++ environment than there are for a bare ATtiny using C. So the next step is to program the ATtiny using Arduino ... which deserves its own article. Tags: hardware, arduino, programming [ 18:01 Nov 02, 2017 More hardware | permalink to this entry | ]
This is one of my news digests. If you like my editorial choices, there are more to be found by clicking on the "dear reader" link, and on my name above. Enjoy !
Takeoff projects help students complete their academic projects. Register at takeoff projects today to find and learn about different interesting big data projects and grab the best jobs. Get started right now.
How to Read Capacitor Voltage Codes Easily! #Shorts
Description "Confused by the codes on capacitors like 0J, 1A, 2E, or 2J? This short video explains how to quickly decode standard voltage markings and choose the right capacitor for your electronics projects. Learn the importance of correct voltage ratings to avoid damage and improve circuit reliability. Watch, learn, and share for safe and smart electronics!
In this video i talk about my latest project, the PV PI! A Raspberry Pi HAT that can power your Raspberry Pi from a 12V LiFePO4 battery which charging it from the sun!
No te pierdas la revisión de este impresionante kit de Raspberry, en mi canal de YouTube 'Bernardo Tutoriales' (enlace en la BIO o busca en YouTube el canal 'Bernardo Tutoriales'). Si no estás suscrito aprovecha para suscribirte, ya que tenemos infinidad de vídeos relacionados con robótica, tecnología, electrónica, programación, Arduino, diseño3D, etc., etc.
Chào mừng tất cả các bạn đến với kênh của mình. Kênh mình chuyên viết về Nhúng Linux. Mình muốn bổ sung thêm cả các video hướng dẫn để các bạn tiện thực hành hơn.
Bài này mình sẽ nói về - Sơ lược về Lý thuyết của Yocto Project, - Cách clone source code poky và các meta layer cần thiết - Sửa file cấu hình bblayer.conf, local.conf - Build và test image trên Board
Bài tới mình sẽ tiếp tục nói về bbappend, cũng như ta sẽ thực hành thêm mật khẩu cho User
Nếu các bạn thấy hay mình rất mong được các Like Share và Subcribe kênh mình nhé !!!
In this video, I build an OTP-based door lock system using Arduino and a GSM module. This smart lock project sends an SMS alert and enhances home security with a one-time password verification feature.
Component List ******************************* Arduino Nano 16x2 LCD Display I2C Module Sim800l GSM Module 5v Relay Module 4x4 Keypad Buzzer Zero PCB USB Cable *******************************
Project Buy Link ************************************************* Ready To Go Kit :- https://rzp.io/rzp/Lnqs3vik *************************************************
How can I use the PN532 with an ESP32-Wroom-32? Ask Question Asked today Modified today Viewed 7 times 0 The ESP32 cant find the NFC module (Pn532). I used the I2C and SPI without any promising results. I used the Example code and edited the Pins Every time I only Get this result: Serial.print("Didn't find PN53x board"); #include <Wire.h> #include <SPI.h> #include <Adafruit_PN532.h> // If using the breakout with SPI, define the pins for SPI communication. #define PN532_SCK (16) #define PN532_MOSI (25) #define PN532_SS (17) #define PN532_MISO (26) // Uncomment just _one_ line below depending on how your breakout or shield // is connected to the Arduino: // Use this line for a breakout with a software SPI connection (recommended): Adafruit_PN532 nfc(16, 26, 25, 17); // Use this line for a breakout with a hardware SPI connection. Note that // the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's // hardware SPI SCK, MOSI, and MISO pins. On an Arduino Uno these are // SCK = 13, MOSI = 11, MISO = 12. The SS line can be any digital IO pin. //Adafruit_PN532 nfc(PN532_SS); // Or use this line for a breakout or shield with an I2C connection: //Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET); // Or use hardware Serial: //Adafruit_PN532 nfc(PN532_RESET, &Serial1); void setup(void) { Serial.begin(115200); while (!Serial) delay(10); // for Leonardo/Micro/Zero Serial.println("Hello!"); nfc.begin(); delay(1000); uint32_t versiondata = nfc.getFirmwareVersion(); if (! versiondata) { Serial.print("Didn't find PN53x board"); while (1); // halt } // Got ok data, print it out! Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX); Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC); Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC); Serial.println("Waiting for an ISO14443A Card ..."); } void loop(void) { uint8_t success; uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type) // Wait for an ISO14443A type cards (Mifare, etc.). When one is found // 'uid' will be populated with the UID, and uidLength will indicate // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight) success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength); if (success) { // Display some basic information about the card Serial.println("Found an ISO14443A card"); Serial.print(" UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes"); Serial.print(" UID Value: "); nfc.PrintHex(uid, uidLength); Serial.println(""); if (uidLength == 4) { // We probably have a Mifare Classic card ... Serial.println("Seems to be a Mifare Classic card (4 byte UID)"); // Now we need to try to authenticate it for read/write access // Try with the factory default KeyA: 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF Serial.println("Trying to authenticate block 4 with default KEYA value"); uint8_t keya[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; // Start with block 4 (the first block of sector 1) since sector 0 // contains the manufacturer data and it's probably better just // to leave it alone unless you know what you're doing success = nfc.mifareclassic_AuthenticateBlock(uid, uidLength, 4, 0, keya); if (success) { Serial.println("Sector 1 (Blocks 4..7) has been authenticated"); uint8_t data[16]; // If you want to write something to block 4 to test with, uncomment // the following line and this text should be read back in a minute //memcpy(data, (const uint8_t[]){ 'a', 'd', 'a', 'f', 'r', 'u', 'i', 't', '.', 'c', 'o', 'm', 0, 0, 0, 0 }, sizeof data); // success = nfc.mifareclassic_WriteDataBlock (4, data); // Try to read the contents of block 4 success = nfc.mifareclassic_ReadDataBlock(4, data); if (success) { // Data seems to have been read ... spit it out Serial.println("Reading Block 4:"); nfc.PrintHexChar(data, 16); Serial.println(""); // Wait a bit before reading the card again delay(1000); } else { Serial.println("Ooops ... unable to read the requested block. Try another key?"); } } else { Serial.println("Ooops ... authentication failed: Try another key?"); } } if (uidLength == 7) { // We probably have a Mifare Ultralight card ... Serial.println("Seems to be a Mifare Ultralight tag (7 byte UID)"); // Try to read the first general-purpose user page (#4) Serial.println("Reading page 4"); uint8_t data[32]; success = nfc.mifareultralight_ReadPage (4, data); if (success) { // Data seems to have been read ... spit it out nfc.PrintHexChar(data, 4); Serial.println(""); // Wait a bit before reading the card again delay(1000); } else { Serial.println("Ooops ... unable to read the requested page!?"); } } } } I tried SPI and I2C and different Pins arduinoesp32roboticspn532 Share Improve this question Follow asked 11 mins ago Moritz Ende 1 New contributor Moritz Ende is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. Add a comment Know someone who can answer? Share a link to this question via email, Twitter, or Facebook. Start asking to get answers Find the answer to your question by asking. Ask question Explore related questions arduinoesp32roboticspn532 See similar questions with these tags. <div></div>
Discover 4 powerful single-board computers that outshine the Raspberry Pi in performance, features, and value. From Radxa X4 to Orange Pi 5 Pro, these alternatives offer superior specs and capabilities for demanding projects.
Vous n'avez peut-être jamais entendu parler des routeurs Thread Border, mais ils sont en passe de devenir un élément de base de la maison intelligente : ils travaillent en coulisse pour relier tous vos équipements de maison intelligente.
In this project, we create an RFID Based Smart Shopping Cart using Arduino UNO, RFID module, and push buttons for adding or removing items. When an item’s RFID tag is scanned, it’s automatically added to the cart’s list. You can also remove items by pressing the “Remove” button. The total bill updates instantly on the LCD display.
This project reduces queue time at billing counters and enhances the shopping experience through automation and IoT-based innovation.
🔧 Components Used:
Arduino UNO
RFID RC522 Module
LCD Display (16x2 or I2C)
Push Buttons (Add / Remove)
Buzzer
Power Supply
💡 Features: ✅ Add or remove products using RFID and buttons ✅ Real-time price update on display ✅ Simple and low-cost prototype ✅ Ideal for IoT & automation beginners
Raspberry Pi5 8GB Laptop, Raspberry pi 5 MIni PC Computer,2.4GHz 64-bit Quad-core Arm Cortex-A76, Bluetooth5.0,BLE Wireless Buy on ✅https://s.click.aliexpress.com/e/_c4VBEEjz ========================================================== Scrolling for smart buys? Stop here, your cart will thank you.
New Arrival Raspberry Pi5 8GB Laptop, Raspberry pi 5 MIni PC Computer,2.4GHz 64-bit Quad-core Arm Cortex-A76, Bluetooth5.0,BLE Wireless Editor’s Choice Raspberry Pi5 8GB Laptop, Raspberry pi 5 MIni PC Computer,2.4GHz 64-bit Quad-core Arm Cortex-A76, Bluetooth5.0,BLE Wireless Get Raspberry Pi5 8GB Laptop, Raspberry pi 5 MIni PC Computer,2.4GHz 64-bit Quad-core Arm Cortex-A76, Bluetooth5.0,BLE Wireless
Mix of budget and banger picks—perfect for quick decision-makers. Minimal fluff, maximum value—curated with love (and coffee).
Stay Connected: 👍 Hit that like button—your support keeps this going! 📝 Comment your favorite pick—let’s crowdsource the best deals! 🔔 Like & subscribe for more finds that actually matter!
No cap, these are the type of products you keep using.
Disclaimer: - Shop smart, stay safe, and when in doubt, ask a pro. - This video is for informational purposes only—always follow the manufacturer’s instructions. - We’re not responsible for product usage outcomes; read manuals and install wisely.
Everyday Linux User is your ultimate resource for making Linux simple and accessible for average computer users! 🐧 Get beginners guides to Linux, practical tutorials, and clear explanations designed for the everyday Linux user – no advanced tech knowledge required! ✨
Subscribe to Everyday Linux User for new, easy-to-follow Linux content every week! ▶️
Like our videos 👍 to help us reach more users.
Support the channel and get exclusive perks by becoming a channel member! 🚀
Send a Super Thanks 💖 to show your appreciation for our free tutorials.
Discover how this compact computer is reshaping innovation and DIY tech with real-world applications:
Ad-Free Browsing – Set up Pi-hole to block ads across all devices Secure Networking – Use PiVPN for protected, private connections Smart Home Control – Automate lighting, security, and appliances with ease Perfect for Learning – Ideal for exploring coding, electronics, and prototyping
Affordable, open-source, and backed by a massive global community, Raspberry Pi gives creators the freedom to build, learn, and innovate without limits.
At Think Robotics, we are dedicated to empowering innovators of all ages by providing a comprehensive range of high-quality robotics components, electronics, and DIY kits. Our mission is to make technology accessible, fostering a global community of builders, creators, startups, and tech enthusiasts.
Explore Our Offerings:
Robotics Parts & Components: Discover a vast selection of products to bring your projects to life.
DIY Kits: Engage in hands-on learning with our kits designed for both beginners and advanced users.
3D Printing Services: Turn your ideas into tangible prototypes with our cost-effective 3D printing solutions.
Join Our Community:
Connect with like-minded individuals, access free tutorials, and collaborate on innovative projects. Visit our website to learn more and become a part of the Think Robotics community.
Stay Connected:
Website: thinkrobotics.com
Facebook: facebook.com/thinkrobotics
Instagram: instagram.com/thinkrobotics
Twitter: x.com/robothink
LinkedIn: linkedin.com/company/thinkrobotics
Contact Us:
For inquiries, support, or collaboration opportunities, please reach out to us at Support@thinkrobotics.com
Robotics || DIY Kits || Artificial Intelligence || Manufacturing || 3D Printing || Electronics || Raspberry Pi || Drones || Automation || Robotics Tutorials || DIY || Electronics || ThinkRobotics || Metal Chassis for Robotics || Ackerman Metal Chassis || Robotics Chassis || Robotics Projects || Robotics Parts || Robotics Components || Robotics Automation
I built a Truth or Dare machine on a Raspberry Pi — in just 4 days. A 40-inch touchscreen, phone voting, and a few too many questionable design choices.
In this episode, I show how I built and programmed the Truth or Dare arcade cabinet for my Halloween setup, connected to my central Meatcorps Arcade system.
Built with: – Raspberry Pi 4 (Debian 12, Chromium in kiosk mode) – C# WebServer + Blazor frontend – 40-inch touchscreen (AliExpress IR frame) – MQTT communication with the arcade core
What’s inside: 0:00 Intro & Monstrosity reveal 0:27 The game loop & Game Design 4:13 Hardware build & Touchscreen 6:02 Community - Haunted cabinet update! 7:20 Touchscreen chaos 11:30 Halloween arcade updates
Would you dare to play this one, or build your own?
ADLINK OSM-IMX95 is an OSM Size-L solder-on system-on-module powered by an NXP i.MX 95 hexa-core Arm Cortex-A55 SoC with an up to 2 TOPS eIQ Neutron...
Mes de Octubre del 2025, Qualcom compra Arduino, dicen que se mantendran con su autonomia y libertad para los "Makers" y ya tienen un Producto en conjunto Arduino UNO Q.
Un nuevo experimento promete cambiar la forma en que entendemos la calefacción doméstica: convertir el calor generado por la computación en una fuente de energía limpia y barata para los hogares...
NextPCB, a global leader in PCB manufacturing and assembly solutions, proudly announces the launch of kicadprojects.com, a dynamic open-source community...
To get content containing either thought or leadership enter:
To get content containing both thought and leadership enter:
To get content containing the expression thought leadership enter:
You can enter several keywords and you can refine them whenever you want. Our suggestion engine uses more signals but entering a few keywords here will rapidly give you great content to curate.