What techniques should I learn to be able to control appliance programmatically? - hardware-interface

I'd like to be able to control household appliances.
I don't know where to get started, does anyone have any tips?

If by any chance you mean household appliances, youll need to start with KNX And, word to the wise, their API is shockingly frustratingly not nice nor fun; or at least it was when we did a job a few years back.

1) Learn how to build an electronic circuit for the devices you want to control.
2) Find a microcontroller that can be able to fit your requirements.
3) Download the Microcontroller SDK from the manufacturer site
4) Learn how to program it
5) Test and deploy when done.
That's what we did with PIC18F4520 microcontrollers when we tried to control power usage from our homes.
Or, 6) Buy a product already done. (Microsoft perhaps!)

As Jammin suggests there is the possibility to use KNX.
KNX is a communication protocol typically used for home/building automation. There are hundreds of KNX devices capable of controlling electrical equipment but the cost would be overkill just for controlling a few home appliances.
I agree that you should learn how to use a microcontroller, a great starting point would be using an Arduino board. They are cheap, very easy to use with a wealth of source code & tutorials available.
try a starter project such as getting the arduino to turn on a lamp.
Try this tutorial

Read the first capters of "The art of electronics" for a background on power transistors. Then learn about microcontrollers. I recommend AVRs, with the avrisp mkII programmer. It works with windows/linux/mac and gcc. AVRs can communicate over usb,serial,spi and given extra hardware, radio.

Related

BLE with no Smartphone

Has anyone worked with BLE applications where there is no smartphone (or app) involved with very little ability for computing power? I am formulating something around asset tracking where the use of a smartphone would not be possible and minimal computing power would exist. Is it possible?
Interesting concept. But could you be more descriptive on what exactly are you trying to implement in terms of computing power?
I suppose you could try my opinions below, (Apologies for anyone who disagrees, feel free to add things here)
--> Without a smart phone can be done, if the BLE module can write some serial data to a wifi module on the same board. So you will simply program the wifi module with your wifi name and password so it can transmit logs from ble to the web and with that you could use https://thingspeak.com/ or similar IoT cloud based services to analyze your raw data to a meaningful graphical version.
--> Little ability for computing power?, Well if you want to bypass all the UI that does the processing for your raw data, the programming part will be quite complex. There are several ways to handle data BLE data, if the BLE is capable of acting as a Central and Peripheral role at the same time, you could possibly create a network of BLE modules talking to each other and use the raw data to suit your application needs.
Hope this helps.
P.s I have tried both the above methods as part of testing and they both work.

Custom circuit fabrication for modified arduino based IoT

i am learning arduino and want to build a circuit specific to my need with bluetooth, small factor etc. I have created a design in eagal. Is it possible to get is printed with components. what is the beast place to do that.
If you are new to Arduino (and circuit design in general), I would suggest that you take a look at the tutorials offered by Adafruit and Sparkfun.
Both of those companies use Fritzing to create their circuit diagrams. Fritzing is an easy to use layout software and they have their own fabrication service. Their tools are easy to use and economical for low production runs. Alternatively, Seeed Studio offers a PCB fabrication and assembly service.
Generally, if you are in the prototyping stage it can be cost prohibitive to automate the PCB assembly process with a pick and place machine, so the assembly is done by hand. You may find it cheaper to learn to solder or find a friend to assemble your board.
Any pcb manufacturer will produce pcbs for you. it's all a matter of how much you are willing to pay, where you live, what quality you expect and how long you want to wait. You can get cheap PCBs from China if you are willing to wait several weeks and don't have to high expectations regarding quality.
Having a single PCB manufactured and populated will most likely cost you a few houndred dollars, depending on how many layers you have, how many components...
It would be much cheaper to populate it yourself.
Now looking at your post I'd say you don't have too much experience so you will most likely need several iterations until you get the board right.
Do you really need your own board? Why not something off-the-shelf?
Do you really need a professionally made PCB?
Will it ever pay off?
There are enough methods to make your own prototype PCBs on the cheap.
I think you should discuss your design and manufacturing plans with someone who has experience. Reach out to the EEVBlog forums and provide more information than you did here.

Computerless, wireless web activated remote printing

Im in need of a solution, I basically require a way to print from a web page to a printer. But the printer needs to be standalone, either plugging directly into phone line, using a sim card etc. Does anyone know of a good solution for this?
It needs to be cheap to run, setup costs aren't that much of an issue, but obviously the cheaper the better.
If landline is okay, I believe the device you want is an antiquated piece of hardware called a "fax machine"
If wireless on a mobile network, the service plan is more of a cost concern than the hardware, though the two might be bundled together. For example, a company called bug labs is working on some kind of partnership with verizon for connecting their embedded linux device construction kit.

no response from microsd card

I was trying to interface a 64 mb MicroSD card with MicroChip MCU. I sent cmd0-addr3-addr2-addr1-addr0-crc but didn't got any response.
What should I do next?
From the way you've phrased the question, it sounds like you don't have a very good understanding of how to communicate with external peripherals in general, on an embedded device. You should reference Microchip AN1169 which goes into detail on implementing SD card communication with an SD card. If that's not enough help, Microchip's application engineers are usually very helpful - don't rule out calling one.
On the other hand, if the application note is still over your head, you should strongly consider starting off with a less ambitious project - something like driving a motor or other simple IO that is not address-bound. The addressing issues can become very difficult when you already aren't familiar with embedded programming.
I stumbled on this thread because I was facing a similar problem. I know this thread is old but I want to post my experience here just for the record.
I have been doing FS and device programming for more than 8 yrs now so I am not a newbie :)
I was trying out PIC32MX and its inbuilt libraries for the first time and ran into the same problem as mentioned in the question. I double checked my connections after which I started doubting the library. I downloaded the latest versions for fixes but same behavior.
After lot of debugging for both hardware and software I found out that the microsd sockets contact for power was not sticking to the card contact at all! No power No response!

Microcontroller + Verilog/VHDL simulator?

Over the years I've worked on a number of microcontroller-based projects; mostly with Microchip's PICs. I've used various microcontroller simulators, and while they can be very helpful at times, I often find myself frustrated. In real life microcontrollers never exist alone and the firmware's behavior is dependent on the environment. However, none of the sims I've used provide decent support for anything outside the microcontroller.
My first thought was to model the entire board in Verilog. But, I'd rather not create an entire CPU model, and I haven't had much luck finding existing models for the chips I use. Regardless, I really don't need, or want, to simulate the proc at that level of detail, and I'd like to retain the debugging facilities provided by a regular processor sim.
It seems to me that the ideal solution would be a hybrid simulator that interfaces a traditional processor simulator with a Verilog model.
Does such a thing exist?
I've used the Altera Nios II processor embedded on a FPGA. Altera provides a toolchain for simulating the CPU (with its software) together with your custom logic in a simulator. I suppose that a similar setup can be achieved by downloading a VHDL/Verilog core of your CPU (Did you try opencores ? They have lots of stuff there).
But keep in mind that it is going to be mind-bogglingly slow, so don't expect to simulate whole complex processes this way. The best you can hope for is simulating fine software-hardware interaction points to debug problems. If you need a deeper simulation, consider running it on a FPGA with built-in monitoring code.
For the "simulate the whole board" approach,
The Free Model Foundry has a large number of models, some in VHDL others in Verilog, that are available now.. but you'll need to pay to have new models created. These are very helpful in being sure the board is built correctly.
But I think the more common approach when debugging your PIC is to just build a board, then work on the firmware. In the chip world, (where the firmware is running on a microprocessor in a chip that hasn't gone to fab yet) people often resort to very expensive systems (or renting time on them) that allow compiling part of the design into an emulator while the rest of the design runs in the normal simulator environment. Without the barrier of an expensive mask set for the chip, the cost is just not justifiable for a Circuit board. Although I've heard of some creative applications of Simulink (Mathworks) with FPGA's, but my recollection is that one either ran the system on the computer, or programmed the device and ran the same thing in realtime.
I believe both Cadence (ask about Palladium) and Mentor Graphics have that integrated solution if you have the money to spend on it.
What I have done recently is create an interface between the simulation environment and host system. Different hdl simulators have different interfaces, and getting the simulator NOT think in batch mode, the traditional simulation model, instead run for ever like a real design is half of the problem.
Then from the host using C (or whatever) you can create abstractions that may or may not allow you to write your application software for whatever target (depending on what language and compiler capabilities you have). For example you can make a generic poke and peek function and on the final target have those actually poke and peek memory or I/O, but for simulation through the abstraction you talk to a testbench in the simulation that simulates the same memory cycle.
I went one step further and used (Berkeley) sockets between the host and test bench so that the simulation can keep running while the host applications stop and start. Not unlike having a real processor with an OS that you are starting applications and running them to completion and starting another. At least for test applications, for delivery you probably only have one app.
By creating these abstraction layers I can write real applications that will be used on the target when it is built. Along the way you can use software simulation of the logic initially, then if you like build an fpga with an abstraction interface (throw away logic) say a uart for example. Replace the shim between the applications abstraction layer and the simulator with a uart interface, or whatever. Then when you marry the processor and logic in the same chip or on the same board, replace the abstraction layer again with direct calls to whatever interfaces they have always though they were talking to. If something breaks and you have retained the abstraction layer you can take the application back to the simulation model and have access to all of your logic internals.
Specifically this time around I am using a hdl language cyclicity cdl which is on sourceforge, the documentation needs some help but the examples may get you going, and it produces synthesizable verilog, so you get an extra win there. I threw out all the scripting batch stuff other than the bare minimum needed to connect and start a C simulation model. So my test bench is in C (well C++ technically) the sockets layer was done there. The output can be .vcd files which gtkwave uses. Basically you can do the bulk of your HDL design using open source software with no licenses, etc. By adding one or two lines of code to the CDL simulation part I was able to have it run as an infinite loop, which I can say works quite well, there doesnt appear to be any memory leaks, etc.
both modelsim and cadence have standardized ways of connecting host C programs to the simulation world and from there you can use an IPC to get to host applications talking to an abstraction layer api.
this is probably way overkill for a pic, I have given up pics a while ago for the faster and C friendly arm based micros anyway. There is/was an open core pic that you could simply incorporate into your simulation, even though that is not what you are trying to do here.
Not that I've seen. Your best bet is to properly define the interfaces and behavior between the uC and FPGA and then define a series of test waveforms that can be applied using an automated tester. You would have to make the automated tester (or perhaps a logic analyzer may have some such functionality) out of an FPGA or uC (apply waveform, watch interrupts, breakpoints, etc). If you really want I know that Opencores.org has PIC and AVR-like 8-bit uC cores defined as VHDL, so you could implement your entire project on the FPGA and then just debug that.
Generally there isn't need to model the CPU at the RTL level. Since you don't really care about what it does bit by bit; you generally care about what it does, e.g. register values, memories and bus access.
The simplest is call at Bus Functional Model. This just generates the read and writes that the CPU does, often based on a text file. These are available for some CPUs and many popular buses (e.g. PCI, PCIe). THese simulate super fast.
The next step up is a functional cycle-accurate model. Those simulate fast. They are often encrypted.
Last is a full RTL model. Those usually are only available if you are working closely with the CPU vendor, e.g. using their core in your ASIC. Typically these are encrypted, unless you are a huge company.
Memory models are typically cycle-accurate (e.g. Micron).
My workmates from the hardware department use FPGA simulation software quite often to find timing-bugs and trace down strange behaviours.
Simulating one or two milliseconds can take several hours, so using the simulator for anything but very small things is not feasable.
You may want to have a look at SystemC though. http://en.wikipedia.org/wiki/SystemC

Resources