Monday 24 September 2012

Spin motor spin.. please? come on SPIN WILL YOU!!!

The Arduino spin motor spin does not seem to work as smoothly as the Arduino code book would like us to believe. The myth is yet to be solve but it seems that the transistor is to blame for the mishap of the motors movement.

First thoughts were that one needs the 330 ohm resistor instead of the 10k.
Second that the diode (one way value) is pointing the wrong way.
..Perhaps the positive and negative motor wires are the wrong way around.

first lets have a look at the making of the transistor. Below is a handy site which explains the transistor in english and will aid in your understanding of this revolutionary tool


 Basically though - the transistor has a positive or collector (typically to the left of the flat part) and a negative or emitter (typically to the right of the flat part). The current will go from positive to negative therefore it goes from positive to collector and emitter to earth. The other prong (the middle one) is the thing that triggers the transistor - it receives a signal and the circuit works - no signal - no transistor - no circuit.

Now, the thing that absolutely baffles me is that to get this thing to work I have to connect the transistor to the circuit backwards. With the current flowing into the emitter and then coming out of the collector to ground - IT WORKS!

First I thought that maybe the transistor I had was built backwards?

data sheet time.

no. not the answer.

Is the diode pointing the incorrect way?

no, make sure that the diode (the black band points to the direction you want the current to flow) is pointing  from positive to negative and it will control the speed of the motor. If it's the other way around the motor speeds up substantially.


A diode makes sure that the current flows one way and avoids a backwards short circuit.

The diode in our case is meant to create a loop surrounding our motor. I guess this is to make sure the current doesn't flow back through the motor which would stall it.

Is the motor the wrong way around?

No, it totally doesn't matter it just changes which way the motor spins.

The circuit is clearly working as if you just connect the motor to 5v and GND it goes ballistic, so what is going on? The other odd phenomenon which occurs is:

IF I SET IT ALL UP ACCORDING TO THE BOOKLET AND SWITCH THE 5V AND GND IT WORKS! 

After all of this however if you set it up correctly (as per the book) making sure that:
-the diode is pointing the correct way (black strip up towards 1)
- you use the 330 ohm you can then control the motor.
- that the flat part of the transistor is facing j (contrary to what I just told dan)
It will work wonderfully.I decided to give the instructions one last red hot go - this time it worked... I think this is going to be one of those long frustrating semesters.

conclusion - not sure what happened tonight however the circuit seems to work if you put the diode and transistor backwards however the code then doesn't work.

CODE03 lesson 3

IF ALL ELSE FAILS READ THE INSTRUCTIONS -  IF THAT FAILS LISTEN TO PAUL. 

Time to code my motor. Yay!

Adding the light sensor was pretty straight forward after we got them working.
I was all about grabing the value from the analogRead function and mapping it to 0 - 255 and applying that to the engines on/off function. Lastly we re jigged the code to make it more responsive to the changing light.

Lastly I managed to snap the cord off my motor, which concluded my evening and this post.

P.s to Stephen - I know the colour scheme I'm just pretty colour blind thus becomes a little frustrating whilst at home.

Saturday 8 September 2012

First meeting.

The workshop was nothing near what I expected, but seems like a very interesting group of people. The range of things these guys did was fascinating however the project that jumped out at me was an appliance shield for the Arduino. One of the members of the group had created a shield (plugs on top of the Arduino) which you can then connect and control your appliances with. He couldn't stress enough about how dangerous it was (burn your house down dangerous) but it is inline with where i'd like to be with digital design.

Exercise 1

The first real exercise for me was to get the Arduino working on windows 7. As i'd never done any thorough 'run' based mods to the system is was the tiniest bit daunting. The LED light display was really exciting but i;m curious to know the science behind how the circuit board is programmed. I started reading about it here but there were too many acronyms for me to follow. My option is to ask the guys at the next meet for a dumbed down version.

Exercise 3

Whilst the many LEDs of exercise two work fine I cannot get the motor to turn in exercise three. I'm not sure what I've missed so again it's one for next meeting. I'm hoping to rig the fan up in front of the thermometer and have it switch on a a certain temperature, then as the blown air cools the thermometer the fan will turn off. Simple.

Class.

In class following the first meeting we ran through a little bit of ohms law. V = I/R:
V - voltage - the big water tank creating pressure at the top of the circuit.
I - Current - is the water that goes through the circuit.
R - Resistance - the size of the pipes that are in the circuit.

So, If you have a massive water tank full of current and only little pipes (lots of resistance) only a tiny bit of current will fall through. However if you have a massive pipe and a little tank all the current will disappear through the system very quickly. This is why ohms law is so important to electronics.

from there we experimented with the Blink project. To make it more interesting we added 'variable resistors' in the form of a dial and a flex sensor; these two thinks help control the speed at which the LED blinked.

LED :: DIAL :: FLEX SENSOR

To get the variable sensors to talk to the LED we needed to send it through the analog in's and use the function analogRead(XXXX). we then gave the returned value to an integer ei 'lightLevel' which we then fed into the stop start integers of the LED.

Concurrently we learnt the Serial.begin(9600); / Serial.println(XXXX); commands. This allowed us to monitor the information going to and coming from the arduino board which assisted us in debugging our code.