Python

http://learnpythonthehardway.org/book/ex1.html

A great guide to help start up with python.

1) print (“this is a string”)

It will print to the Python Shell or if you want to run in in the terminal you can by typing in: python followed by the file name. (Make sure your in the right directory).

Any errors in your code will be brought to your attention by the terminal when you run your script and it will also print the line the error is on.

 

2) Commenting out on python is just like any other programming language and uses a # to comment out single lines.

3)

  • + plus
  • - minus
  • / slash
  • * asterisk
  • % percent
  • < less-than
  • > greater-than
  • <= less-than-equal
  • >= greater-than-equal

To do maths or equations with python, you can write in the numbers and use the expressions above.

4) Variables in python are the same as any other programming language and are set above the code for global use.  Multiple word variables can be written with _.

Also an = is an assigning expression assigns the value on the right to the variable on the left, eg, car = 5.

5) Format strings, these are like normal strings but have variables embedded into them. To use a format string you have to use “string” rather then the ‘string’ , and to write one in the program you”

“string here” % variable name

The % is a module key which add’s in variables to the line.

6) Strings and text, this section describes how we can use combine strings””, variables, numbers and operations all together for example:

hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"

print joke_evaluation % hilarious

This would print “Isnt that joke so funny False”

7) “text\ntext\n”

This will output text into a new line /n stands for newline character

Another extra to strings is the :

"""
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""

LED parallel

Setting up LED ‘s in parallel is extremely simple and the best way to power on multiple Led’s. It means you only need 1 connection to the negative and one to the positive.

It also means each LED gets the full 3v to it rather then a section of the 3 volts.

Python 3

Something I should have started learning a long time ago is python, and now this project is starting to enter python territory it seems like the best time to learn it.

There is a massive difference between Python 2 and Python 3 in terms of the syntax used:

http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf

AC vs DC

In this post I shall be noting down the differences AC voltage and DC voltage.

AC: Stands for alternating current  and travels in whats called an sinusoid or wave like pattern.  This allows the current to flow in an alternating repetition, with the up curve being positive and the down curve being negative.

Ac is what powers your mains or anything that gets powered from far away as the wave pattern can travel further then DC’s straight line current flow.

DC: Stands for direct current given it’s flow of current which can be visualised by a straight line which moves in one direction. This current travels at a constant speed which makes it perfect to control the voltage output which is why batteries are DC voltage and that’s why a lot of  components/toys take DC voltage.

 

http://engineering.mit.edu/ask/what%E2%80%99s-difference-between-ac-and-dc

Multimeter

How to use a multimeter. In this post I am going to quickly inform you how to correctly use a multimeter.

  1. There are multiple settings you can set depending on what you are testing, such as: Voltage dc, Ohms, Voltage Ac, Diode and amps.
  2. Voltage DC is there to measure battery operated devices or anything that gets it’s power source not from the mains.
  3. Voltage AC will be for mains electricity or anything powered from a great distance.
  4. Ohms is to measure the resistance of components such as resistors.
  5. Diode setting is to read the gate on the diode as it only allows voltage to travel in one direction.
  6. Amps measures the amps of a component.

The relay circuit

So I went to maplin and bought a 6 pin relay which works like :

To set up a circuit with this type of relay you need:

  1. 5v relay
  2. transistor
  3. diode
  4. resistors
  5. wires
  6. led
  7. push button
  8. 9v battery

To set this up you:

  •  Put the relay in the middle of the breadboard
  • Have the push button at the bottom middle of the breadboard powered with a 220 ohm resistor and linked to one of the power pins on the relay.
  • A diode goes from one coil to the other one with the bar end on the side of the power.
  • A transistor goes connecting pin (left)  goes onto the coil (non-power side), base (centre) goes to power and the last emitter pin goes to ground, with the other power pin.
  • On the n/o pin put and led and ground it with a resistor.

Now when you press the switch the LED comes on

Friday

On Friday after the engineer I went to go get a relay to complete the circuit from Arduino to washing machine.

(check the relay post to see how to set this up)

Once i had the circuit figured out for my relay i got to work setting it up with the washing machine. I set the circuit up with a push button to have more control on the circuit and connected the wires to the relay (power and n/o), pressed the switch and flipped the fuse box power in the room.

After sorting out that issue i tried again with higher resistors but unfortunately the circuit board on the  washing machine blew or the two wires touched earth which has rendered the machine obsolete. I know its the circuit board because I have changed the fuse in the plug and tested the power coming into the machine with a multimeter and all seems normal.

 

Thursday- Good news

However there were solutions to all of these issues, but it would mean changing the idea of how we view the washing machine.

1) As we don’t have access to the individual components the right way to get around this would be to use the cycles already available to us and just have wireless access to the start /pause button.

2) We soldiered up two wires to the positive and neutral connections which means all we need to do is touch the two wires together to start the machine, (These wires cannot be earthed).

Thursday -Bad news

On Thursday we had an engineer come in to have a look at the washing machine and help out with the wiring. Now here’s where things get interesting in terms of what we can and cannot do with our idea.

  1. We have no access to individual parts by using the wires as the brain and programming of the washing machine is in the front panel circuit board.
  2. The rubber from the pump, door and drain will infiltrate the flavour of the milkshake and offset the flavour quite distinctly.
  3. The drain has a propeller system which will froth up the milk permanently on the way out.
  4. To pressurise the milk we would either have to have a tank situated 9 feet above the valve of the  pump or have a container of water sat on top of another container of milk which would pressurise it.
  5. No access to the motor otherwise it will stop working or spin at a constant speed of 1000 rpm which would destroy the milk.

Looking into twitter again

Having a look into using Twitter again to work with the Arduino in sending HTTP requests from a hashtag.

Lucky i found something that might help me achieve what I am looking for and it’s called TweetControl by TeamSpeak. Now this works by setting up a hashtag to execute a HTTP request, this request will then

So using thingHTTP you set up the HTTP request which allows you to set what type of request it is,  the URL, Username, Password, Headers, Body and Parse string.

The other half or Tweet Controller is a simple set up which allows you to set who can tweet (a user or everyone), the hashtag being used as the trigger and the HTTP request that it set’s off.