D.castellanob-pfc

From jderobot
Jump to: navigation, search

Contents

Project Card

  • Project Name: the topic is not clear yet.
  • Authors: Daniel Castellano
  • Academic Year: 2011-
  • Degree: Grad (Telecommunication)
  • Tags: Arduino, surveillance, sensors, actuators
  • Technology: Jde, Android, Arduino
  • State: Developing (Learning development platform)
  • Targets: domotics


Project basis

Bidirectional communication

Now let me to do a trick. For this project, we need to use a zigbee mesh, this way we can to have all the information in the central node (this node will process all the data/alarms and it'll be the web server), but I'm not still able to do that, so I configured the zigbee modules for a point-to-point bidirectional transmision; thats work for only two zigbee modules, but, of course, we won't it in the final proyect... it's only a workaround solution :)

Sensors driver

As we'll manage many sensors types in the project (gas, light, etc.), an standar interface for all of them could be usefull; this way, we only need to know what kind of sensor in the declaration. Arduino use C++ languaje, so this library is object-oriented; this mean that you'll declare an objetc (the sensor) and you will operate over it.

Now, the driver is only suitable for temperature and humidity, gas, light and moisture sensors. Remember that the vibration, magnetic switch, PIR and water sensors will give you some voltage when it activate, so they sould be configured as an alarm.


WARNING: I still didn't test this library. The driver library is in https://svn.jderobot.org/users/d.castellanob/pfc-teleco/examples/sensorTest/

Ethernet communications

I made a HTTP server with my arduino and the ethernet shield; the web page is based on "A. Mellis" code [1], so it was very easy, but I made some modifications for to do the workflow similar to my project idea; basically, in my example, the value of the variables are stored in RAM memory (they will come from another arduino, so you can't read it directly). https://svn.jderobot.org/users/d.castellanob/pfc-teleco/examples/ethernet.ino

Here I leave you a photo of the "server" (the arduino) and his web service:

Interruptions

The software is easy to implement, in the library "Serial" you have all the information you need, but basically, you will call a function (without parameters of input or output) when "something" happens in your interruption pin (you can choose the kind of activation). The hardware is harder, if you use a button, I mean; because the buttons have few drawbacks you should know them before using the buttons, so I've decided making a tip section for those little things that everyone knows but you forget when they are necessaries.

I made a video (basically, it's the same that the first sample code, but my teacher invite me to upload it).

Also, I uploaded the code, so you can see that in this case, the interruptions can help; the code is much easier, and synchronous ;) https://svn.jderobot.org/users/d.castellanob/pfc-teleco/examples/test_interrup.ino

Interruption over interruption

I've tried to execute a interruption when another interruption is executing. When I do that, the arduino crashes; it doesn't matter if it's the same interruption or another one. So you know, try to run your interruptions as quick as possible (they are dangerous). If it's true (I checked it with two buttons, so maybe it isn't true...), the interruptions must be very very shorts, maybe a good idea is changing the state of a variable (for example, change the variable "interruption" to 1) in the interruption (and not to do any more inside it) and check those variables in the "normal" code.

Start-up

Capitalism (more shopping)

Do you belived that we'll be able to domotic a house with only an Arduino? Of course not, there's no magic here :(

I bought some sensors (light, humidity... and so on) and another arduino Uno, two xbee shields with their xbee modules and a ethernet shield. Don't worry, this is only for test and for to make the development more easy, if I complete my idea, we'll need only an arduino, the ethernet shield and a xbee module for the central node and a arduino, the sensor and a xbee module for a sensor node, so it will be much cheaper.

The first code

I know that all of you was expecting it, so I will not waste any more time on foolishness.

http://svn.jderobot.org/users/d.castellanob/pfc-teleco/examples/test1.ino

It isn't the great domo-controller that I promised you before, but I'll upload it with time... Now, it have only 3 leds and 2 buttons; one led is a blinker (switched every second), another one is a follower (if a input is at state '1', the led will be on, if it's at state '0', the led will be off) and the last one is a frecuency divisor (a voltage change (from '0' to '1') in the input pin will be a state change for the led).

I recorded a video. I was using two wires as buttons (pin 49 mean button pressed and ground mean button released)

Arduino test

It's nothing conceptually complicated, but I have some doubts when I did it; for example, how the hell can I make a hardware interruption??

I bought a 'mega 2560'

The three wise men gave me the arduino 'mega 2560' at home; I wanted the arduino UNO, but they thought that I'll could take advantage of it. One thing is sure, my project should be able to be executed in a arduino UNO (maybe in various...)

My first week

Ok, now I'm very... impatient, and a little overwhelmed and scared.

Begining any project never is easy, but I have already lived (one of) the most important phases; the proyect is not very defined, but I'm sure that my ideas will became a real experience.

Probably my mind, in the next months, will change and the present Dani's project will be different of the future proyect, but this is the idiosyncrasies of the proyects, they'll never be the same, maybe better, maybe worst.

I made a general scheme of my idea for the project:


Tips for beginners

General

  • ALWAYS, you must connect some hardware exit to an input pin, if you don't do that, the input could report any state, furthermore, it may block your Arduino (for example, using interruptions in these pin)

Debug

  • You can use the "Serial monitor" for a strong depuration; the serial comunication is very easy to implement with the "Serial" library; in this way, for instance, you can know exactly how many times your arduino executes a piece of code.

Button

  • You should put a condensator at the end of your button if you don't want to have rebounds, if you don't put the condersator, it's possible that you get a "wrong" state (or you think that) when you check your button. The library "Bounce" could do that, but I didn't check it.
  • You can't use the same ground pin for two or more diferents buttons.
Personal tools