Help needed with Light sensitive shutters

pleaderwilliams

New Member
I'm an architecture student, and as part of my current design project I want to try and make a prototype of a light sensitive shutter/facade system for the building I'm designing. Basically, as far as electronics go I want to be able to move a servo as light levels change. So when it's bright servos are at one end of their range, and the shutters are closed, and as it gets darker the servos turn through 90 degrees, so that the shutters open. Unfortunately this isn't really my field I'm completely new to both PICAXE and electronics. I can solder, and I know A-Level Physics but thats about it.

I know I need a light dependent resistor, and I've been told that I can probably use a LDR and a resistor inputting to a 08M PICAXE which outputs directly to a servo, but I somehow imagine its more complicated than this? Then I need a power supply for the circuit, and probably another for the servo?

I've been trying to read a lot of the manuals, but much of it is pretty complicated for me. I'm thinking about just buying the starter kit to try and have a play with, but I'm not sure what else I'd realistically need? Some LDRs and some resistors? A breadboard to prototype stuff on?

Any help you guys can give with figuring this out would be much appreciated. Thanks.
 

Jeremy Leach

Senior Member
Hi there, I'm sure you'll get a lot of help here - sounds like a perfect Picaxe project to me ! A few thoughts...

- Are you just going to have one servo, or multiple servos?
- Presumably you'd want mains power supply and not battery?
- Do you want the shutters responding to average light conditions over a period of time or instantly changing?
- Would you need any sort of manual over-ride on the position of the shutters?
- Do you want the servo(s) continously powered or just powered up when you want to change position?

Are you aiming at a decent prototype (nicely produced circuit board etc) or just a bodged, workable proof of concept (on breadboard)?
 
Last edited:

pleaderwilliams

New Member
Thanks for the reply. I'm sure the help will be invaluable.

Well, ideally I'd like to control each part of the facade individually, so with each shutter having its own light detector and servo so that it can react to the change in position of the sun throughout the day. But I'm not sure whether these would best as separate circuits for each shutter, or as one controlling all of them?

I think battery would be better, as it's only going to be a small scale model, and I'm just planning on using small hobby servos.

I'd like instant change ideally, at small scale I need to be able to demonstrate it fairly quickly, and I like the idea of an interactive facade on a larger scale 'rippling' as clouds pass over the sun.

Manual override, or at least some way of adjusting the light level at which the shutters move would be great.

Presumably its better, in terms of energy consumption to only have the servos powered up when they need to move? Is there any benefit to having them powered up all the time?

To be honest, while the electronics are vital for it to function, they are incidental as far as my course goes, and so elegance is not vital,although it is appreciated. How easy is it to produce a circuit board? I can always build a box to hide a breadboard in to prevent it from offending my tutors aesthetic sensibilities.
 

Andrew Cowan

Senior Member
If your uni has circuit board manufacturing facilities, it is really easy. If not, it is a little harder.

Do you have to make the circuit? If not, one of the rev-ed premade PCBs could be perfect.

As far as I see, you need:
Inputs:
Variable resistor for 'manual mode'
Switch for auto/manual
LDR for light levels
Outputs:
Servo

It sounds like an 08M would be perfect.

This thread http://www.picaxeforum.co.uk/showthread.php?t=11508 has plenty of info on controlling servos from an analogue source. The coding is simple:

Code:
'Some of this is written by BeanieBots

servo 7, 75                           'servo to one end
main:
if pin3=1 then                        'if manual switch is on, get data from potentiometer
readadc 0, b0
endif

if pin3=0 then                       'if manual switch is off, get data from LDR
readadc 1, b0
endif


b0=b0 *10/17+75                  'scale values accordingly
servopos 7,b0                       'update the servo position
pause 25                             'wait 25ms
goto main                             'repeat
This code would give instant response (well, there is the 25ms delay, but you could change that).

This really isn't too complex. A resistor and LDR (to make a potential divider) so the PICAXE can read the light levels, and the minimum operating circuit for the 08M. If you can run the servo off a seperate supply, it makes it alot easier as you don't need as much smoothing, filtering etc.

A
 
Last edited:

pleaderwilliams

New Member
That's really helpful, thanks.

I would guess that Engineering or somewhere must be able to make circuit boards, but we don't have anything in the Architecture department. I don't need to make the circuit, so the Proto Board is probably my best option?

Just a thought, it may be completely wrong, but would a variable resistor (or potentiometer?) rather than normal resistor with the LDR mean that the user could adjust the light levels at which the shutters move? Also, how can I calculate what LDR/resistor I would need for it? Presumably something to do with:

V2 = (R2 / (R1 + R2)) * V1

What range do I want for V2? Just as close to 5V and 0V as possible (Assuming V1 is 5V)? So I need a resistor that is roughly in the middle of the range of the LDR?
 
Last edited:

Andrew Cowan

Senior Member
A variable resistor in with the LDR would adjust the sensitivity of the LDR. Might be worth adding that as well as a manual switch.

The whole setup could easily be made on one of rev-eds boards.

With a regular LDR, the resistance is about 5K in bright light, and 1M when dark. A 10K resistor is usually good to use in a potential divider.

A
 
Last edited:

KMoffett

Senior Member
If you decide to go with the hobby servo to move the shutter, be aware that these can have a great deal of torque, depending on the size, but almost always have a limited range of rotation...usually 90° or 180°. This could be critical in the mechanical design of the shutter mechanism in your model.

Out of curiosity, do you want to try you maintain a fixed minimum level of light inside with the shutters? Do you need to account for interior lighting and low level (night) outside light?

Ken
 

goom

Senior Member
You may want to add some hysteresis, otherwise you may find that the servo is constantly making small adjustments, even with a "constant" light level. I would keep the servo in the same position, and move it only when the ADC reading has changed by a given amount.
I may be wrong, but you will soon find out when you try it. It's only a programming change to fix it if necessary.
 

BeanieBots

Moderator

pleaderwilliams

New Member
If you decide to go with the hobby servo to move the shutter, be aware that these can have a great deal of torque, depending on the size, but almost always have a limited range of rotation...usually 90° or 180°. This could be critical in the mechanical design of the shutter mechanism in your model.

Out of curiosity, do you want to try you maintain a fixed minimum level of light inside with the shutters? Do you need to account for interior lighting and low level (night) outside light?

Ken
90 degrees should be enough for what I have in mind, so it shouldn't be a problem.

What I'm trying to do is prevent excessive solar gains, there is no way of maintaining a minimum level of light with the shutters, if it's dark outside it doesn't matter how open the shutters are it'll be dark inside too. Basically, if the sun gets too bright, the shutters will adjust to prevent it becoming too bright inside.


So I'm going for:

http://194.201.138.187/epages/Store.storefront/?ChangeObjectID=105104&ChangeAction=AddToBasket&LastViewObjectID=105104&ViewAction=View
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE021
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE007M

And then switch, variable resistors, LDR and servo?
 

KMoffett

Senior Member
I was thinking about a second LDR that would indicate "night", so the shutters would close, reducing light pollution from interior lighting. But, that's just me playing with your project. ;)

Ken
 

pleaderwilliams

New Member
Right, I've been working on something else for a bit, but I think I've got all the necessary parts. I'm using the rev-ed prototype board, which I've got sorted. Now I just need the rest of the circuit. I've drawn up a diagram (excluding the stuff that's standard on the proto board), does this look right to you guys?
 

Attachments

Andrew Cowan

Senior Member
You need to add a pulldown (10K) resistor on pin 4. That way, the input will read as low when the switch is open, and high when it is shut.

Rev-ed also recommend putting a 330R resistor in the servo line. Obviously +V and 0V for the servo. If you use a seperate supply for the servo, remember to connect the 0V lines.

A
 
Last edited:

pleaderwilliams

New Member
Well, I've put the circuit together, and now I'm trying to do the programming. I'm using MacAxePad, obviously because I have a mac, and I've tried to use the program you gave me, but when I try to program the chip I get an error message:

"problem opening .asm as TextInputStream"

and then something about being unable to produce a .err file. Any ideas what is going wrong? I can't seem to find any mention of a .asm anywhere?
 

hippy

Senior Member
"problem opening .asm as TextInputStream"

That's an internal error indicating something which was expected to have happened, and should have happened because 'it got that far', did not. Such errors will be better indicated when the AXEpad software completes its Beta Testing phase.

[ And for people thinking, "Aha! asm ... Assembler ?", no, there's no secretive Basic to Assembler compilation going on which no one has been told about ].

As to the problem - That is being investigated and I'll report back shortly. In the meantime, could you provide the following details which will help us rectify the problem or provide a work round ...

1) Which PICAXE is selected ( View->Options->Mode )
2) Which version of MacAXEpad are you using ( Help->About )
3) What results do you get with "Check Syntax" ?

Thanks, and apologies for the inconvenience.
 

pleaderwilliams

New Member
1) 08M
2) 0.1.2
3) Check syntax doesn't work either, I get exactly the same 'problem opening .asm' and 'failed to create .Err file' errors.

So I guess a quick option would just be to use the PC software, as I've got a Windows emulator on the mac?
 

hippy

Senior Member
@ pleaderwilliams : Thanks for the info. I cannot see anything obviously wrong with MacAXEpad but I'm not the Mac expert. A few things which you could try if you'll bear with us while we try and get to the bottom of this one -

1) Try a simple program ( "High 0" ) with a different PICAXE selected.

2) Try saving with a short and sweet name ( eg, X.BAS - no embedded spaces or non-alphanumeric etc ) and syntax checking that.

3) Try a Firmware Check ( View->Options->Mode ) with 08M selected and something else.

If you have a Windows Emulator already installed that may be the quickest way forward.
 

Andy1967

New Member
Has an answer been found for this yet?

I excitedly downloaded the software and installed it and the drivers happily only to get this error message each and every time

problem opening .asm as textinputsteam

This is unbelievably frustrating.

Any clues?
 

hippy

Senior Member
We are still investigating this issue. It is a problem which does not affect all Mac AXEpad users and appears to be something which is user, installation or configuration specific. This is not a problem which was anticipated nor one which revealed itself during pre-release testing.

It is always to be expected that there will be some issues which reveal themselves when software applications are released because it is impossible to test every combination or configuration that all users will or may have and this is why the software is a Beta release. Unfortunately this issue is more severe than most others usually are.
 
Top