need help with alarm circuit [toggle output]

wozzzzza

Member level 3
Joined
Dec 10, 2008
Messages
64
Helped
0
Reputation
0
Reaction score
5
Trophy points
1,288
Activity points
1,681
been out of electronics too long and ant work this one out now.
i want to build a circuit, an alarm circuit, that will toggle armed and unarmed with 2 separate high inputs, e.g. one input goes high for half a second to turn it on and another input goes high for half a second that turns it off. no matter how many times a high pulse is sent to the on input, the alarm will remain armed and vica versa.
another n/c input to trigger the alarm out for 5 seconds, so when this input is open circuit it will trigger the alarm output for 5 seconds only when the circuit is armed. after 5 seconds waits for another alarm input.
how can i build something like this easily??

MODERATOR ACTION:
  • Added relevant information on title
 
Last edited by a moderator:
now i come up with this and cant work out how to get it fixed
Delete the board that was there before you did the add Nano Old.

OR

Just construct a new project using same blocks as I did.

Note when you save project save to your PC, usually one has a folder in Documents
named mblock to keep track of projects.
--- Updated ---


Initially just do the projects on the Nano board, so select that as board, not the ATTINY85.
The Nano board should already have standard firmware in it.

Once you do that then you can do the update of firmware to turn Nano into ISP and then select ATTINY85
as core/target and do the programing into ATTINY85 external chip. Google "nano program attiny85"
for step by step method.

Programmer selection :

https://wiki-content.arduino.cc/en/Guide/ArduinoNano try this first, an example blink led




In latest IDE the USB (2 at bottom of list) programmers were added, that may be a way of programming ATTINY85. I
have not investigated that so you will have to experiment/google for folks that have.



Arduino can be a maze of trail by fire, so take notes, screen captures once you
get a stable environment. Note Zadig updating of the USB interface part on
Arduino boards is another factor in this. Boards coming out of china have had a
mishmash of usb interface chips/drivers. When I get a board usually the first
think I do is burn a new updated bootloader into board to make sure its up to
date. Note bootloader options a whole other topic for a later time, for now stick
with standard selections. Until you decide to use Nano as ISP then that firmware
has to be burned into part.

 
Last edited:

there just seems to be no communication with the board, always failing.
im starting to think i have the wrong type of cable?
i have tried 5 different ones i have lying around ive collected over the years, does it need a certain cable???
 

If you go to device manager, and plug board in, in the ports submenu you should see a
connection popup and a beep should sound.



If you dont either cable is missing data lines (its just a power cable), or firmware on board needs
update or both.

Youtube lots of serial connection help for Arduino



Regards, Dana..
 

hey i sorted it, got the blinking led program working and changing speeds.
was the cable all along. i was hoping i had another one in the shed with my laser engraver and it is the same cable connection and i know that one is a known data cable, so these others must be power only.
problem solved thanks.
now i will start doing the other stuff with the tiny thing
 
Last edited:

now as i just thought i had it, i went through this page https://solosodium.github.io/2017-08-07-program-attint85-with-arduino-nano
again and got to burning bootloader and got the following error, what now?? ive double checked all the connections and they are per diagram

avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

Failed chip erase: uploading error: exit status 1
 

Go to the Arduino forums on this, seems to be a lot of hits on this very
same issue. Broad spectrum of settings, protoboard issues, revisions.....


I have occasionally used one of these to do the programming :


I used primarily AVRDUDE (Arduino IDE Programmer software) early in most ATTINY85
work, but discovered that the above programmer had broader chip coverage so do use
it if I run into trouble with IDE. Open source, Arduino, is a bit of a minefield, one has to
have a good 'aggravation resistant coefficient

One other, there has been clone ATTINY85 chips that have had issues, so whenever possible
buy from reliable supplier to make sure you get Atmel, now Microchip, manufactured parts.
My apologies for not mentioning this earlier. I still buy from Alliexpress, and pay attention
to the specific suppliers product page completeness and # sold when I do. Does not hurt
to ask sellers if chips are legit.

Regards, Dana.
 
Last edited:

if you had used my suggestion in post #2, you would have been done a week ago. A tiny chip does not imply a tiny amount of work. Just getting the tools working can be a frustrating, time-consuming ordeal.
 

Of course user cal in ATTINY85, simple procedure, will yield +/- 1% timing
accuracy (over T and V). And operate down to 1.8V. No cal +/- 10% (over T).

There is always the programmability for additional ideas and functionality using
the ATTINY85 micro.

Pins to drive status LEDs.......

A/D and timers to .....?


Regards, Dana.
 

if you had used my suggestion in post #2, you would have been done a week ago. A tiny chip does not imply a tiny amount of work. Just getting the tools working can be a frustrating, time-consuming ordeal.
true, but i wanted to try something new i haven't worked with before.
--- Updated ---

my stuff is from reputable seller, it is not clone, its atmel chip and the other one is not clone either.
will do some more research on the above forums thanks.
 

my stuff is from reputable seller, it is not clone, its atmel chip and the other one is not clone either.
will do some more research on the above forums thanks.

When it says: "Invalid device signature." ... then it shoud be an easy task to find out what
* ID the programmer / compiler expects
* ID the microcontroller returns.

Klaus
 

i figured it out, i had the processor set to attiny25 not 85 and i was using the arrow to upload things instead of going to sketch->upload using programmer
once i sorted those 2 things out it started working perfectly.
this youtube tutorial was perfect thanks for your help to date, now onto the mboard program see if i can get that working.
 
any tips on sending the mblock code to the IDE to write to the chip? im getting a million compile errors.
 

Yes, just copy and paste the code into the IDE. See the little X 1/3 way down right margin
in mBlock, click that to see the code.

 

Note at top of mBlock code are the libs (the #includes) that need to be installed in the Arduino IDE.
In your case (my example) the first 2 I think are always installed, but maybe the 3'rd
has to be checked.



Note when using mBlock directly on board, like Nano, there is a direct upload selection at bottom
of left window. You first connect then hit upload.

But if Nano is configed as ISP programing the ATTINY85 then you have to do the cut and paste
routine into a new Arduino IDE project window. First time you do this. Then for edits you open
the Arduino project you have been working on, erase all the code, and paste the edited mBlock code
back into the project window you just erased the code from.

Note I compiled the mBlock code I gave you, compiled fine, just as a verification. But just into a
Nano board. Using Nano as ISP, same code should be fine.


As an aside here is an example of a more sophisticated application of block programming :


If you google "block programming language's" you will find a number of variants, all with
common methods and all with additional capabilities., Once you learn one the rest are
pretty easy.
 
Last edited:

If you want us to help you:
* tell us what you did
* show us the error messages

Klaus
trying this basic one copy code from mblock to ide and compile and get following errors


--- Updated ---

dont fully get it, so the 3 packages you showed opta, pmc, cloud i need to install?
 

Attachments

  • code.jpg
    364.8 KB · Views: 18
Last edited by a moderator:

dont fully get it, so the 3 packages you showed opta, pmc, cloud i need to install?

No, that project was something I was working on, posted just to show you the lib icon and listing
of libs and search for a lib

Your errors all seem centered around the Wire library. Check your libs installed and what version.
I found libs installed in the local folder, the Programs folder, and the \documents\Arduino folder.
Very confusing. It could be related to my config for IDE different than yours. Notice the defualt setting
I have in my IDE for location (at top)



Is this compile of my example code originally posted ? I must admit long ago I ran into install
issues and never did totally figure out what went where. But I did have a folder in \documents\Arduino
where most of my libs wound up. You might want to post at the Arduino forum code and errors and give them
a shot at explaining. OR do a clean install, do an uninstall first.

 
Last edited:

Hi,

in addition to what Dana wrote
* There are global libraries (need to be installed with the Arduino Library Manager. If I´m not mistaken those libraries may have different locations .. but Arduino cares for this. Global libraries are included to a project using: "#include <global_library.h> // mind the "<" and ">"
* There are project libraries, usually located in your project folder. You may write your owns. To include them, write: "#include "project_library.h" // mind the [ " ]

***
Error messages:
--> read and process them from top to bottom. If the upper error is solved .. often many following errors don´t exist any more.
In your case: the first error says that "SDA is undeclared".
SDA is one signal line of the I2C interface. SDA is "connected" to a pin of your microcontroller. The compiler needs to know which pin this is. This is what is missing here.
Thus the compiler expects somewhere in the code (your code or in the linked libraries) a line like "#define SDA PinNumber" .. where pinNumber is the ID for the according pin of the SDA signal.

--> check whether your application needs the I2C (TWI) interface at all.
--> check whether you have selected the correct board / microcontroller in your Arduino "tools" setting.
--> in case you need the I2C interface: check whether your microcontroller provides an I2C interface.
--> mabe you need to choose a different board/microcontroller ... or modify your application (code)

*****
If you are confused right now ... then don´t read the following lines, because they are for more advaced usage.

But there are more options: that may be true for your application or not.
* for microcontrollers without hardware I2C interface it is possible to emulate it by bit banging (software solution. I don´t recommend it, because it usually consumes a lot of processing power)
* for microcontrollers with multiple hardware I2C interfaces you need to configure/initialize them individually
* for microcontrollers with exactly one I2C interface and hard wired it to dedicated pins, I expect the library that it cares for this, and thus you don´t need to define SDA at all
* and there are mircocontrollers where you can "multiplex" your I2C interface to a pin of your choice. Then you may be forced to tell the compiler this pin location by using the according "#include...." line.

Klaus
 

First compile and reload standard firmata into your Nano, then -



Looks like libs are in at least two places, the one you set up as default in
"file", "preferences", and the intrinsic libs Arduino installs, like Wire, in
your user path :

C:\Users\Wozzzzza\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\

Your IDE version quite old, I would update that by uninstalling Arduino, then erasing everything

C:\Users\Wozzzzza\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\

associated with Arduino15 and its subfolders. I would also go to C:\Program Files\Arduino and erase that
folder. Same if you have an Arduino in \documents\Arduino. Lastly, unless you prefer otherwise, when
doing new install set in preferences during install your main sketch folder as \documents\Arduino after
you manually create that folder in documents. Thats the "Normal" windows document folder.

NOTE DO THIS IF YOU DO NOT HAVE ANY OTHER DEVLEOPMENT WORK YOU WISH TO SAVE, OTHERWISE
JUST DO THE UPGRADE OPTION TO INSTALL 2.3.3


Then load this as a new project :



And see if it compiles. Its a handy project to detect I2C devices connected (for future reference) and their addresses.

Make sure board and com port (your COM port #) and processor setup, your settings are correct :




Then if this compiles and runs load the mBlock program and give it a try on the Nano. If thats
a go then do the changes to make the Nano an ISP and program the ATTINY85.


Regards, Dana.
 
Last edited:

Cookies are required to use this site. You must accept them to continue using the site. Learn more…