Tuesday, July 26, 2011

Tasks

Tasks

Please respond to these tasks in your blog using the same reference numbers.


  1. Find two Arduino based robot YouTube videos that appeal to you. Put the links into your blog and be prepared to share the videos with the rest of the class.
  2. Find a diagram of our Arduino board or similar and indicate with arrows where the Tx and Rx pins are on the Arduino I/O pins as well as on the microprocessor itself.
  3. Write a program to display the ascii table in the serial monitor. Publish a screen shot in your blog.
  4. Wind up the baud rate in program 4 and report how fast you could get it.
  5. Write a program to take a key press and output the key and its codes in binary, decimal in hex.
  6. Repeat 5 but this time use another serial monitor, perhaps Bray++. Screen shot required.
  7. Connect up your RS232 Tx to the Rx of another Arduino. Output an "A" every second so that the input screen of the other Arduino writes this when it checks and prints the input serial screen. Take a photo of your set-up and publish it in your blog along with the code for Rx and Tx Arduinos. Reverse your roles with your colleague's Arduino. That is, swap the Rx/Tx duties.
  8. Wrie a function called Hello() to output "Hello, world." when it's invoked. Call this function 10 times in your main loop().
  9. Write a function DoubleInt to double an integer. Call it like this: Serial.println(DoubleInt(myInt)). Call it twice; once with a number and once with a variable.
  10. Write a function to add B0111 to a byte passed to it. Call it 256 times in loop() using 0-255 as the parameters.
  11. Write a function to AND a byte with B01 and output the result to the screen. Test this in the main loop().
  12. Write a function to say "yes" if the LSB (least significant bit) is a 1 or "no" otherwise. Test in the main loop.
  13. Write a function to left shift a byte in the parameter postion two places to the left then output the original and the final byte.
  14. Write a program to output the bits, one by one, to the serial monitor screen from an arbitrary byte.
  15. Write a subroutine to output a byte using the RS232 soft-serial protocol using 8,N,2 at 9600.
  16. Input bytes into a colleague's Arduino using the soft-serial from your pin to the Rx of your colleague's Arduino. Write up your code and take a photo of the set-up.
  17. Write a soft-serial input, Rx, subroutine that takes bytes from a normal 5v RS232 Tx output at 8,N,2 at 9600.
  18. Get your new motor mini-board to spin in one direction.
  19. Get it to spin in both directions.
  20. Get it, using PWM, to spin at different rates.
  21. Output, using the photo-interrupter, the number of revolutions per second, your motor spins at.
  22. Same as 21 but this time using the PWM to raise and lower the speed that is reported on the screen.
  23. Same as 22 but this time add a comment with each speed output to indicate which direction it is spinning.
  24.  Use the example given in class to write your own two wire protocol that can deliver 8 bits on the data line and use the clock line to indicate valid data. Test with a colleague's Arduino and write up your results.
  25. Same as 24 but this time use a four-bit data path.
  26. Plan a TWI between two Arduinos. Scan a diagram, or illustrate in some other way, how the connections will be set up and which is master and which is slave. Have a look at http://absences.sofianaudry.com/en/node/10  or at http://arduino.cc/en/Tutorial/MasterWriter for some example code.
  27. List the main functions of the Wire library. Say what they do with examples.
  28. Construct a real TWI between two Arduinos. Take a photo and publish your code and any issues you had.
  29. If I had three Arduinos, is it possible to produce an RS232 ring so that packets of information could go from any Arduino to any other?
  30. Write a paragraph about the two hardware interrupts on the Arduino and how to use them.
  31. Carry out the interrupt experiment from the Interrupt post. Change the code you find here.
  32. Find the post on the Triple Axis Accelerometer. This is an example of a sensor we have to deal with. Find out more information about this sensor and compose a schematic illustrating how you would use an Arduino to real acceleration in three dimensions and display the outputs. Your blog output should contain a schematic and code.
  33. Find a pin-out of the XbeePro. Using just Arduino's Tx, Rx ,Gnd and 3.3 VCC draw a quick schematic of how two Arduinos would talk to each other without wires.
  34. Use the above two tasks to produce a schematic of  a circuit that would read the accelerometer 's three axis readings and then output to an Arduino and then broadcast out to another Arduino that would send the data to a serial terminal for saving in a file. 
  35. Write the Arduino code for the sender that reads the accelerometer values and sends them via the XbeePro.
  36. Write the Arduino code for the receiver that's attached to the PC.
  37. Integrate the new eeprom library from the link here. You should be able to #include this new library this.
  38. You were issued with an eeprom 24LC64 IC. This is a TWI memory that you connect to SCL and SDA on the Arduino. Run the program from the blog. Show your code changes and the serial monitor output in your blog.
  39. The problem with the program above is that it can only handle about 30 bytes at a time. Overcome this problem so that any amount of data can be sent up to the capacity of the chip. Write up your findings.
  40. Copy the Timer0 Polling routine given to you in a previous post and run it with some tidying up. Show your tidy code.
  41. Repeat the program in 40 but this time make it work a one second LED flash using an interrupt service routine.

The asynchronous packet in RS232 transmission

RS232

Communication

All intelligent mechanisms need a way of sending and receiving data. An old standard, still used is the RS232 serial standard.

A good site for RS232 information

First Post

Automation and Robotics Second Semester 2011