November 21, 2004
possible parts
3rd wheel:
Posted by phaedra at 08:19 PM | Comments (0)
November 13, 2004
Initial Parts Order
i placed our first major parts order on Monday, November 15.| vendor / order # | qty | item | price | order cost |
|---|---|---|---|---|
| all electronics - W188268 | 50 | PHOTO-TRANSISTOR | $ 0.50 | |
| 15 | HEAVY-DUTY TO-220 HEATSINK | $ 0.33 | ||
| $36.00 | ||||
| sparkfun - 3306 | 20 | Crystals (4 MHz - US) | $0.95 | |
| 1 | Super Bright LEDs | $30.00 | ||
| $54.85 | ||||
| jameco - 13590740 | 1 | ULTRA SONIC MOVE DETECTOR | $29.95 | |
| 3D XMAS TREE (phaedra's) | $10.95 | |||
$47.84 |
||||
Total Purchased |
$127.74 | |||
| qty | part | total cost | website/link |
| 50 | phototransistors | $25.00 | all electronics |
| 15 | heat sinks | 3 for $1.00/$5.00 | all electronics |
| 20 | 4 MHz Oscillators | $0.95/$19.00 | sparkfun |
| 20 | white superbright LEDs | $27.00 | sparkfun |
| 30 | white superbright LEDs | $30.00 | sparkfun |
| 1 | brilliant white LED cluster | $1.99 | electronic goldmine |
| 5 | H-bridge | $1.88/$9.40 | newark |
| 1 | ultrasonic kit | $29.95 | jameco |
| 24 (8x3) | 9v batteries | $36 (or a little less) | cheapbatteries |
| 8 | 9v battery adapters | $0.95/$7.60 | sparkfun |
this is stuff i still have to look up but it's after 2:30 & i need to go to bed.
9v battery mounts
LED driver
digital potentiometer - todd. flower LED control
speaker possibility for flower - $12.00 http://www.junun.org/MarkIII/Info.jsp?item=77
Posted by phaedra at 01:59 AM | Comments (2)
November 12, 2004
The begining of a PIC translation
some code notes - in process.... sorry!
'****************************************************************
'* Name : robot_code1.BAS *
'* Author : BX by C.Goodness, modified by Carlyn Maw *
'* Notice : Copyright (c) 2004 *
'* : All Rights Reserved *
'* Date : 4/16/2004 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
'needed for serin and serout
include "modedefs.bas"
DEFINE OSC 4
'Ports needed
' 2 ADC in, serial communication, 4 pins for the motors
' hardware serial?
' ----------------------------------------------------- PORT SET-UP
' Ports needed
' 2 ADC in, serial communication, 4 pins for the motors
' hardware serial?
'so.. for example
'set pins RC0-RC3 to input:
TRISC = %00001111
'set pins RB0-RB3 to output:
TRISB = %00000000
' --- Serial Port set up
'this is one way to set up for serial communication
'set pin porta.1 as rx and clear values:
TRISA = %10000010
PORTA = 0
'use PORTA for the serial port/cobox communication
tx var portc.6 'out
rx var portc.7 ' in
'old BX code to do it
gosub defineCom3(5, 6, bx1000_1000)
' set aside memory for input and output:
gosub openQueue(inputBuffer, 13)
gosub openQueue(outputBuffer, 50)
' ----------------------------------------------------- CONSTANTS
'movement constant
basicSpeed con 100
' -- serial information
inv9600 con 16468 ' baudmode (9600 8-N-1 inverted)
true9600 con 84
' ----------------------------------------------------- VARIABLES
'serial var, also not sure of size...
inputBuffer var byte '4-byte output buffer.
outputBuffer var byte '1-byte output buffer.
' -- ir and ultrasonic vars (words or ints I'm not sure...)
readMotion var word
getDistance var word 'getDistance is the IR reading
getSonic var word 'getSonic is the Ultrasonic reading
' ----------------------------------------------------- GENERAL COUNTERS
' varialbles for for loops, etc
x var byte
' ----------------------------------------------------- DUMMY DATA
' i make tis section for faking input data to isolate what I am
' checking in code, so for example fo fake what the ir data is
' ----------------------------------------------------- START MAIN
main: 'this is pseudo code to get values from sensors
' this is the BX code, never done ADC in PIC
getDistance = adcin 0, sensorValue getADC(15) ' get the ADC value from the IR
getSonic = adcin 0, sensorValue getADC(10) ' get the ADC value of Ultrasonic reading from pin 10
'set the basic speed to full stop on both motors
this would all be serout? (debug statements)
'call putQueueStr(outputBuffer, cstr(readMotion)
'print out value being read on pin 13/ultrasonic
readMotion = ((1024 - getDistance) \ 8)
Debug.Print "Distance reading: "; CStr(readMotion)
Debug.Print "Sonic reading:"; CStr(getSonic)
'around three inches, it bottoms out at 65, then numbers start going up again
'between zero and three inches
'it ranges from 63 to 110
'above three inches it ranges from 63 to 127
'---------- my serout code from a different program
'------------------------------------------------------- SEND DATA
'' serout2 tx, inv9600, [parkName]
'sendVAR = ~switchVAR
sendArray[0] = 104
sendArray[1] = switchVAR & %11111111
sendArray[2] = switchVAR >> 8
for x = 0 to 2
serout2 tx, inv9600, [sendArray(x)]
next
'-------------------------------------------------------- GET DATA
serin2 RX, inv9600, 100, nodata, [wait("h"), str recieveArray\2]
remoteVAR = recieveArray(1) << 8
remoteVAR = recieveArray(0) | remoteVAR
' --- end of my serin/serout example
'okay, so if I was writing this I would just set the port values here? why didn't she? (Using portB b/c port C has the serial stuff on it) The PWM stuff might be harder this way if the wheels need to move a different speeds... but
'0000 = you have 4 bits here
'0101 = both motors going forward
'1010 = both motors going backwards
'0000 = both motors stopped, etc.
so the same table as below would be
'Name lDirection rDirection
'direction old new
'leftForward 1 3 PORTB = %00000100
'leftBackward 2 3 PORTB = %00001000
'rightForward 3 1 PORTB = %00000001
'rightBackward 3 2 PORTB = %0010
'standStillLeft 1 2 PORTB = %0110
'standStillRight2 1 PORTB = %00001001
'stop 3 3 PORTC = %00000000
'fullForward 1 1 PORTB = %00000101
'fullBackward 2 2 PORTB = %00001010
'what is the 1-100 business for? just a counter to make it move?
'not sure how to do the
if ( getSonic > = 200 ) && ( getSonic < 300 ) then
PORTB = %00000001
ElseIf ( getSonic > = 300 ) And ( getSonic < 400 ) Then
PORTB = %00000100
ElseIf (readMotion > basicSpeed) Then
'
ElseIf( readMotion = basicSpeed) Then
'
ElseIf(readMotion < basicSpeed) Then
'
' END OF MAIN PROGRAM
goto main
Posted by cm1002 at 05:43 PM | Comments (0)
Links for parts and other stuff
Sparkfun: www.sparkfun.com in the components section: superbrite white LEDs on sale fro about $.30 each. They also have lots of other cheapo parts like H bridges and phototransistors.
Posted by christina at 05:29 PM | Comments (0)
To Do List
Carlyn: Post code to blog
Christina: Type everything up
Phaedra: Place parts order
DD and Joe: Post the diagram of the scenario on the blog
Posted by christina at 05:25 PM | Comments (0)
Behavior Summary
Bee behavior summary:
- sense environment in general: current IR & US sensors: 2 input pins
- do not collide: current sensors: IR and US - same 2 input pins
- respond to flower beacon light: system health: 3 phototransistors: 3 input pins
- respond to eachothers lights: 3 phototransistors: 3 input pins
- transmit their own lights: white superbrites: no pins required
- motor control: HBridges: 4 output pins
- microcontroller: PIC 18F252 and 4MHz crystals
Posted by christina at 05:15 PM | Comments (0)
November 09, 2004
Part List and Notes for old robot
List of parts and notes on old robot:
List of parts used in old robot:
Notes:
Posted by christina at 11:25 AM | Comments (0)
Robot Code from BX-24
Here's the code as it worked on the BX. the main things to change, I believe, are the pins (defining input and output and just making sure the pins are connected to the right ones).
Option Explicit
Dim inputBuffer(1 To 13) As Byte '4-byte output buffer.
Dim outputBuffer(1 To 50) As Byte '1-byte output buffer.
Dim basicSpeed As Integer
Dim readMotion As Integer
Dim getDistance As Integer 'getDistance is the IR reading
Dim getSonic As Integer 'getSonic is the Ultrasonic readingPublic Sub Main() 'this is pseudo code to get values from sensors
' define which pins COM3 will be:
Call defineCom3(5, 6, bx1000_1000)
' set aside memory for input and output:
Call openQueue(inputBuffer, 13)
Call openQueue(outputBuffer, 50)
Do
getDistance = getADC(15) ' get the ADC value from the IR
getSonic = getADC(10) ' get the ADC value of Ultrasonic reading from pin 10
basicSpeed = 100 'set the basic speed to full stop on both motors
'call putQueueStr(outputBuffer, cstr(readMotion)
'print out value being read on pin 13/ultrasonic
readMotion = ((1024 - getDistance) \ 8)
Debug.Print "Distance reading: "; CStr(readMotion)
Debug.Print "Sonic reading:"; CStr(getSonic)'around three inches, it bottoms out at 65, then numbers start going up again
'between zero and three inches
'it ranges from 63 to 110
'above three inches it ranges from 63 to 127If ( getSonic > = 200 ) And ( getSonic < 300 ) Then
'Sonic debug.print "rightForward"
call directionControl( 3, 1 )
ElseIf ( getSonic > = 300 ) And ( getSonic < 400 ) Then
' Sonic debug.print "leftForward"
call directionControl( 1, 3 )ElseIf (readMotion > basicSpeed) Then
' IR Debug.print"too close - reverse"
Call directionControl( 2, 2 )ElseIf( readMotion = basicSpeed) Then
'IR debug.print"stop"
call directionControl ( 3, 3 )
ElseIf(readMotion < basicSpeed) Then
' IR debug.print "go straight"
call directionControl( 1, 1 )'ElseIf( ?? ) Then
' debug.print "leftForward"
' call directionControl( 1, 3 )
'ElseIf( ?? ) Then
' debug.print "standStillLeft"
' call directionControl( 1, 2 )
'Else
' debug.print ""
' call directionControl( 1, 1 )End If
Loop
End Sub
' END OF MAIN PROGRAMPublic Sub directionControl( byVal lDirection as Integer, byVal rDirection as Inte ger )
'THIS SECTION EXPLAINS THE LOGIC OF THE DIRECTIONS
'Direction Key
'Forward( 1)
'Backward( 2)
'Stop( 3)
'Name lDirection rDirection
'leftForward 1 3
'leftBackward 2 3
'rightForward 3 1
'rightBackward 3 2
'standStillLeft 1 2
'standStillRight2 1
'stop 3 3
'fullForward 1 1
'fullBackward 2 2
'BEGINNING OF SUB CODE FOR MOTOR DIRECTION COMMANDS
'debug.print "A"
Dim x As Integer
For x = 1 To 100
' each iteration of the loop,
' move the L and R motors in the direction specified
' by the input parameters'LEFT MOTOR
Select Case lDirection
Case 1
'Forward( 1)
call putPin( 11, 0 )
call putPin( 12, 1 )
Case 2
'Backward( 2)
call putPin( 11, 1 )
call putPin( 12, 0 )
Case 3
'Stop( 3)
call putPin( 11, 0 )
call putPin( 12, 0 )
Case Else
' not supported
End Select'RIGHT MOTOR
Select Case rDirection
Case 1
'Forward( 1)
call putPin( 13, 1 )
call putPin( 14, 0 )
Case 2
'Backward( 2)
call putPin( 13, 0 )
call putPin( 14, 1 )
Case 3
'Stop( 3)
call putPin( 13, 0 )
call putPin( 14, 0 )
Case Else
' not supported
End Select
Next
End Sub
Posted by christina at 10:59 AM | Comments (0)
November 08, 2004
ToDo and Ideas - Nov 8
To Do
Port Exisiting Code to PIC Basic v1.0 - Carlyn
Research other Part Options - Christina
Post the information for the current Robot - Christina
Decide what the flower is looking for on the Network - Joe and Dedi
Researching Ultra Sonic - Phaedra
Thinking about what they look like - Everybody
What flocking behaviors are interesting - Everybody
Posted by cm1002 at 07:45 PM | Comments (0)