I'm a total beginner in hardware, but I'd like to build a piece of material that would make a real bell ring for a specific duration, or eventually instead of a bell, a light that would switch on based on a specific duration.

The start and duration would be triggered remotely via USB or Ethernet, coded in a Java language (part I'm most experienced with).

I thought about using an Arduino, but since I don't know anything in the hardware area, I'm asking you for your advice on how and what do buy for making this the cheaper way.

Also, it would be great if this device would be sell alimented, I'm most thinking about using an USB then, am I right?

Thank you very much for your help :)


First thing first: There is no way to cheaply do this in Java only. There are some chips that can execute Java, but I haven't heard of any which are accessible for beginners.

So it's either C or the Arduino's language if you go for that route.

Next, you're going to need a power source for the bell. This will depend on the bell and will make a major impact on the circuit you'll be making. You'll probably need a relay and protection circuit for it which will control the bell which will be powered from a separate power source (like for example mains power). You'll need to look up specifics for Arduino's (or whatever you want to use) pins and get a relay which can be triggered by such power source.

Next, you'll need Ethernet or USB connection. Matt already recommended USB to RS-232 chips and that is an easy way to solve the problem. The chip will appear as a serial port and all you'll need to do is make a Java program which will send data to the port to the microcontroller.

The other more complicated option would be to use Ethernet. For Arduino, there's an already existing Ethernet shield which is supported by its IDE. You could also pick up another Ethernet board like this one or this one. The positive side of Arduino shield is that you get to use existing library with it that could prove to be helpful. For a third-party solution, you'll have to write the code yourself.

Also a bit of comparison between Arduino, bare AVR chips or PIC.

First, today's PIC and AVR chips are more or less similar in price and capabilities. Some people will recommend PIC and some will recommend AVR. There are countless raging fanboys on each side, but my advice is to ignore them. If you're planning to seriously get into the microcontroller world, it would be good idea to get familiar with both families, because they are both very popular. The chips are generally programmed in C or assembly and there are many development tools (some of them free) available for both lines.

Next we have Arduino. First, it's not a chip. It's a development board line and that is an important difference. It uses AVR chips inside and a special bootloader to make them easier to program. With that you have packaged a nice IDE which uses a C++ like language for programming and may make some things easier for a beginner. Recently it has gained enormous popularity with beginners. Its main problem is that it hides some operational concepts of the chi[ from the user and at one point you may get the feeling that you're fighting the IDE and the language.

On the other hand, we have also the PICAXE which are basically PIC version of Arduino. They also have IDE and programming language (a BASIC derivative) and bootloader. As far as I can see PICAXE boards aren't as popular as Arduino for some reason, but I don't have any experience with them, so I can't elaborate why.

So to sum this up: If you want a single project, consider Arduino or PICAXE. This way, you won't have to pay for setup costs (like programmer, time needed for training and board design and so on) which working with single microcontroller brings.

If you plan to seriously work with microcontrollers in the future, consider doing this with an AVR of PIC chip. It'll be much more educational experience but it could get too complicated if you just doing a one-off project.

| improve this answer | |
  • \$\begingroup\$ Thanks for the reply, everything seems a lot fuzzy but your answer helped me a lot. \$\endgroup\$ – Cyril N. May 30 '11 at 6:33
  • \$\begingroup\$ @cx42net Just don't forget that if you get stuck on a step of the solution that isn't programming of the Java program on the main computer, you could ask for clarification here. \$\endgroup\$ – AndrejaKo May 30 '11 at 6:49
  • \$\begingroup\$ Have you heard of the Javelin Stamp? It's a nice, little micro with a embedded JVM. \$\endgroup\$ – Connor Wolf Jan 17 '13 at 4:10
  • \$\begingroup\$ @Fake Name Yes, which is why I mentioned that there are some chips that can execute Java. While Javelin stamp is on sale now, its normal price is around $90, which I think is too expensive. For that amount of money, whole project OP has in mind can be completed. \$\endgroup\$ – AndrejaKo Jan 17 '13 at 9:13
  • \$\begingroup\$ A solution would not necessarily require any embedded development, as there are suitable special function USB peripherals and modules available of the shelf. Therefore the only programming that needs to be done is on the controlling PC. \$\endgroup\$ – Chris Stratton Jan 17 '13 at 18:33

Personally I'd go about this using a small PIC microcontroller or similar. The USB side of it can be quite a pain to program (on the PIC chip) for the beginner (I haven't fathomed it yet), so a USB to RS232 converter (either as a USB dongle or as a USB to RS232 chip) can make things an awful lot easier to handle.

The PIC16F88 is a good starting point if you don't want to program the USB yourself, and is dirt cheap (you can get free samples from the manufacturer). If you want USB then you should look at the PIC18F series of microcontrollers (I just got my first one working today - yippee).

If you don't want to go about building your own hardware and programming the PIC yourself there are many DIY kits that come with a pre-programmed PIC (such as the K8055 from Velleman) which often have the USB built into it already.

| improve this answer | |
  • \$\begingroup\$ Thanks for your answer, it seems a lot more difficult for a beginner like me that I thought at first, but mixing all the answer will probably help me :) \$\endgroup\$ – Cyril N. May 30 '11 at 6:34

There are off the shelf solutions for USB controlled relays, usually with libraries for a variety of high level languages.

Later Edit: It occurs to me that if the timing requirement isn't too tight, one could just use an off the shelf USB-serial converter and utilize one of the control signals.

It's likely that the controlling program can be written in Java, if the JVM will give you access to the port, or allow you to exec something like the stty tool on linux/unix or a windows equivalent.

| improve this answer | |
  • \$\begingroup\$ Your answer is promising, do you have a link for examples/prices please? \$\endgroup\$ – Cyril N. May 30 '11 at 10:23
  • \$\begingroup\$ Answering that would turn it into a "shopping" question and cause some folks to vote to close - but a web search should find you examples. \$\endgroup\$ – Chris Stratton May 30 '11 at 15:25

I would recommend to use PIC18F24J50. It is a much better microcontroller and it is easy to program. You don't even need high voltage to program it. I managed to program it from scratch (firmware --> DLL --> VB and C++ aplications). What makes it more funny, I even made a simple programmer for it out of industrially preprogrammed MCP2200 microcontroller... It's simple because PIC18F24J50 doesn't need high voltage (like 9V or 12V) to program..

| improve this answer | |
  • \$\begingroup\$ You are sure about the name ? google.com/search?q=PC18F24J50 \$\endgroup\$ – Cyril N. Jan 17 '13 at 7:07
  • \$\begingroup\$ In fact it is PIC18F24J50 Microchip microcontroller.. \$\endgroup\$ – user17952 Jan 17 '13 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.