Last post by Domino60 - Today at 07:39 am
Finally I understood everything.
Now other question is coming up, the 2 G range is good but I need to do some tests which may pass that 2 G
and as you said (groundfungus) I need to change the register to increase the range of G. Where do I find that resister and how do i change it?
The resister can be found in the code as I understand, is that in the MPU6050 Lib. code? If yes where exactly is that and how do i change it, I know for sure that i will need more than 2G's.
Thanks for help.
If the full scale range is ±2g then the maximum you can measure is ±2g. To set the full scale range to one of the other supported ranges you write to an accel sensitivity register.
LSB is Least Significant Bit. The full scale counts from the accel is +32768 to -32768 bits whatever range is selected. So the sensitivity is essentially 32768 divided by the full sale range in g (32768 / 2g = 16384, 32768 / 4g = 8192 etc)
The maximum that the accel will measure is ±16g. But to get that range you will need to set the sensitivity register to that range. Finding out the register to write to and what to write there will entail reading another data sheet. Get used to reading data sheets. It is nearly impossible to persue electronics without understanding datasheets.
*I know the real range is 32767 to -32768 but for illustration I used 32768 so the numbers come out even.
There seems to be quite a bit of oversimplification and in some cases misinformation.
The Compiler does NOT generate .hex files and it does not directly create executable machine code.
I'll try to fill in a more complete picture of what is happening.
There are actually multiple steps under the hood that turn your C source code into something that can be uploaded to and then executed by the AVR.
The IDE is a big GUI wrapper around many command line tools that preform this process.
It also performs some Arduino "magic foo" to try to simplify things as well as allow less technical users to supply incomplete C/C++ code and then convert that code into valid C/C++ code that can be compiled.
Here is a list of most of the steps:
The IDE scans your code and does some checks to try to determine which libraries are used.
It copies your code and the libraries it thinks are used to a temporary working area.
During the copying of these files, it modifies your source code to insert some additional header includes and then insert functions prototypes.
The IDE then calls the avr-gcc compiler to compile the modified source code.
The compiler is actually more than a single step.
The first step runs the source code through the C preprocessor to process things like #defines.
That resulting output is then fed to the compiler to generate assembler code.
The resulting assembler is assembled into a linkable .o object module.
After all the modules are compiled into object modules, the IDE will call the linker to link them all together to create a linked image in .elf format.
This is still not a binary image as it contains lots of symbolic information.
The IDE calls another tool to convert this linked .elf image file into a .hex file which is an ascii text file of S records which is still not a binary image.
The IDE calls avrdude to send the data in this .hex file to the arduino board either through a connection to a bootloader or directly using an ISP burning tool.
avrdude reads the .hex file and converts the records to binary and then pushes the binary information to the Arduino board using the appropriate protocol for interface being used.
Each S record in the .hex file is a block of data/code with an address. Avrdude uses this address information to know where to store the data inside the AVR.
When avrdude finishes its upload, the binary code/data image will be inside the AVR and the AVR executes the binary code.
The above is a bit simplified.
There are some additional handling for libraries and in particularly the Arduino "core" library.
Here is a bit of detail on that.
The core library contains all the low level arduino libary functions like digitalRead(), shiftOut(), etc....
The IDE builds all these modules and archives them into a real library .a file.
This .a file is linked in during the link step vs linking in each .o that is inside the .a file.
The linker knows how to pull out any needed core library code from any of the .o files inside the .a file.
All the other Arduino "libraries" (WIre, LiquidCrystal, etc..) are not true libraries in terms of the compiler tools. The IDE builds all the modules for all the source files for each library that it thinks is used after scanning the sketch. But unlike with the core library modules, it does not create a true archive library .a file for them. Instead it just creates the .o objects for a "library" in a separate directory under the temporary working directory and then tells the linker to link in each individual .o file during the link step.
Hope that helps.
Last post by TXMEDIC - Today at 07:27 am
Here is a list of the pins used on the arduino for programming at this time:
(Part -- program name -- Pin number)
-Photocell -- PhotoCell --Pin A0
-Control box temp/humidity sensor -- ControlBoxTemp -- Pin 22
-Coop temp/humidity sensor -- CoopTemp -- Pin 23
-Run temp/humidity sensor -- RunTemp -- Pin 24
-Control box fan 1 -- CBFan1 -- Pin 25
-Control box fan 2 -- CBFan2 -- Pin 26
-Heater -- HVAC -- Pin 27
-Water Heater -- WHeater -- Pin 28
-Ceiling Fan 1 -- CFan1 -- Pin 29
-Ceiling Fan 2 -- CFan2 -- Pin 30
-Coop Door Motor
-Enable -- CDMotorEnable -- Pin 2
-Direction Close -- CDCloseMotor -- Pin 31
-Direction Open -- CDOpenMotor -- Pin 32
-Coop open switch -- CDOpenSwitch -- Pin 33
-Coop closed switch -- CDCloseSwitch -- Pin 34
-Coop Green LED -- GLed -- Pin 35
-Coop Red LED -- RLed -- Pin 36
-Coop interior light -- CLight -- Pin 37
-Nesting Box Left switch -- NBoxLeft -- Pin 38
-Nesting Box Right switch -- NBoxRight -- Pin 39
-Left Window Motor
-Enable -- LWMotorEnable -- Pin 3
-Direction Close -- LWCloseMotor -- Pin 40
-Direction Open -- LWOpenMotor -- Pin 41
-Right Window Motor
-Enable -- Pin 4
-Direction Close -- RWCloseMotor -- Pin 42
-Direction Open -- RWOpenMotor -- Pin 43
-Electric fence -- EFence -- Pin 44
-LCD backlight button -- LcdButton -- Pin 45
-Main door switch -- MainDoor -- Pin 46
-Run door switch -- RunDoor -- Pin 47
-Real time clock (if needed) -- RTC -- Pin 20/21
-SDA/SCL -- Pin 20/21
- Pin Analog A1-A15
- Pin PWM 5-12
- Pin Comm 14-19
- Pin Digital 48-53
The power will come from a deep cycle battery that will be charged with a solar panel. From the battery it will go to both voltage regulators. One regulator will be set at 7v and the other one will be set at 12v.
- From the 5v regulator it will be connected to a fuse and then to a power bus. From that the arduino board, DHT11's and any other lower voltage part will be connected.
- From the 12v regulator it will be connected to a fuse and then to a power bus. Then the 12v relay board, motor contollers, and any other parts would be connected to the power bus.
All the electronics will be placed into an enclosed box for protection. The battery will also have its own enclosure.
I know with an experienced person that has wrote code for arduino it would probably be easy. For me it has been a hard process and I keep getting confused. I hope someone is around willing to help a guy like myself. I hope I am not asking to much out of anyone. I also would like to hear any ideas that would make this a better setup. Just let me know if any questions arise. Thank you for your time in advance.
Last post by luofan - Today at 07:27 am
i don't have the schematic diagram currently
basically my connection is base on "Crystal ball" example and then
i add a LED to arduino pin 6 , distance sensor to arduino pin A0(14)
grove MP3 player to arduino pin 9 and pin 10
Last post by TXMEDIC - Today at 07:26 am
More details about the programing:
- At certain light level (dawn) I would like the coop motor to open the coop door. Then at another level (twilight) have the interior light come on. Then at the dark level have the coop door close and 2 minutes later have the door open back up for 2 minutes. Then the door would close again. Then have the interior light turn off after 10 minutes of the door closing as well as turning on the electric fence.
- Light levels (which I would adjust until correct for my area):
- dawn: > 120
- twilight: 4 - 120
- dark: < 3
- Have the electric fence turn off prior to the coop motor opening the coop door.
- Have 3 temp/humidity sensors:
- 1 in the control box (ControlBoxTemp)
- 1 in the coop (CoopTemp)
- 1 in the run (RunTemp)
- Would like to have the temperature in Fahrenheit and if possible display it as like 97.1° F and the humidity like 30.5%.
- Have the ControlBoxTemp control the 2 computer fans. At 85 degree F CBfan1 would come on for an hour. After the hour it turns off and CBfan2 comes on for an hour. The fans would turn on/off until the temp reaches 83 degrees F.
- Have the CoopTemp control the 2 ceiling fans. At 85 degree F Cfan1 would come on for and hour and then turn off. Then Cfan2 would come on for an hour and turn off. This would continue until the temp reaches 83 degree F.
- Have the CoopTemp control the windows. At 80 degree F the left and right windows would open. At 70 degree F the windows would close.
- Have the CoopTemp control the heat relay. At 35 degree F the heat relay would come on. Then it would turn off at 40 degree F.
- Have the CoopTemp and RunTemp control the water heater. When either of the temps hits 35 degree F then the water heater is turned on. When the temp reaches 40 degree F the water heater is turned off.
- Have a green and red led light. When the coop door is closed the green light is on. If the coop door becomes stuck either when the door is being opened/closed the red led would flash showing a fault. Also when the main door, run door, or one of the Nesting box doors is opened for longer than 10 seconds the red light would flash until closed or fault is fixed.
- Have the lcd backlight controlled by a button. When the button is hit then the back light comes on for 3 minutes.
-On the display I would like it to show each of the following for 5 seconds and repeat:
- Control Box (fan status, temp, humidity)
- Coop (fan status, temp, humidity)
- Run (temp, humidity),
- Coop Door (open/closed status)
- Windows (Left window: open/closed, Right window open/closed)
- Nesting Box Door (Left Door: locked/unlocked, Right Door: locked/unlocked)
- Electric fence (on/off)
- System Status (Good or fault code)
-fault codes include left/right door unlocked or Coop door stuck
Fan: (On/Off status)
Temp: ##.# F
- I would like to be able to control the different items and have the information shown on a web interface with the arduino but I am unsure of what all is needed as well as how to program and implement that.
- I would like to be able to use motion sensors at night and if a predator approaches the coop then the led strobes would go off for 5 seconds.
- I would like to have cameras (1-2 in the coop and 1 in the run) which I could view in the web interface.
-Would like to have the unit email/text me when ever a door is opened/closed, any faults, or when the motion sensor goes off. I am not sure what all is needed or has to be done to have that if it is connected to the internet with a wireless device.
If wanting to add programing for future implements at time of program I would not mind at all.
Last post by TXMEDIC - Today at 07:24 am
First I would like to thank you for taking your time out to read about the project I am trying to complete. I know it is a long post, which I do apologize, but I wanted to give as much detail to what I am trying to accomplish. Also with all the information I am providing I will have to post this into several parts.
I have been trying to write a sketch for my arduino chicken coop project with no luck. I decided to see if this would help since my schedule is hectic being a paramedic. Plus I want to take some of the burden off my wife. I plan on also implementing a system to control my aquaponics as well as my garden. I really have become very interested since anyone can do almost anything they can think of with arduino.
Anyways enough rambling. I am here to see if anyone would be willing to help write the sketch for me. I have seen a guy with a automated coop using the arduino online. Since I am not using all the items like he is I need the code different. I also am wanting to do other controls than he did. You can see his setup and code here
Last post by rafo - Today at 07:14 am
why not ip??
I write 192.168.1.177, but print 255.255.255.255
how find mac addres??
I am designing a system with Arduino Uno for automating a process. I need to control 4 relays and also 2 dimmers. Commands are issued through bluetooth serial for the ON/OFF operation of relays and also for the dimming value. The dimming value changes only once in a while and Arduino needs to maintains the recent dimming level.
I get external interrupt every 10ms (zero crossing at 50Hz) and use this for dimming. Relay and dimming concept works perfectly independently.
Together they have an issue. Arduino is busy executing the interrupt which is triggered at every 10ms. So it is not able to read the serial data received through bluetooth. How can I set precedence for serial data reading over the 10ms interrupt, to ON/OFF the relays as and when required and also to provide a new value for the dimming level?