Saturday, 9th August 2014

Let’s generate some signals!

Here is our tiny sine wave generator for sound and waves experiments.

attiny1

The ATTINY85 based board which can take square wave as input and generates sine wave. In the picture- board and the completed module.

ATTINY 85 is the high-performance, low-power Atmel 8-bit AVR RISC-based microcontroller combines 8KB ISP flash memory, 512B EEPROM, 512-Byte SRAM, 6 general purpose I/O lines, 32 general purpose working registers, one 8-bit timer/counter with compare modes, one 8-bit high speed timer/counter, USI, internal and external Interrupts, 4-channel 10-bit A/D converter, programmable watchdog timer with internal oscillator, three software selectable power saving modes, and debugWIRE for on-chip debugging. The device achieves a throughput of 20 MIPS at 20 MHz and operates between 2.7-5.5 volts.

The ATTiny85! In the DIP configuration,  is about 9mm x 9mm, can be programmed using the Arduino IDE, runs on as low as 3.3V at pretty tiny amperages. Here is the pin configuration…

We programed it using USBASP programmer from our microhope project.

mh-usbasp

After programing the chip, now we can use it with ExpEYES as a sine wave generator. The connections are made like this….

attiny-connections

pin1 is RESET pin2 is input where SQR can be connected and pin 3 is the output. The module can be powered usent external USB or with OD1 as shown in the pic.

To reset pin 1 (marked as P1) should be connected to GND for a fraction of second. This is useful to obtain lissajous figures for which two modules can be used. Both the modules can be powered with single USB.

attinylissa

We also wrote a program in python for lissajous figures.

Here is the amazing result…..

lis2 lis1lis3

I also worked on few python programs to finalize them. Now almost all the programs are ready.

Here is my today’s activity on Github

GSoC Weekly Report 5

The past week ( From Monday 16th to Sunday, 22nd June 2014) was really productive in terms of experimental setups and trials with python codes. My mentors offered all the help and guidance and were very  encouraging and helped me to speedup the things….

What We Could Do….

  • Started creating documents for experimental setups and procedures for mechanics experiments and a few sound experiments.
  • Made necessary changes in python programs for using SRF 05 sensor. Did the experiments on linear air track to obtain position -time plots.constant velocitypt graphconstantvelocitypt graphbounce
  • Ordered and received additional Ultrasonic sensors SRF 05. Did the testing work for all ten pieces of srf modules. They all are working good.
  • Wrote three programs for time measurement using photo-gates and explored the use of time measurement functions like r2rtime r2f time and multir2rtime and updated changes to Git repo.
  • On Wednesday, started giving finishing touch to the following experiments…. Frequency of Oscillations of Spiral Spring, Parallel and series combination helical springs and the resulting spring constant, Uniformly accelerated motion on an inclined plane, Conservation of momentum.
  • On Thursday, Continued working on giving finishing touch to the experiments..Had to spend a lot of time with photo-gates. The problem in accessing Light sensors (Photogates) is partially solved……… :) Now I am able to make time measurements using these light sensors.
  • Completed the setup and documentation for Spring oscillations experiments. Here are the screen shots of the experiment with spring oscillations..Screenshot from 2014-06-21 00:04:36Screenshot from 2014-06-20 23:55:05IMG_20140620_234908
  • One more positive development that has happened is…now we are able to access ExpEYES with android phone or tablets….Thanks to Jitin B.P. for this application.I could connect ExpEYES to my Micromax Canvas 4 Phone…the screen shots shows sine waves and square waves connected to different channels…. Now, our dream of providing an open source science pocket lab to every student has come closer to the reality.
  • Screenshot_2014-06-20-22-36-15Screenshot_2014-06-20-22-34-15
  • Wrote and commited some simple python programs required for time measurements and plots to git repo.
  • On Saturday, worked on an experiment to produce Lissajous figures using two square waves. Wrote Program in python and tested the same. Could obtain various Lissajous patterns.In the code we used Capture2 function from ExpEYES library to plot the figures. used two sine waves with a phase difference of 90 degrees.
  • lisawaveslissaellipse
  • On Sunday, continued to work on experiments to produce Lissajous Figures. Generated two square waves with a phase co relation between  them. Used Capture2 function to capture data and plot graphs. The figures are sensitive to phase difference and the ratio of frequencies.These are the patterns obtained……smooth curves can be obtained using sine waves…
  • lisa4lissa7lissa1lissa6lisa3lissa2
Difficulties Faced…
  • I was facing some difficulties in some experiments while using two photo-gates simultaneously for time measurements. The problem is partially solved. Need to fine a good and permanent solution. Ability to use two photo-sensors simultaneously can make many mechanics experiments easy.
  • For spring Oscillations experiment…difficulty in Fitting the curve to get frequency.
  • The smooth Lissajous Figures are expected if we use two sine waves instead of square waves. Working on the module to generate two sine  waves of variable frequency.

To Do………

  • Work on accessing Photo-sensors. Write necessary python code.
  • Write a code for fitting different curves.
  • Create a GUI where user can change the phase between the two waves and can obtain different Lissajous patterns.
  • My Next Step would be to produce these pattern in 3 Dimensions using Laser and Speakers. For this I need an amplifier to drive two speakers. Sine waves and the required phase difference can be obtained from ExpEYES with python code. Aiming at beautiful Laser Show with a lot of science in it…. 🙂
  • Documentation with experimental procedure for the experiments developed.
  • Taking Photos/Videos of set up and also upload screen shots.

Here is my git activity for this week   https://github.com/wavicles/Plugins-for-ExpEYES/commits/master

Sunday, 22nd June 2014

Continued to work on experiments to produce Lissajous Figures. Generated two square waves with a phase co relation between  them. Used Capture2 function to capture data and plot graphs. The figures are sensitive to phase difference and the ratio of frequencies.

This is the code used.

from pylab import *
import expeyes.eyesj
p = expeyes.eyesj.open()

#p.set_sqr1(8000)
#p.set_sqr2(4000)
p.set_sqrs(8000,13)

t1,v1,t2,v2 = p.capture2(1, 2, 400, 16)
figure(3)
plot(v1,v2)
show()

These are the patterns obtained…

lissa7

lisa4

lissa1

lissa6

lisa3

lissa2

The smooth Lissajous Figures are expected if we use two sine waves instead of square waves. Working on the module to generate two sine  waves of variable frequency.

Thats all for today…….:)

 

Saturday, 21st June 2014

Today worked on an experiment to produce Lissajous figures using two square waves. Wrote Program in python and tested the same. Could obtain various Lissajous patterns.

In the code we used Capture2 function from ExpEYES library to plot the figures. Here is the example…

_________________________________________________________________________

from pylab import *
import expeyes.eyesj
p = expeyes.eyesj.open()
from pylab import *
t1,v1,t2,v2 = p.capture2(1, 2, 300, 100)
figure(1)
plot(t1,v1)
figure(2)
plot(t1,v1, t2,v2)
figure(3)
plot(v1,v2)
show()

__________________________________________________________________________

figure 1 is a sine wave connected to channel A1

sine

figure2 shows the phase different introduced using a 1 microfarad capacitor and 1kilo ohm resistor.

lisawaves

this is the resulting Lissajous pattern…..

lissaellipse

Need to create a GUI where user can change the phase between the two waves and can obtain different patterns.

Tomorrow I will be working on the same experiment to produce different patterns.

 Following is the related information

Source :

  1. http://www.britannica.com/EBchecked/topic/343305/Lissajous-figure
  2. http://en.wikipedia.org/wiki/Lissajous_curve

Lissajous figure, also called Bowditch Curve, pattern produced by the intersection of two sinusoidal curves the axes of which are at right angles to each other.

If the frequency and phase angle of the two curves are identical, the resultant is a straight line lying at 45° (and 225°) to the coordinate axes. If one of the curves is 180° out of phase with respect to the other, another straight line is produced lying 90° away from the line produced where the curves are in phase (i.e., at 135° and 315°).

Otherwise, with identical amplitude and frequency but a varying phase relation, ellipses are formed with varying angular positions, except that a phase difference of 90° (or 270°) produces a circle around the origin. If the curves are out of phase and differing in frequency, intricate meshing figures are formed.

The appearance of the figure is highly sensitive to the ratio a/b. For a ratio of 1, the figure is an ellipse, with special cases including circles (A = B, δ = π/2 radians) and lines (δ = 0). Another simple Lissajous figure is the parabola (a/b = 2, δ = π/4). Other ratios produce more complicated curves, which are closed only if a/b is rational. The visual form of these curves is often suggestive of a three-dimensional knot, and indeed many kinds of knots, including those known as Lissajous knots, project to the plane as Lissajous figures. (REF: http://en.wikipedia.org/wiki/Lissajous_curve)

  • a = 1, b = 2 (1:2)
  • a = 3, b = 2 (3:2)
  • a = 3, b = 4 (3:4)
  • a = 5, b = 4 (5:4)

GSoC Weekly Report 4

This week ( From Monday 9th to Sunday, 15th June 2014) we really accelerated working with experiments and coding.

Constant encouragement and guidance from my mentors, Mario Behling and Dr. Ajith Kumar really helped me to keep going.

What We Could Do….

  • Attempted to use two Ultrasonic sensors simultaneously to detect position. Used two srf05 modules to plot graphs. Both the graphs were out of phase as expected. This is very much useful for momentum transfer  experiments involving collision. Uploaded the code to Github Repo.
  • Explored different methods of determining velocity and acceleration. Used the same set up of linear track in inclined position at about 45 degrees. Allowed vehicle to glide downwards and plotted position-time graph. Got straight line with positive slope as expected. For this used SRF05 module.
  • Then used photo-gate with ExpEYES kit and could make time measurements.
  • Designed a pickup device  for use with photogate. ( Thanks to Open Educational Resources on the web)
  • pickup for accelerationThis can generate a square wave as it passes through photogate. Acceleration can be determined  using the signal generated. Excited to see its working. Some proprietary closed source devices use this method……….( of course they come at a very high cost price). This will result in a very low cost setup
  • This is the photo gate used. (photo from www.expeyes.in)
  • light-barrier

 

 

  • Modified the photo-gate design  so that it will be easy to use with linear air track set-up.
  • Today tried to measure acceleration due to gravity using motion of glider on an inclined plane. Used the pickup i designed yesterday and photo-gate to measure acceleration. The results are very good and are in close agreement with theoretical calculations. For motion on an incline acceleration along the inclined plane is g’ = g sin(theta) where (theta) is the angle on inclination. wrote a small python code using time measurement functions of ExpEYES library.
  • Used these time measurement functions:
      • p.multi_r2rtime(3)  # time for 1 cycle
      • p.multi_r2rtime(3,2)  #time for  4 cycles, 2 rising edges are skipped
  • Now we can do the acceleration due to gravity measurement with two different methods
    1. By using motion sensor …. the data is recorded with uniform time intervals.
    2. By using Photo-gates …… the time intervals are not uniform. time taken for traveling different distances can be measured and data can be used to calculate acceleration.
  • Worked on  plotting 2D graphs using ‘matplotlib’ library.  Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of formats and interactive environments across platforms. I found it to be a very powerful tool for teaching and learning physics.  Wrote code for plotting different graphs useful for mechanics experiments. Here are some screen shots….

ucm and shmgraph2

  • Data ( time and position) obtained from Ultrasonic sensor is stored in a file srf.dat and then plotted. I just moved a piece of paper to and fro, in-front of the sensor. Plot is reasonably good.  In another trial fetched  data from the file and plotted….matplotlib is amazing … :)

srf3graphssrfdataplot

  • Tried plotting Lissajous figures…..this code will be useful for my sound experiments……beautiful yet simple….its python… :)

liss

 

Difficulties Faced
  • Numerical Differentiation for calculation in mechanics
  • Acceleration Graphs  are scattered and lack accuracy in measurement.
  • Calculation of acceleration using Photo-gate and pickup device

To Do Next Week

  • Coming week I will be focusing giving finishing touch to the individual  experiments….
  • Documentation with experimental procedure for the experiments developed
  • Taking Photos/Videos of set up and also upload screen shots.
  • Develop code to Access all the experiments through single GUI
  • Finalize the codes for individual experiments on Github
  • Prepare for mid-term evaluation

 

here is my git activity for this week   https://github.com/wavicles/Plugins-for-ExpEYES/commits/master