arduino – Experiment – Enjoy – See it working – Share http://pagealh.com Wed, 28 Mar 2018 11:07:57 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 http://pagealh.com/wp-content/uploads/2017/10/1_Primary_logo_256-150x150.jpg arduino – Experiment – Enjoy – See it working – Share http://pagealh.com 32 32 Arduino: Self-switching corridor lamp (motion detector, relay) http://pagealh.com/2015/05/09/arduino-self-switching-corridor-lamp/ Sat, 09 May 2015 12:58:35 +0000 http://pagealh.com/?p=984 Continue reading

]]>
Project Idea and Requirements by: Masha Lipshits

Goals:

– to learn using Arduino uC, relay and motion sensor

– using Arduino Pro mini, to make our corridor lamp automatically switching ‘On’ if motion is detected in the area of the entrance-hall. Switch ‘Off’ – by timeout.

– finally installed prototype shall be extendable (ex. by RF components sending motion detection to central PC) and allowing easy and safe maintenance and upgrade.

Note: As a result of this post being reviewed and discussed at Hackaday, I’d like to note (thanks the reviewers) that using Arduino in this experiment is NOT necessary, as the project was not finally extended with RF transceiver as planned. RF transmission of “LAMP-IS-OF” activated IR sensor and turned the lamp back ON, and lack of time were making me finishing this experiment in the middle. Thus, the not is as following, again:  for just lamp switch on-off solution Arduino is actually not necessary. The reason is a presence of “Time Delay Adjust potentiometer at HC-SR501 Motion Detection sensor used here, which sets how long the output remains high after detecting motion (anywhere from 5 seconds to 5 minutes) so that it may be used for driving of the enable pin at the relay.

Components:

– HW: Arduino Pro Mini’s clone Funduino

– HW: Relay (one relay is enough, but I had only two-channel relays) Theory 

– HW: Motion Detection sensor

– HW: 220V->5V AC to DC converter (taken from old power supply)

– SW: sketch

– Mech: old plastic box

– Mech: spare Raspberry-Pi camera case (for motion detection sensor)

Wiring:

wiring_01

Description:

– Learning to use Arduino lead to creation of the appropriate ‘Getting-Started’ page

– Then was a turn to try and use relay with Arduino GPIO.

IMG_20150508_232948IMG_20150508_232952

– motion detector also was connected to another GPIO pin configured to be treated as input.

IMG_20150508_205956IMG_20150509_112549

– after enabling of the components,  bread-board based complete prototyping and after completion of the Arduino SW sketch, there stage of  final assembling begun.

– motion detector sensor was placed into special case which will allow to install it at some distance from the switching module and the lamp itself so that the sensor will provide sufficient coverage of the entrance hall and will not react on motion at the adjacent guest-room

IMG_20150509_121047 IMG_20150509_120721

– AC-related components were attached to the top cover of the box and connected to the 220V AC source

IMG_20150509_124938 IMG_20150509_131358

IMG_20150509_131332

– then digital components and wires were prepared at the bottom cover of the box

IMG_20150509_134312 IMG_20150509_134300

– then all was assembled in place and sealed.

IMG_20150509_141201 IMG_20150509_141330

IMG_20150509_141335 IMG_20150509_141411

– all appears to be working as expected

And here how the final product looks like

IMG_20150614_193512IMG_20150614_193659

IMG_20150614_193437IMG_20150614_193619

]]>
Getting Started with Arduino Pro Mini http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/ http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/#comments Fri, 08 May 2015 03:36:06 +0000 http://pagealh.com/?p=958 Continue reading

]]>
Reviewed by Editor: Jack Allison

HW Components:

Arduino/Funduino Pro Mini (ebay). It comes without programming related HW on it (as at other Arduino products), but pre-programmed with boot-loader. The boot-loader allows to upload new code to Arduino Pro mini without the use of an external smart hardware programmers, but just using different TTL RS232 to USB converters and Arduino IDE (which uses ATmel STK500 protocol).

PL-2303HXD USB to Serial Bridge Controller (ebay) is USB to RS232 auto-converter module (PL-2303HXD spec). Also (according to this video) devices like FTDI FT232RL (ebay) and USB to TTL UART Silicon Labs CP2102 (ebay) are useful for same purpose.

– USB extension cable (to make PC USB port closer to you on your table)

SW Components:

– IDE – Arduino IDE

– Blink Arduino example sketch. At Arduino IDE, use File\Examples1.Basic\Blink menu to open the sketch at the IDE

Step-by-step:

– connect the PL-2303HX converter to your Arduino as following

* Arduino TX -> PL’s RX

* Arduino TR -> PL’s TX

* Arduino GND (one of the two) -> PL’s  GND

* Arduino GND (another one) -> GND from 5V power supply (usually black)

* Arduino VCC (of Funduino VBUS) -> 5V power supply wire (usually red)

Note: You may have your Arduino working from the  PL-2303HX power pins, but this is not enough for your device programming. To program your sketch into your Arduino you have to have it connected to stable external DC power source. So, when programming/uploading, leave the 5V and 3V pins at PL-2303HX not connected to the Arduino power rails

Note: No additional load (except of that necessary fro programming) shall be applied on Arduino power rails during programming. So, you should separate the programming and the product activation stages: first program your Arduino and then test it in the final circuit with all the necessary connections to sensors, relays and so on.

IMG_20150508_062225

– Stup Arduino IDE with appropriate parameters:

* chose appropriate board by menu Tools\Board\Arduino Pro or Pro mini

* check Tools\Processor shows ATmega328 (5V, 16, MHz)

* using menu Tools\Port chose the Serial port (UART) on which programming will be performed. Once you connect  your PL-2303HX to your windows PC appropriate driver (from Prolific) should be found by Windows (no additional work should be needed).

* use default programmer: Tools\Programmer\AVRISP mkII

– For your own LED’s blinking rate… At the Arduino IDE, change the delays in the default Blink sketch (File\Examples1.Basic\Blink) to appropriate values in milliseconds

// the loop function runs over and over again forever

void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

– Use ‘Verify’ button to check the sketch still be compiling

– To Upload your sketch to your Arduino do the following:

* Click the Upload button and follow notifications at the IDE’s notification area

* You will see “Compiling sketch…” notification

* Wait ‘Uploading…’ notification appeared

* Shortly press and release (toggle) the ‘Reset’ HW button on your Arduino Pro Mini: the only available button. This should initiate the actual uploading.

* After few seconds you should see  ‘Done uploading’ notification. If process is going to fail you will wait for about minute or two and then you will get some failure notifications in alarming colors.

– If all  went well you will see the red LED blinking at the rate you have specified at the Sketch

– if NOT try to recover and to repeat the uploading.

Recovery: 

As to my understanding, with such a constellation as described at this page there may be problems with boot-loader or with Prolific driver.

For me the following recovery process always worked:

– Disconnect  Arduino from power and let its LEDs turn off

– disconnect the  PL-2303HX from the USB port so that it is also powered off

– Then, FIRST connect the Arduino back to power, let its led to blink few seconds and only after that connect the PL-2303HX back to the USB port.

– Usually after this process the upload suceeded.

I suspect, that  periodic failures may relate also to the length of the USB extension cable. So that if you still having things not working, try to use shorter cable or to manage without such a cable at all.

Related links:

Uploading Sketch to Arduino Pro mini using PL2303

Arduino Pro Mini – Uploading Skatches

Arduino Pro Mini – Description

 

]]>
http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/feed/ 1