Archive for the ‘Uncategorized’ Category.

Useful Electronics Videos

I’ve been reading though the Art of Electronics again, and often find youtube videos help clarify various points. Here’s a list.

Current

I found this write up very useful: and the other writeups on that site. These videos were nice too:

Capacitors

Inductors

Impedance

Diodes

Transistors

BJT:

MOSFET:

Amplifiers (leading to OpAmps)

Differential (OpAmp first stage)

Buydisplay Captouch panel

Focusing on getting the captouch controller on this panel working under Linux.

This display: here
Uses this datasheet: here
Which is this captouch controller: here
Raw display module datasheet: here

Initial testing with a Buspirate v4, powered by Buspirate 3.3v supply, pullups enabled:

photo-26

Buspirate setup commmands, final command scans I2C bus:

m
3
1
2
e
2
W
P
(1)

Output:

I2C>(1)
Searching I2C address space. Found devices at:
0x70(0x38 W) 0x71(0x38 R)

Attached to a Linux System, appearing in i2cdetect now need to compile a kernel module:

photo-29

photo-28

CY8CTMA340 Captouch controller fiddling

Some info from chipworks: http://chipworks.force.com/catalog/ProductDetails?sku=CYP-CY8CTMA340&viewState=DetailView

Some interesting info in Chinese here: http://www.go-gddq.com/html/s25/2013-05/1128993p3.htm

Including this schematic:

CYTOUCH

Another one ( http://www.touch-link.com/case/6870533111.html ):
tma463sch

SeeedStudio Motorshield V2 with STP 42D206 Stepper

I was trying to use a STP42D306 stepper with a SeeedStudio Motor Shield V2 on an Arduino. This is a bipolar 2 phase stepper motor. I needed to modify the code to get it working as the SeeedStudio example is for a Unipolar motor. The code used is below. And here’s a pic of the setup:

image

No guarantee that I’ve done it correctly, but the motor spins clockwise/anticlockwise. There are some nice diagrams of the stepping process here.

//  Demo function:The application method to drive the stepper motor.
//  Hareware:Stepper motor - 24BYJ48,Seeed's Motor Shield v2.0
//  Author:Frankie.Chu
//  Date:20 November, 2012
#define MOTOR_CLOCKWISE      0
#define MOTOR_ANTICLOCKWISE  1
/******Pins definitions*************/
#define MOTORSHIELD_IN1	8//8
#define MOTORSHIELD_IN2	11//11
#define MOTORSHIELD_IN3	12//12
#define MOTORSHIELD_IN4	13//13
#define CTRLPIN_A		9//9
#define CTRLPIN_B		10//10

const unsigned char stepper_ctrl[]={0x27,0x36,0x1e,0x0f};




struct MotorStruct
{
	int8_t speed;
	uint8_t direction;
};
MotorStruct stepperMotor;
unsigned int number_of_steps = 200;
/**********************************************************************/
/*Function: Get the stepper motor rotate                               */
/*Parameter:-int steps,the total steps and the direction the motor rotates.*/
/*			if steps > 0,rotates anticlockwise,			   			   */
/*			if steps < 0,rotates clockwise.           				   */
/*Return:	void                      							      */
void step(int steps)
{
	int steps_left = abs(steps)*4;
	int step_number;
	int millis_delay = 60L * 1000L /number_of_steps/(stepperMotor.speed + 50);
delay(millis_delay);


	if (steps > 0) 
	{
		stepperMotor.direction= MOTOR_ANTICLOCKWISE;
		step_number = 0; 
	}
    else if (steps < 0) 
	{
		stepperMotor.direction= MOTOR_CLOCKWISE;
		step_number = number_of_steps;
	}
	else return;


	while(steps_left > 0) 
	{
  
               if(step_number%4 == 0) {
                 digitalWrite(MOTORSHIELD_IN1,1);
                 digitalWrite(MOTORSHIELD_IN2,0);
                 digitalWrite(MOTORSHIELD_IN3,0);
                 digitalWrite(MOTORSHIELD_IN4,0);
                 digitalWrite(CTRLPIN_A,1);
                 digitalWrite(CTRLPIN_B,0);                                
               }
               if(step_number%4 == 1) {
                 digitalWrite(MOTORSHIELD_IN1,0);
                 digitalWrite(MOTORSHIELD_IN2,0);
                 digitalWrite(MOTORSHIELD_IN3,1);
                 digitalWrite(MOTORSHIELD_IN4,0);
                 digitalWrite(CTRLPIN_A,0);
                 digitalWrite(CTRLPIN_B,1);                                
               }
               if(step_number%4 == 2) {
                 digitalWrite(MOTORSHIELD_IN1,0);
                 digitalWrite(MOTORSHIELD_IN2,1);
                 digitalWrite(MOTORSHIELD_IN3,0);
                 digitalWrite(MOTORSHIELD_IN4,0);
                 digitalWrite(CTRLPIN_A,1);
                 digitalWrite(CTRLPIN_B,0);                                
               }
               if(step_number%4 == 3) {
                 digitalWrite(MOTORSHIELD_IN1,0);
                 digitalWrite(MOTORSHIELD_IN2,0);
                 digitalWrite(MOTORSHIELD_IN3,0);
                 digitalWrite(MOTORSHIELD_IN4,1);
                 digitalWrite(CTRLPIN_A,0);
                 digitalWrite(CTRLPIN_B,1);                                
               }               
  
		//PORTB = stepper_ctrl[step_number%4];
		delay(millis_delay);
		if(stepperMotor.direction== MOTOR_ANTICLOCKWISE)
		{
			step_number++;
		    if (step_number == number_of_steps)
		    	step_number = 0;
		}
		else 
		{
			step_number--;
		    if (step_number == 0)
		    	step_number = number_of_steps;
		}
		steps_left --;
		
	}
}
void initialize()
{
	pinMode(MOTORSHIELD_IN1,OUTPUT);
	pinMode(MOTORSHIELD_IN2,OUTPUT);
	pinMode(MOTORSHIELD_IN3,OUTPUT);
	pinMode(MOTORSHIELD_IN4,OUTPUT);
	pinMode(CTRLPIN_A,OUTPUT);
	pinMode(CTRLPIN_B,OUTPUT);
	stop();
	stepperMotor.speed = 1;
	stepperMotor.direction = MOTOR_CLOCKWISE;
}
/*******************************************/
void stop()
{
	/*Unenble the pin, to stop the motor. */
	digitalWrite(CTRLPIN_A,LOW);
    digitalWrite(CTRLPIN_B,LOW);
}

void setup()
{
	initialize();//Initialization for the stepper motor.
}

void loop()
{
	step(200);//Stepper motors rotate anticlockwise 200 steps.
	delay(1000);
	step(-200);//Stepper motors rotate clockwise 200 steps.
	delay(1000);
}