Saturday, April 21, 2012

Arduino controlling a stepper motor.









I salvaged a stepper motor from an old scanner.I used an Arduino Motor Shield on top of an Arduino,  which the motor shield is useless in this configuration.

The stepper motor has six wires.

To determine the pinout of the stepper motor I connected my multimeter to each pair of wires(from the motor) possible. The two pair of wires that have the highest resistance are connected to pins 8,9,10,11 on the Motor Shield.
The other two wires I have connected to 5V and GND.












I used the stepper_oneRevolution Arduino example program.



Sunday, April 8, 2012

Pan and Tilt Mechanism with 2 Parallax Servos and an Arduino

Here is an Arduino controlled pan and tilt mechanism. 

I used two parallax hobby servos available at Radio Shack. I could have ordered some specialty brackets online, but I have little patience. 

I soldered some header pins onto a perf board for connecting the servo plugs to a prototyping board.


Here is a wiring diagram...  


Control is allowed with 2 100K ohm potentiometers ..  I think ultimately I will connect it to an analog thumbstick that has been collecting dust for a while.














The code is based on the Arduino Knob example program.
// Code to allow the arduino to control 2 servos independently  ..
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
Servo myservo1;
int potpin = 0;  // analog pin used to connect the potentiometer
int potpin1 = 1;
int val;    // variables to read the value from the analog pins
int valu;
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 and 10 to the servo object
  myservo1.attach(10);
}
void loop() 
{
  val = analogRead(potpin);            // reads the value of the potentiometer
   valu = analogRead(potpin1);
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo s
   valu = map(valu, 0, 1023, 0, 179);     
  myservo.write(val);                  // sets the servo position according to the scaled value
   myservo1.write(valu);                 
  delay(15);                           // waits for the servo to get there
 }            


  

Sunday, April 1, 2012

Arduino Pan and Tilt Mechanism with Parallax Servos

  I am working on an Arduino controlled pan and tilt mechanism. (pic top right)
It has two parallax hobby servos available at Radio Shack. I could have ordered some specialty brackets online, but I have little patience. 


  I have the Arduino environment installed and it looks like basic implementation is going to be pretty easy. Arduino has a pretty extensive online knowledge base.


   I soldered some header pins onto a perf board for connecting the servo plugs to...  
  
  Working on setting it up to allow control with 100K ohm potentiometers ..  I think ultimately I will connect it to an analog thumbstick that has been collecting dust for a while. I have not decided.


 I been pulling my hair out the last couple of evenings getting it to control 2 servos with separate potentiometers  simultaneously...


  When I have it working I will post a video to youtube and I will post the code/wiring diagram here.






Saturday, December 17, 2011

HP 1631 D Logic Analyzer



 I just acquired an HP 1631D Logic Analyzer.
It came with the manual.
It passed its self diagnostic test.
 I was considering ebaying it.


 I think that I am going to keep it now.
  
   I haven't used one, but my simple understanding is that it is a binary oscilloscope with a lot of probes. I've heard of it used for diagnosing arrays of antennas and solenoids. 
  I expect it is useful for investigating or confirming the inputs and outputs on microprocessors or microcontrollers.
  Maybe if I wanted to reverse engineer an existing device, or hack on a toy, the analyzer would come in very useful.
I need to read the manual.


To be continued.....

Wednesday, October 26, 2011

Controlling a Basic Stamp II With Visual Basic


Setting the Basic Stamp II's Input/Output or  I/O pins low or high (on and off) with Visual Basic Button_Click events.


...The BASIC Stamp II is a microcontroller with a small, specialized BASIC interpreter(PBASIC) built into its ROM. It is manufactured by Parallax, Inc.
In my example I use the Basic Stamp II Homework Board.
Heads up..
...Controlling a Basic Stamp II with Visual Basic is pretty easy.
...It is required to write a small program to the Basic Stamp itself and then to write a small program with Visual Basic.
...I assume you have some experience with the Basic Stamp Editor and with Visual Basic.
...I am not a programmer but I do consider myself pretty resourceful so through a little research I was able to determine how to do this.

 I connected my Basic Stamp to my laptop with a USB to serial connector.
I picked one up from Radio Shack for about 30 dollars.
Later noticed they do have a Basic Stamp prototyping model available that is ready for USB...
Story of my life.
I am pretty sure that there were some necessary drivers to be installed..I dont remember exactly.





In the PBASIC Editor enter the following code.

______________________________________________________________________________

' {$STAMP BS2}
' {$PBASIC 2.5}
' Hook up a two LEDs to Pins 3 and 4 to test this.
' Then VB code is set up for Com1 incase you have to change this to the Com
' port of your computer.


  Main:
  SERIN 16, 16468, [STR command\1]    ' Get 1-byte string


CheckCommand:
  IF command = "1" THEN
     GOTO Task1
  ENDIF
  IF command = "2" THEN
     GOTO Task2
  ENDIF
  IF command = "3" THEN
     GOTO Task3
  ENDIF
  IF command = "4" THEN
     GOTO Task4
  ENDIF
GOTO Main


Task1:
HIGH 3
GOTO Main
Task2:
LOW 3
GOTO Main
Task3:
HIGH 4
GOTO Main
Task4:
LOW 4
GOTO Main
______________________________________________________________________________

I downloaded a evaluation version  of Visual Basic 2010 Express
I hope that you have some experience with it.
Create the necessary controls and label them properly.
 Then enter the following code.

Public Class Form1
    Private WithEvents serialPort As New IO.Ports.SerialPort


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        IF serialPort.IsOpen THEN
            serialPort.Close()
        END IF
        Try
            With serialPort
                .PortName = "COM10"
                .BaudRate = 9600
                .Parity = IO.Ports.Parity.None
                .DataBits = 8
                .StopBits = IO.Ports.StopBits.One
                .Handshake = IO.Ports.Handshake.None
            END With
            serialPort.Open()
        Catch ex As Exception
            MsgBox(ex.ToString)
        END Try


    END Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        serialPort.WRITE("1")
        TextBox1.Text = "LED 1 ON"
    END Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        serialPort.WRITE("2")
        TextBox1.Text = "LED 1 OFF"
    END Sub


    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        serialPort.WRITE("3")
        TextBox2.Text = "LED 2 ON"
    END Sub


    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        serialPort.WRITE("4")
        TextBox2.Text = "LED 2 OFF"
    END Sub
    Private Sub Form1_close()
        serialPort.Close()
    END Sub


    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged


    END Sub


    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged


    END Sub
End Class

' I hope that the information is useful.
' Forgive my brevity... Watching TV...and I'm hungry.
' I will respond to any comments and try to answer any questions.

Wednesday, October 19, 2011

8 Step Sequencer with 555 Timer and 4017 Decade Counter


I set this one down some time ago but it was my goal was to build an 8 step sequencer with a 555 Timer and a 4017 Decade Counter.
I know this shit is old school but you gotta learn somehow.


supplies:
4017 decade counter
555 timer
capacitors
resisters
perf. board or bread board

Some knowledge of the 555 Timer is helpful.

 I picked up a few 4017s from Jameco Electronics  for like .40 cents each.
The rest of the stuff I got from a local Radio Shack.
The 555 timer produces an oscillating square wave, which triggers the 4017 decade counter IC, 8 of which its outputs are connected to LEDs. I have the counter set to reset after 8 steps, by simply connecting the next output pin to the reset pin. The green wires are the outputs of the 4017.
For an example check my video.
                                                      http://www.youtube.com/watch?v=rR9tFKMrAFs

Suggestions and/or inspiration would be greatly appreciated. I may pick this project up again.
  • Should each output of the 4017 Decade Counter be connected to a separate tone generator?
  • Should I connect all of the outputs to the same tone generator and vary the frequency of the tone via a potentiometer connected in between each out output of the 4017 and the tone generator? ...and if so some direction as to the implementation would be greatly appreciated.

Tuesday, September 20, 2011

The Ellipsis..My Two Sense on the Three Dots

Use of multiple periods in a sentence...
I do this a lot, especially in text messages. To me it means that this conversation "ain't" over.
I have noticed that when I see someone else do it that I feel a special kinship toward that person, even though it is only a mutual love for multiple little black dots. I did a little research...and by little I mean a LITTLE. I have determined that this is called an ellipsis. Peep that on wikipedia if'n you don't believe me. http://en.wikipedia.org/wiki/Ellipsis. I read someone call it lazy. As if I didn't want to have to determine correct punctuation. Maybe that is the case. If that person had to do what I do all day I am pretty sure they would feel a bit lazy. Someone said they use it to show an awkward pause. I can see that. According  to someone the correct use is for omitting parts of a long quote. Regardless of what anybody says I don't think that no one person or group of people has the right to determine the "correct" use of a language that has borrowed so heavily from other languages and has evolved so much over time. Just my two sense on the three dots...