Consider the following methods of programing a microcontroller
Arduino ide- most user-friendly, many tools, quick,  easy
C  - intermediate difficult, need to have more hardware knowledge, more efficient in code handling and storing, more freedom to program.
Assembly lowest level of programing, need to have through understanding of the hardware also, more difficult, highly efficient in code handling and occupies least storage, and allows most freedom to program.

Even though arduino is most popular prototyping tool, you are going to hit a block with arduino as the problems you are trying to solve becomes more complex. C and assembly level programming offer more freedom and features to play around with at that level.
to put things in perspective, Attiny has 4k bytes of memory to program, if programmed with arduino the program will consume a lot storage, and clock cycles making it less energy-efficient.
Some think that Atmel 328p- arduino chip which has more ram, storage is a solution. It costs more and has 120 pins and that means 120 things to debug if something goes wrong right away. It consumes more energy too.

In fabacademy - you have to fabricate your own arduino if you want to use an arduino.
Any microcontroller needs to be programmed for these
Interfaing
Embeded program
We set a fuse for microntroller, one time. A fuse is a setting you set for a microcontroller. Parameters of fuse:
fuse(clock(int,ext),speed,...)
Three kind of fuses- high, low and extended
extended has one setting- usually if you want to self program( a program that can reprogram)

Number of times you can program microcontroller - you can program a microcontroller a limited number of times before is is not usable. It is not infinite.

Programming on hello ftdi
You need to have a USB to mini USB cable with connector that is compatible with the connector on the ISP.
You need
Hello ftdi edited like showed in the earlier post.
6 pin Header cable.
FabISP
ftdi  cable in the fablab.
Arduino IDE 1.6.5 or higher
Atttity addon
Connect the ISP to computer and connect the hello FTDI to the ISP using the 6pin header cable(I also use ribbon cable to refer header cable).
Connecting header cable: When you consider the arrangement of the ATtiny44 and  6pin ISP jumper arrangement you will see that they are placed and oriented exactly alike in hellofdti and the FabISP board. They remain the same in many of the circuits. You place the boards such that the pair of atttiny and 6 pin jumper are oriented in same way side by side, now the notch of the header connector should be in same direction in both boards.

Arduino IDE settings
Program
In Tools go to and pick
Board-> ATTiny
Processor-> ATtiny 44
Programmer-> usbtinyisp
Clock -> 20Mhz External
Port-> ttyUSB0

Frank mentioned If you are not using external resonator and you tell fuse that use external clock the you upload program- it cant be programmed again until it is connected to external clock. I guess it wont allow you to burn fuse again too with different settings.
Work around
Create pcb with resonator- to be plugged in and a optional circuit to which t an plugged in to .
A normal arduino board also can be used as an ISP. But it is not very much entertained in fabacademy and you'd have to fabricate your own arduino.

After settings you should burn the bootloader into the board.
use Tools->Burn bootloader
The burn succeeded.
 
Program
Init and loop
Setup or init part of program- one time execution. It is used to setup input output pin or pwm.
Analog input- Use analog to digital converter to get meaningful data from an analog source.
Analog Output- PWM is used to output rather approximate analog output.

The setup program comes under
void setup(){
}
Every pin delivers- 5v max and 40ma current.
Input- reads 0 or 5v,
Loop- is going to be executed in loop or a cycle.

Pin number that arduno ide refers to is not same as atitiny pin numbering so look at google for "arduino ide attiny pins". The following is the image I found.


In our hello fdti we have connected led to pin 8 and button is connected to pin7.
 
We haven't used pull up resistor while dealing with the reset button. So we activate it in arduino to use internal pullup with digitalWrite() command, this should be in the void main or the setup segment.








Programing

Blink
When you have a successful burn of bootloader you can start uploading the programs you wrote to the hello ftdi using the isp.

We used an example program, blink. It is located under examples->basics menu First we try to run the default program with only the pin numbers change to pin 8.

The following is the code.


void setup() {
  // initialize digital pin 8 as an output. default will be 13 in the arduino example.
  pinMode(8, OUTPUT);
 }

// the loop function runs over and over again forever
 

void loop() {
  digitalWrite(8,HIGH);
  delay(1000);
digitalWrite(8,LOW)
delay(1000)
 }


Now we try to switch on LED with the push button
Activate the internal pull up for stability using digitalWrite(); in the setup. If pull up is not activated then it will be susceptible to external noise. Essentially an open switch is connected to air and can be affected by electromagnetism of the air. If you have some potential and try to get your finger close to the circuit the switch condition will change. You might see it flickering or may be not, with conditions it changes. With internal pullup the pin get a high through internal circuit through internal resistor and only when the button is pressed will it be given a ground or 0 signal.  In our case the push button is meant connected to gnd and so the logic should go like when the GND or LOW is detected in pin 7 the LED lights. And the normal state is the HIGH state.

Code:

void setup() {
 

  // initialize digital pin 8 as an output.
  pinMode(8, OUTPUT);
  pinMode(7,INPUT);
  digitalWrite(7,HIGH); // internal pullup
 

}

// the loop function runs over and over again forever
void loop() {
 

  if (digitalRead(7)){
  digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
 

   }
   else {
 

      digitalWrite(8, HIGH);    // turn the LED off by making the voltage LOW
 

   }
}


Writing a program for communication
We use SoftwareSerial headers for this purpose. We include SoftwareSerial
header file to create communication channels that enable us to communicate through bluetooth, serial, etc

Make sure you select /dev/ttyUSB0 in tools->port. Normally it'll be unchecked.
Use USB to 6 pin ftdi cable to connect to the computer

In the PCB component diagram we see that Tx and Rx are connected to pin0 and pin1 of the attiny. There is a confusion regarding the tx and rx sometimes the pin is are designated tx and rx implying that it goes to rx of the child device and sometimes it implies that tx is the transmitter and rx is the receiver of the parent device.
Initially we tried declaring rxpin as 1 and txpin as 0 as suggested by component diagram shown before, this didnt work for us. It worked on interchanging the rxpin and txpin declarations. This means that they point to the tx ad rx of the child device, we have to match the rx and tx. Here we consider the parent device as the hello ftdi and child device as computer. We will try to send things through this cable to the computer.

Here we programmed the hello fdti to send "print" word to the computer and light up the led when we send letter "c" to the hello fdti.

Code:
#include <SoftwareSerial.h>
 const byte rxPin = 0;
 const byte txPin= 1;
 SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(8, OUTPUT);
  pinMode(7,INPUT);
  digitalWrite(7,HIGH);
    // define pin modes for tx, rx:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

// the loop function runs over and over again forever
void loop() {

//listen to serial port
if (mySerial.read()=='c'){
  digitalWrite(8,HIGH);
  delay(1000);
  //digitalWrite(8,LOW)
  //delay(1000)
  }
else{}
 
  if (digitalRead(7)){
  digitalWrite(8, LOW);   // turn the LED on (HIGH is the voltage level)
   }
   else {
      digitalWrite(8, HIGH);    // turn the LED off by making the voltage LOW
mySerial.print("print");
   }
 
}

Once you upload this code install gtkterm from ubuntu software center and configure its port to ttyUSB0.

When you press the button on the hello fdti it should print "print" on the gtk terminal.

Now to send from computer side : Open SerialMonitor from the arduino and send "c" to the ttyUSB0. The LED should blink.
 

update 19/11/2015
Making two board communicate with each other
I made a fabduino in week 4. and now going to try to make the fabduino(more info at http://puneethrj.github.io/w4d1.html   and http://puneethrj.github.io/w4d2.html) and helloftdi wih led communicate with each other. As an indication I'm going to use the leds on the boards.
The code in hello ftdi remain the same as above. the following code needs to be uploaded to fabduino. The following code allows the fabduino to light up the led in the helloftdi in same frequency as the led in fabduino blink/ I have built upon the example code of blink from arduino ide for this.

To power the board and communicate I use the power from ftdi cable connected to the fabuino(to program it and after downloading keep it connected) and also the rx and tx from the same ftdi connection. You can either make a temporary solder for this or use jumper wires t o plug it into the holes behinf each terminal in ftdi connector towards the fabduino side.
Match the tx and rx of the helloftdi with fabduino, its not the opposite.
code:
 #include <SoftwareSerial.h>
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);


Serial.begin(9600);
 }

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)

Serial.print("c");
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
Serial.print("d");
 

  delay(1000);              // wait for a second
}


This program worked and the led on helloftdi blinked in same frequency as the fabduino
Above we saw how fabduino can send signal to manipulate the helloftdi board.
Now we try to send a signal to fabduino from helloftdi and try to make the led in fabduino blink on click of the push button on helloftdi.
Again the code in helloftdi remains the same but we change the code in fabduino. Make sure you unplug jumper cabbles coming from helloftdi board from the ftdi terminals on fabduino before you upload code to fabduino by computer.
code:
 #include <SoftwareSerial.h>
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);


Serial.begin(9600);
 }

// the loop function runs over and over again forever
void loop() {

if (Serial.read()=='print'){
  digitalWrite(13,HIGH);
  }

else{ 
digitalWrite(13,LOW);}
 }
I couldnt verify if this worked due to lack of time.


Preparing Laptops and Lab Computers

Since fabacademy philosophy roots in opensourcing it only makes sense that Ubuntu and the free softwares are used. This allows free and ope access to anything and everything that is done in fablab. It allows repetability and a common framework that anyone can work with. One of most important of them is the OS itself which is the linux based UBUNTU system. The next most inportant software is  the fab modules which can control alomst any CNC machine that is present in fablab.

The pain of Ubuntu 

Ubuntu means 

"A quality that included the essential human virtue; compassion and humanity. there is a need for understanding not vengance, ubuntu is not victimization"

Indeed you need to have a all these to go through Ubuntu install and setup.

Creating digital accounts

During fabcademy you will be evaluated through your documentation which explains the world and the remote mentor or Neil what you have done. There will be times when your projects will be recommended by your remote mentor to higher faculty or Neil. They will see your website or the files you created. For these reason you need to learn to effectively express your work in a document. They should be online and freely available to anyone, they are opensource.

Day 4 week 1

Lab maintenance and Material handling

I took charge of Vinyl cutter and Roland Modela

I learned how to better handle the vinyl rolls. The vinyl rolls when kept vertically deform and get damaged at the edge which happens due to it not being able to support its own load properly. The correct way to keep a vinyl material is horizontal and the rolls to be taped at the open edge after use so that they don’t become loose.

The vinyl rolls were kept on the ground earlier.

Vinyl cutting

Used to make sticker and best use is to make PCB that are flexible. Can cut copper, epoxy and vinyl sheets.

Loading the material 

Use this lever to release or secure the vinyl.

Materials should be between the two translucent patches as shown in the picture. These have rough surface in order to grip the papaer better. The wheels should secure the paper when the lever is engaged.

Day 2 w2

Laser in our fablab is a trotec speedy 100 with that we have an atmos exhaust filter from trotec. Here's the laser machine and our super cool prefab guide and fabguru Francisco explaining about the filter system.

Polycarbonate lid and Atmos Exhaust Filter system

Filter parameters

Things to watch out for

Exhaust filter should be on.

Molding Casting and Roland Modela

The basic idea for this session is to create an 3D object through computer and try to make it in machinable wax in such a way that a molding pattern is created directly from it. Roland modela will machine the wax. We will try to replicate this object by creating a silicone mold and later use the silicone mold to cast hard plastic into it.

Day 5

Shopbot

Notes:

Designing for milling

Due to tool radius inner corner of a hole or a pocket cant be sharp. Overmilling is advised in such cases.

Good design guidelines for milling.

http://blog.inventables.com/2014/06/learn-about-milling-inside-corner.html

http://www.efunda.com/processes/machining/mill_design.cfm

Better to use antimony to design material to be milled.

Dia max to be used for milling in shopbot- 6mm

Dia max to be used for milling in roland -3mm.

Week 3 Day 1

This week we move to electronics design and fabrication.

Today we started with electronics production. The goal was to fabricate a pcb from an already existing design. We use roland modela to fabricate the PCB.

Assignment: to fabricate a version of fabISP using Roland modela and fab modules.

Process

We downloaded the the following designs.

Week 3 Day2

Many of the fabacademy cad items are design that have .cad extension. These were designed in kokopelli. .cad file is basically a python script. Today we try to edit and understand how the script ad kokopelli.

Assignment

We add components to a hello.ftdi.44.cad and wires on a board and fabricate it.

Consider the following methods of programing a microcontroller

Arduino ide- most user-friendly, many tools, quick,  easy

C  - intermediate difficult, need to have more hardware knowledge, more efficient in code handling and storing, more freedom to program.

Assembly lowest level of programing, need to have through understanding of the hardware also, more difficult, highly efficient in code handling and occupies least storage, and allows most freedom to program.

Final project discussion, Fabduino.

We are going to put use all the knowledge we gained through the weeks before and try to create a product using fablab facilities ad techniques.

Luciano is going to be our facilitator for this week for this process.

Luciano is product designer by profession and he introduced us to design thinking concepts and process.

Rhino, shopbot and making fabduino ready.

Rhino

We learned operation of Shopbot today and Luciano gave an introduction to the rhino 3d software. Rhino is one of the most popular 3D design softwares. It is easy to use and beginner friendly.

Molding and casting revisit

Luciano explained some design guidelines when think of making something from a mold. I am a mechanical engineer and I knew most of it already but I had never put them to practice while designing yet and to make it in fablab. It was a good reminder, from now on I will increasingly integrate these guidelines in my designs.

The oomoo 25 hadnt set when we checked in the morning. Essentially all the oomoo 25 were a trash now. Later I found online that some people were saying the shelf life of oomoo 25 is just 4 months. We have more of oomoo 25 than any other resin.

Today I'll report the things that needs changing in fablab and some suggestions that hopefully will be reflected in the fablab inventory.

The most atrocious purchase is the dimension 3D printer.
Loading
Dynamic Views template. Powered by Blogger.