NXT - Arduino - homebrew

Sunday, July 24, 2011

Saving space with strings

Also a diary entry:
How to save space on Strings using the FLASH memory of an ATmega
http://jeelabs.org/2011/05/23/saving-ram-space/

This is a usefull post, but for one thing: it does not explain the PSTR()

This turns out to be handled with a little care, so no

Serial.println(PSTR("hello");

will work, as explained here:

http://arduino.cc/forum/index.php?action=printpage;topic=50197.0

Ad you learn something about addresses and seperate parts of the Harvard architecture

ethernetshield arduino, jeenode

This stuff is all known, and this post is just a diary, remembering how to do it all.

Arduino has its own ethernetshield.
http://arduino.cc/en/Tutorial/WebServer
We also have the ethercard from Jeelabs.com
 http://jeelabs.org/2010/05/24/meet-the-ether-card/

We have a modem, so how to connect what with what and what about IP?

http://electronics.stackexchange.com/questions/15150/what-does-the-arduino-ethernet-shield-connect-to
this link has a nice setup explanation.

I don't have a crossover cable, so I connected to the modem.
Then with the Arduino Ethernetshield, what worked was the example of the reading of the analog PINS.

With the jeenode ethercard setup of jeelabs the DHCP did not work for me, (probably the settings of the modem)
http://jeelabs.org/2011/06/19/ethercard-library-api/

but using the static IP:

// ethernet interface mac address
static byte mymac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0x19 };
// ethernet interface ip address

static byte myip[] = { 192,168,2,77 };


and in the setup:

void setup(){
ether.begin(sizeof Ethernet::buffer, mymac);
//ether.dhcpSetup();
ether.staticSetup(myip, gwip);
}


we got the "backsoon page".

That is, we got it at http://192.168.2.77/ which is still local network.

The last hurdle is to connect to this "server" from the outside.

You can see which IP you have in ipconfig in the terminal, or using
http://www.whatismyip.com

Then in our case, you have to get to your modem using the browser, (IP number  in ipconfig)
advanced settings
internet
Address translation
port forwarding
and add the port whcih is in the arduino script, and the local ip of the arduino server.

Then you can reach the arduino internet page, from outside, and the arduino becomes a real server.
(Strange enough, no problems with the firewall....)

Working on XP, so Windows.

Monday, June 7, 2010

Compass sensors

Some students wanted to make a real catapult which throws virtual objects into a virtual world.

Some considerations were given to calibrating the direction of the catapult using a compass sensor.

We did some searching to find the cheapest way to get (I2C) information from a compass sensor:

http://www.magnetometer.org/mag-magnetoresistive.php

HMC1051, a Honeywell chip
KMZ10B/B MAGNETFELDSENSO, but then you have to go building
( only 4.56 euro at conrad.nl )

http://www.convict.lu/Jeunes/CompassSensor.htm
http://www.sparkfun.com/commerce/product_info.php?products_id=7892
http://www.antratek.nl/Compass-modules.html

so the cheapest ready made sensor seems to be around 23 euro's and then sending costs...

Friday, March 19, 2010

music pencil drawing: drawdio

While looking for a way to imitate a bird sound with a 555 timer or a Atiny something, this funny thing came out:

http://www.ladyada.net/make/drawdio/user.html

making sounds while drawing, you have to stay in touch with the drawing too, because you are part of the electronic circuitry!

http://web.media.mit.edu/~silver/drawdio/

based on a 555 or 551 timer

looks like the idea of the pencil connections could be modified and expanded easily, for instance with the Darlington pair and an ARDUINO connection, triggering “drawing input” and using it to steer FLASH movies….


Wednesday, February 17, 2010

connecting to USB

The USB port can be used to power a chip, ATTINY, ATM168 and send/receive data at the same time.

You can connect to FLASH for instance using serial proxy.
You can connect sensors to the chip and send the data to the laptop.
You can build your own buttonboard (usb interface keyboard)
And also you can build your own programmer!

The only things you need is a chip, USB connector, a few zenerdiodes and resistors, capacitors.

links: http://www.obdev.at/products/vusb/index.html (with lots of example projects!)


to make your own programmer:  http://www.fundf.net/usbasp/

or to order a DIY kit, about 17 euro.....
Russian is not as difficult as it seems (sometimes :-)

if you like AVR and ARDUINO's what can ever stop you???

we start with LOVE:

я люблю контроллеры AVR : i love AVR microcontrollers

Then just for fun a few basic words (most of these words - pronounce them and you know what it is...)

вольт: volt

Конденсаторы: capacitor, (condensator)
Резистор: resistor
диод: diode
светодиод: LED, literally "light diode"
транзистор: transistor
кнопка: button (knopje in Dutch!)
регистр: registry, memory place like R15 etc
вход с подтяжкой: pullUp port
порт-земля: GND, literally port ground
порт-питание: VCC
лаборатория: laboratory
Подключение: connections, ключ = key
контроллер AVR: AVR controller
архитектуре контроллера AVR : AVR architecture
Ассемблер assembler
порты ввода вывод, input output ports
даташит, datasheet

Если что непонятно, то не стесняйся спрашивать у меня в комментах. : If all this was not clear, ask me about it in the comments :-)

If you don't believe me look here:

http://easyelectronics.ru/podklyuchenie-mikrokontrollera-likbez.html

He makes interesting art too:

russian.jpg

this is a good translator, most of the text was not poetical spaghetti:

http://www.online-translator.com/Default.aspx/Text

inspired by the movie AVATAR

Apparently people in the States are much favored: they can do the blue avatar happyness and electronics AND eating fast food at the same time:

http://www.robotroom.com/Inside-Avatar-McDonalds-Toy.html

(poor little blue fellow though :-(
He will be taken apart!

See the nice blue images on this site!

Distance sensors

Distance sensors are relatively expensive.

Here is a list of some of the cheapest:

Infrared:

small distances:

http://home.cogeco.ca/~rpaisley4/IrProximity.html

intermediate:

SHARP GP2D12: (10-80 cm) examples and connections:

http://www.acroname.com/robotics/parts/R48-IR12.html

(can be bought at www.conrad.nl)

ultrasound: ( from 10 cm to 255 cm )

SRF02 series

I had a problem with too stiff wires, and I had really to get the MODE pin HIGH to get it functioning
This script is showing how:
http://www.tigoe.net/pcomp/code/category/arduinowiring/39

Because it is I2C you can add this to other I2C devices on pins 4 and 5 analog of the Arduino

http://www.antratek.nl/Ultrasonic-sensors.html

There is an inexpensive one I have built from a kit:
(dutch: Ultrasoon Afstandsalarm)

Ultrasonic distance warning

www.conrad.nl article number 114456
but this is for warning between 10 - 80 cm, not really measuring distance.

Thursday, December 31, 2009

linux starter links

http://www.cyberciti.biz/faq/ubuntu-linux-root-password-default-password/
https://help.ubuntu.com/6.06/ubuntu/desktopguide/C/apt-get.html
http://linuxreviews.org/beginner/

working with ubuntu in the terminal window the problem was how to get to the root user to get things installed.

basically:

sudo bash
sudo -s

then to get a file executable:

chmod a+x someFile

to copy files from somewhere to there:

cp somewhere there

somwhere and there being path/someFileName


Tuesday, July 7, 2009

8 x 8 LED Display

Remark: In this post we use the frequency timer library, which was only working for the ATmega168. Better use the "real AVR" interrupt immediately...


Some time ago we bought the LED DISPL. GR 2 3" 8X8 MATRI
Bestnr.: 156380 - 8A at conrad.nl.
Very important you can download the datasheet at conrad service.
First we thought it would be easy to connect the 16 pins, steering 64 LED's. But it proved to be a bit more complicated than we thought. (As usual.)
Looking at the connections you see that you can light one LED, but how to get a pattern running across the matrix of 8 x 8 LED's.
Some tricks are needed!
We have to use a fast timer, from a CPP lib to fool the eye of the beholder, working with the slow response time of the eye. Indeed a camera sees more, which can be seen in the pictures.
here we found the necessary info: http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix
but the FrequencyTimer2.h did not compile right away, we had to modify some lines using advice from here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239820770
then we still had a problem, we dived into the CPP file, we encountered some things we didn't really understand.....we tried several changes....
...
...***
...
then as a final try we changed the HIGH in the LOW everywhere in the ARDUINO script, and it worked, why?
comparing the datasheets we noticed that ...indeed...the LED's were turned around, in our device they were in the other way around, compared to the LED matrix used in the script of the link.....
:-(, always the same.....look closer, expect changes everywhere, details details....
but ok, in the end....it worked within a day, and the script is great!
(In this last image the camera sees what the eye cannot see: the LED steered on and off faster than we can see.) Our plan is to built this LED matrix into clothing behind a half transparent outer layer. Use a distance sensor, and change the running text according to distance of others from ourselves...
*** Peter van Vliet explained the (for me) incomprehensible part in the C++ file of the FrequencyTimer2 lib.
What was the problem? We noticed this part at the top of the source file:
{
static uint8_t inHandler = 0; // protect us from recursion if our handler enables interrupts
if ( !inHandler && FrequencyTimer2::onOverflow) {
inHandler = 1;
(*FrequencyTimer2::onOverflow)();
inHandler = 0;
}
}
without a function name....
The explanation is that this part will be flashed in the first part of the program section on top op everything else. It will be called every cycle, which makes sense seeing the purpose of the FrequencyTimer2 lib. So this is special chip (embedded) programming.