7 Jeremy Blum Video I2C And Processing

So tonight I started working on the #7 Jeremy Blum ‘Arduino basics’ video tutorial. This video covers I2C communication and the Processing programming language.

I2C (Inter-Integrated Circuit), most commonly pronounced I-Squared-C, lets an Arduino communicate with I2C or TWI (Two Wire Interface) devices. In the case of Jeremy’s #7 video, the device is a temperature sensor. The other focus of this video tutorial is the Processing programming language, and that is used in this video to display the temperature data on a computer display.

I2C will be used a lot for microcontroller (MCU) projects, so you’ll want to become familiar and skilled with it. Wikipedia has this to say about I2C:
I²C...is a multimaster serial single-ended computer bus invented by the Philips semiconductor division, today NXP Semiconductors, and used for attaching low-speed peripherals to a motherboard, embedded system, cellphone, or other digital electronic devices. Several competitors, such as Siemens AG...now Intel mobile communications, NEC, Texas Instruments, STMicroelectronics...Motorola...and Intersil, have introduced compatible I²C products to the market...”
SparkFun has a pretty good tutorial on I2C that provides excellent background reading for better understanding the #7 video. The tutorial gives this overview of the protocol:
The Inter-integrated Circuit (I2C) Protocol is a protocol intended to allow multiple “slave” digital integrated circuits (“chips”) to communicate with one or more “master” chips. Like the Serial Peripheral Interface (SPI), it is only intended for short distance communications within a single device. Like Asynchronous Serial Interfaces (such as RS-232 or UARTs), it only requires two signal wires to exchange information….I2C requires a mere two wires, like asynchronous serial, but those two wires can support up to 1008 slave devices. Also, unlike SPI, I2C can support a multi-master system, allowing more than one master to communicate with all devices on the bus (although the master devices can’t talk to each other over the bus and must take turns using the bus lines).”
The master / slave issue is one that will affect your MCU projects that have multiple I2C devices, like a bunch of temperature sensors. Each slave device needs to have its own ID number, and Jeremy mentions that you can sometimes order an I2C device with a specific ID. So that’s something you’ll need to figure out before you order the components for a project.

Jeremy also talks about the SDA and SCL lines. The SparkFun tutorial says this about those:
Each I2C bus consists of two signals: SCL and SDA. SCL is the clock signal, and SDA is the data signal. The clock signal is always generated by the current bus master...Messages are broken up into two types of frame: an address frame, where the master indicates the slave to which the message is being sent, and one or more data frames, which are 8-bit data messages passed from master to slave or vice versa. Data is placed on the SDA line after SCL goes low, and is sampled after the SCL line goes high...To initiate the address frame, the master device leaves SCL high and pulls SDA low. This puts all slave devices on notice that a transmission is about to start.”
If you want to dive deeper into I2C, here are a couple good places, in addition to the above links, to spend a bit of your time:
  1. Adafruit MCP9808 Precision I2C Temperature Sensor Guide (another look at temperature sensors and IC2)
  2. The tronixstuff tutorial on Arduino and IC2
  3. Arduino’s in-depth reference to the Arduino Wire library
  4. Maxim Integrated’s “Proven Implementation of the I2C bus
The temperature sensor used in the #7 video exercise is a Microchip Technology TC74A0-5.0VAT, which you can get from Newark, Digikey and other electronic component distributors. Jeremy mentions checking the Microchip datasheet for the sensor to find out what each pin is for on the sensor. Those pins are shown in the picture to the right.

On the subject of sourcing electronic components, if you haven’t tried using Octopart, a search engine for electronic parts, you might want to give it a try. It’s been very useful for most parts I’ve researched on it. For the #7 video temperature sensor, it gave a helpful view of the cost and availability of the component.

The above temperature sensor is only one of many available temperature sensors. Microchip Technology makes many models, as do other manufacturers like Texas Instruments or Honeywell. There are also temperature sensors which use different technologies, such as thermistor, thermocouple and RTD. I’m doing background research on temperature sensors for a future post on this blog, so if you have questions about temperature sensors, or have a favorite sensor to recommend, email me at arcatabob (at) gmail {dott} com.
Processing language

With regards to the Processing programming language, the main topics in the #7 video are (1) setting the font to be displayed by the Arduino on your computer screen and (2) writing the code to convert the temperature sensor’s input to the Arduino into a computer display of the measured temperature, in both Celsius and Fahrenheit. If you don’t already know how, you’ll learn how to set up the code to let your temperature sensing circuit use Processing, choose and configure your font, grab the temperature data the sensor sends to the Arduino and do math with those signals. For the font, you need to specify color ‘numbers’ for the R, G and B values (red, green, blue). There are lots of tools to help you with figuring out the color values you want, with a 500+ color chart from Cloford.com or the RGB color codes chart from RapidTables being good places to start if you don’t already have a resource for helping you specify color values.
Arduino LED color picker

Two somewhat technical and time-consuming options to consider are color selectors for a smartphone, such as the apps for Android, or, in a slightly recursive twist, the Arduino LED color picker from Andrew Rapp which, in a way, helps you learn about color after you learn about color.  

I guess that’s enough for tonight on I2C, temperature sensing and Processing. If you think you might be able to come to the July 10 meeting of the Humboldt Microcontrollers Group, take a look at the #7 Blum video and read up on those topics a bit. The topics in the video will be the focus of the July 10 meeting. If you have the electronic parts and the time, go through the exercise in the video.

** Important Note ** -- One of the main goals of this blog and the Humboldt Microcontrollers Group is to help connect and expand the community of microcontroller users in Humboldt County and the North Coast. So even if you can’t find the time to go through the video, if you’re interested in I2C temperature-sensing MCU projects or Processing, if you know lots about one of those topics and want to answer questions or share tips, or if you’re just interested in microcontrollers and want to learn more, please show up at the July 10 meeting from 6 to 8 PM at 1385 8th Street, Arcata, California. If youre coming, bring a friend. If you cant come, send a friend!

**********
Read More..

Blum 6 Arduino Video Tutorial Humboldt Microcontrollers Group Meeting

Tonights post is a quick look at the #6 Arduino video tutorial from Jeremy Blum, which is the main topic for the Humboldt Microcontrollers Group meeting this Thursday, June 26.

The #6 video tutorial, Serial and Processing takes a look at how to use an Arduino for communicating with the computer via a serial connection and using a programming language called Processing to visualize information from an Arduino on your computer screen.

For the serial communication between the Arduino Uno and the computer, the 0 RX (receive) pin and the 1 TX (transmit) pin on the Arduino are used. You connect the Arduino to your computer via a USB cable, which has 4 pins in it. One is power and one is ground. The other two are the serial transmit and receive pins. The USB transmit pin from the computer connects with the receive (RX) pin on the Arduino, and the computers USB receive pin connects to the Arduino transmit (TX) pin.

Jeremy runs through a number of Arduino programming examples for learning how to use the serial communication features. If you go through the #6 Blum video and feel you still want a little more background on serial communication with Arduinos, here are three other resources to look at:
  1. The Arduino.cc reference page for serial communications
  2. An Arduino tutorial from Ladyada about serial communications
  3. A guide from Instructables on Serial Communications with Arduino
After he does the serial communications exercises, Jeremy covers a little bit about the programming language Processing. You start out by going to the website for Processing. The home webpage for Processing says its an open source language that:
"has promoted software literacy within the visual arts and visual literacy within technology. Initially created to serve as a software sketchbook and to teach computer programming fundamentals within a visual context, Processing evolved into a development tool for professionals...there are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production."
In addition to the presentation and exercises with Processing that Jeremy Blum has for you in the video, if you want a better understanding of the language, you can spend some time going through some of the tutorials on the Processing website. If those tutorials arent your cup of tea, take a look at these resources for learning the basics of Processing:
  1. The intro page from Arduino.cc for the Processing language
  2. A SparkFun intro called "Connecting Arduino to Processing"
  3. An Instructables session on "How to control LEDs with Processing and Arduino"
Mark your calendar for this Thursday, and plan to be at 1385 8th Street, Arcata, California, from 6 to 8 PM for the Humboldt Microcontrollers Group meeting!

**********
Read More..

Working On Blum Arduino Basics Video Tutorial 2

So tonight I had a chance to work on the exercises in the Jeremy Blum Arduino Basics video tutorial #2 again.

I had started on the #2 video about a week back, but last week needed to return the borrowed Arduino components to the friend from whom I had borrowed them. The official Arduino Starter Kit I had ordered from Amazon showed up on Thursday. So I now had the parts I needed to resume learning about the basics of microcontrollers.

Finally, tonight I had the time to open up the kit and pick up sort of where I left off with the first exercise in Blum video #2. Before I started the video back up, though, I tried to put together the the laser-cut wooden base for the Arduino and breadboard. Annoyingly, the Italian Arduino folks seem to have either neglected to include the screws for attaching the Arduino to the wooden base, or they forgot to specify the size for those screws when they wrote the book that comes with the kit. The book says to fasten the Arduino to the base with three screws, but thats all it says. I guess thats part of the DIY aspect of the kit. If you want to screw the Arduino to the wooden base, figure out the screw size yourself and get them yourself...

After reviewing a bit of the #2 video, I hooked up the Arduino Uno Rev 3 to a breadboard, a 10K ohm resistor, a switch and an LED (light emitting diode). I watched what Jeremy did in the video, I connected the components with the jumper wires, then I rechecked to make sure everything was the same as in the video. One issue I didnt think about the first time I hooked up this circuit was whether it matters which way the current runs through a resistor or, said another way, whether it matters which lead on a resistor is connected to ground. I tried looking that up in the
SparkFun tutorial on resistors, but couldnt find the answer. I decided to just make sure it was hooked up the same way shown in the video, and Ill search later on Google to find the answer about whether resistors are ok with current going either way through them.

With all the components hooked up, I connected the USB cable into my laptop, then into the Arduino. The LED was supposed to only light up when I pushed the switch, but as soon as I hooked up the USB cable, the LED started flashing on and off. Drat! Didnt do that before when I hooked it up. Unplugged the USB cable, then hooked it back up again. LED still flashed on and off.

Then I realized it was a brand new Arduino Uno, fresh from the manufacturer, and it didnt have the Arduino sketch, or program, uploaded to it yet which would make the LED only come on when I held down the button. Once I uploaded the program, which I had written a week ago when I had the borrowed Arduino, the LED worked properly, lighting up when I held the switch down and going off when I let up on the switch. Success!

Getting late, so time to stop for tonight. Tomorrow Ill try to finish Blum video #2.

**********
Read More..

3 Blum Video Tutorial And Time Management

Tonight I worked on the #3 Jeremy Blum Basics of Arduino video tutorial -- again -- and still didnt finish it. I did learn some things, but didnt stay focused enough to finish the video.

One thing Ive learned while doing these Arduino video tutorials is that maybe I need to learn about time management and setting priorities more than I need to learn about microcontrollers! Theres no way doing these first three videos should have taken me this many nights...

Im enjoying the #3 video review of electrical formulas and concepts. Part of the problem is that Im an engineer, and it seems like I should already know lots (most?) of the stuff Jeremy is explaining in this video. So I end up reading background materials and watching videos to learn more about different aspects of what Jeremy is explaining.

Tonight it was LEDs. I didnt have anything on the MCU wiki yet about LEDs. So I pulled up the SparkFun LED tutorial, read a bit in that, hooked up an LED with the Arduino and breadboard and gave it power, then read the Wikipedia entry on LEDs. I also looked a bit at the ElectronicsTutorials entry on LEDs and the Digi-Key / Atmel "LED Driver Basics" video. If any of you know of an online info resource you think is particularly helpful for beginners (or for people experienced with MCUs), please send me a link to that. Ill add it to the wiki.

Between the above (relevant) diversions and a few other non-MCU things I needed to do this evening, I didnt get anywhere close to finishing the #3 Blum video.

Tomorrow, maybe...

**********


Read More..

Blum Video Tutorials Wiki Trying To Learn

Tonights work on microcontrollers involved too many things for me to get very far on actually making the Arduino perform tricks.

Because of not having enough hours in a day and trying to juggle too many balls at once, I wasnt able to watch all of the first three Jeremy Blum Intro To Arduino video tutorials and do all the exercises in them before the May 15 meeting of the Humboldt Microcontrollers Group. I finally got back to working on the videos and exercises for a short time tonight. However, not too much progress was made in the short time I had available. Once again, too many irons in the fire...

Tonight I was working on the first exercise in the #2 video, which involves hooking up the Arduino and
a switch to a breadboard, writing and uploading a program to the Arduino, then using the switch to make the light blink. If all I was doing was connecting hardware, writing simple programs, then running the programs, I probably could have done all of the #2 video tonight.

However, in addition to connect hardware / write program / run program, I was trying to understand more about the hardware (e.g. reading some background info about LEDs). I was also trying to understand the code I was writing (e.g. making sure I knew where to use parentheses and where to use braces), creating new pages for the Humboldt Microcontrollers Group wiki, adding and revising content for the wiki pages, trying to figure out what to write for todays blog post, and trying to figure out how to use the multi-meter to replicate what Jeremy was doing on the video with his multi-meter. He didnt explain how to use the meter (you need to know how or figure it out on your own), so I had to read up on using a multi-meter.

To make significant progress on videos #2 and #3, I need to set aside a three or four hour block, probably on Friday night or Saturday. Hoping to get both videos done this weekend.

Stay tuned for more progress reports on my journey through the Blum video tutorials.

In a future post, Ill also discuss the details of the video tutorials and the electronic hardware needed for learning the basics of using microcontrollers with the Humboldt Microcontrollers Group.

**********
Read More..



Blog Archive

Diberdayakan oleh Blogger.