Show Posts
Pages: [1] 2 3 ... 13
1  Using Arduino / Project Guidance / Re: Mac power control via keyboard shortcut? on: July 05, 2014, 02:09:43 pm

Yes, please refer to this discussion thread
and to the open issue #1295

  Michael

2  Using Arduino / Project Guidance / Re: ArduinoBT scans for BT devices on: October 16, 2013, 03:57:23 pm
What I want to do is detect any bluetooth devices around that are discoverable. And to get the signal strength of the bluetooth signal.

Look out for the INQUIRY command which can be used to get all discoverable bluetooth devices:
  Command INQUIRY is used to find other Bluetooth devices in the area i.e. to make a device discovery.

You should also search for existing code which already implements such a solution, I think I've seen a similar question in this forum some month ago.

  Michael



3  Using Arduino / Project Guidance / Re: leonardo as keyboard does not wake windows 7 from sleep on: October 15, 2013, 01:34:04 pm
when will this find its way into the official builds?

There needs to be some cleanup, especially for the second line (UDCON |= (1 << RMWKUP)) which should not be necessary in a normal suspend/wakeup scenario.
The USB state machine must conform to the USB standard and to my understanding this second line violates the USB standard because it send a wakeup even when the bus is not in idle state or at least the Arduino USB state machine doesn't know the bus is in idle state.

I mean the following sentence in chapter 7.1.7.7. "Resume" of the USB 2.0 spec:
"A device with remote wakeup capability may not generate resume signaling unless the bus has been continuously in the Idle state for 5 ms (TWTRSM)."

And chapter 9.1.1.6 "Suspended":
"If a USB device is capable of remote wakeup signaling, the device must support the ability of the host to enable and disable this capability. When the device is reset, remote wakeup signaling must be disabled."

And chapter 9.4.5 "Get Status":
"The Remote Wakeup field indicates whether the device is currently enabled to request remote wakeup. The default mode for devices that support remote wakeup is disabled."

Unfortunately I don't have much time at the moment for this clarification. Anybody else with some USB know-how?

   Michael
4  Using Arduino / Project Guidance / Re: Converting on IR code to another on: July 19, 2013, 02:06:07 pm
Problem comes that this IR code is compatible only for one DVD player (Zemex DVD500u).
My idea is to read this IR code and convert it to another. What do you think is this possible ?

The first step is to identify the protocol and code of your DVD player. http://www.hifi-remote.com/forums/ is a good source of information and tools for this purpose. This could be the hardest step.

The second step is to recognize the code and the third step to emit the new IR code. There are a lot of projects which do this.

  Michael
5  Using Arduino / Microcontrollers / Re: AVR Dragon on: July 18, 2013, 04:24:40 pm
Oh and there's no Arduino code..no digitalwrite this or analog read..you have to use embedded C . Which is  not hard either. Oh and your arduino libraries are no good. But atmel studio has its own tools. And then you might want to join the AVR freaks forum.

There is a 'Arduino for Atmel Studio' plugin for Atmel Studio 6.1 which should make it possible to use the Arduino core and libraries within Atmel Studio, but I haven't used it myself, so I can't tell you how good it works.

  Michael
6  Using Arduino / Microcontrollers / Re: New optiboot; beta testers welcome... on: July 18, 2013, 04:14:42 pm
instead of copying the "cores" directory, you can reference the original Arduino cores directory using the following line in boards.txt:
Code:
arduino_optiboot.build.core=arduino:arduino

"arduino_optiboot" has to be replaced by your own prefix
7  Community / Gigs and Collaborations / Re: Arduino Single Channel Logic Analyser on: July 13, 2013, 03:53:28 pm
I've been experimenting with the Input Capture Mode of the timers for fast capturing of a single boolean signal and wrote an article about it. You can capture pulse-widths of 3┬Ás with an accuracy of 65ns with the sketch attached to the article.

The article itself is in German, but the screenshots and the code (with english comments) should be enough to understand how it works:
http://www.mikrocontroller.net/articles/High-Speed_capture_mit_ATmega_Timer

Here the direct link to the code for the Arduinos
For Uno, Leonardo and other ATmega328 based Arduinos: HighSpeedCaptureAtmegaTimer Source.zip
For the Arduino Mega2560: HighSpeedCaptureAtmegaTimerATmega2560 Source.zip

  Michael
8  Using Arduino / Networking, Protocols, and Devices / Re: Bluetooth presence on: July 08, 2013, 04:59:34 pm
Can you detect the presence of an iPhone in a room without prior Pairing? 
Will this work with Android?

You can use bluetooth discovery to detect all devices which have discovery enabled. Unfortunately most devices nowadays only enable the discovery mode for a short time (e.g. 5 minutes) because of security issues so this is normally not very useful.

Quote
Is there a better solution?  Perhaps looking for any RF energy at all including GSM/Wifi?
In this case, how can you differentiate different users and devices?

It would be hard to distinguish between different protocols and almost impossible to distinguish different devices.

The question is which kind of frames is sent by a bluetooth devices when it isn't in discovery mode.

  Michael
9  Using Arduino / Project Guidance / Re: Arduino as keyboard - question on: July 06, 2013, 04:46:20 am
Thanks for the reply! About the Leonardo thing; here is the link I found: http://mitchtech.net/arduino-usb-hid-keyboard/

In that link they are using an Arduino Uno; and it seems just as easy to me. Since using a Leonardo would cost about as much as the Uno, what would be the advantage of the Leonardo?

I really appreciate the help & quick responses btw, thank you!

The Uno has two MCUs:
  • ATmega8U2 which normally handles "only" the USB to serial conversion
  • ATmega328P which runs the normal Arduino program

Normally in an Arduino environment the program of the ATmega8U2 is not changed and programming this chip is not directly supported by the Arduino environment. You can do this but actually your are leaving the 'Arduino way' which means it will be much harder if something goes wrong.

It depends on your experience and your endurance if it makes sense to leave the Arduino way. When you are new to microcontrollers it might frustrate you. For example when you want to send anything other than the keys which are used in the examples on the site you mentioned, you have to study the USB HID and Usage Table documentation (and you have to know that you will find the information there) instead of just using the Arduino Library function Keyboard.print("abc").

The Arduino Leonardo keyboard functionality is directly supported by Arduino so it will be easier to use and is better supported. It depends if you want to have fast success or want to learn a lot of things (that you could not imagine it even exists) and do it the hard way.

Today I prefer the hard way, but I started do it the Arduino way smiley-grin

  Michael
10  Using Arduino / Project Guidance / Re: Arduino as keyboard - question on: July 06, 2013, 04:15:50 am
A while back I had this idea to use an Arduino, connect some buttons to it and make it act as a keyboard; so I could for example set 1 button to do a certain short-cut on my computer.

For the Arduino Leonardo which uses the ATMega32U4 this can easily be done and some examples are already included. The best way is to download the latest Arduino packaged and browse the examples (menu File/Examples/09.USB/Keyboard):
Quote
void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
    // and it's currently pressed:
  && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
    Keyboard.print("You pressed the button ");
    Keyboard.print(counter);
    Keyboard.println(" times.");
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState; 
}


Quote
For this to work I need to connect the Arduino to my PC via the USB cable, which is obvious and would work just fine; but I was wondering if there is some way I could make this work by just using the chip and an external crystal; so I wouldn't "lose" the entire Arduino in my project; but just the cheap ATMega? (I've seen multiple videos that this is possible, but I haven't yet seen a video in which they keep the USB connection)

For a beginner it is much easier to start using an original Arduino board (here: the Leonardo). For the ATmega328P there is a DIP version which you can easily solder by yourself, but the ATmega328P has no USB port. The ATmega32U4 which has an USB port is only available in SMD package (TQFP44) which means you can't simply solder it yourself.

  Michael
11  Using Arduino / Project Guidance / Re: leonardo as keyboard does not wake windows 7 from sleep on: July 06, 2013, 03:58:45 am
Still looking for testers...

Here it works for
  • Mac OSX (on a MacBook Pro)
  • Windows 7 (on a MacBook Pro)
  • Windows 8 (on a Wetab)

Any comments if it is working or not and what blink codes you get are welcome.

In the pull request #1488 I added also a feature to send your computer to sleep mode or shut it down. When you are interested, you can get the code from there.

You can use it in the following way:
Code:
  Keyboard.systemControl(SYSTEM_CONTROL_POWER_DOWN);
or
Code:
  Keyboard.systemControl(SYSTEM_CONTROL_SLEEP);

There are some more commands defined in USBAPI.h, but most of the do nothing on my Mac:
Code:
#define SYSTEM_CONTROL_POWER_DOWN              1
#define SYSTEM_CONTROL_SLEEP                   2
#define SYSTEM_CONTROL_WAKEUP                  3
#define SYSTEM_CONTROL_COLD_RESTART            4
#define SYSTEM_CONTROL_WARM_RESTART            5
#define SYSTEM_CONTROL_DOCK                    6
#define SYSTEM_CONTROL_UNDOCK                  7
#define SYSTEM_CONTROL_SPEAKER_MUTE            8
#define SYSTEM_CONTROL_HIBERNATE               9
#define SYSTEM_CONTROL_DISPLAY_INVERT         10
#define SYSTEM_CONTROL_DISPLAY_INTERNAL       11
#define SYSTEM_CONTROL_DISPLAY_EXTERNAL       12
#define SYSTEM_CONTROL_DISPLAY_BOTH           13
#define SYSTEM_CONTROL_DISPLAY_DUAL           14
#define SYSTEM_CONTROL_DISPLAY_TOGGLE_INT_EXT 15
#define SYSTEM_CONTROL_DISPLAY_SWAP           16

  Michael
12  Using Arduino / Project Guidance / Re: USB Game Controller Firmware, being able to receive data on: July 05, 2013, 04:09:00 pm
The original PC software

Did you write this software? Do you want to replace the original software? I don't understand what you want to do...

Quote from: skombijohn
It was quite obvious to handle that in an executable in different timer based threads and so on.
But how can I implement that in a dll?

It doesn't depend if the code is written as a DLL or directly in the EXE. The question is who is loading the DLL and calling its functions.

Quote from: skombijohn
Should I still have that executable that does its own collecting and provide the collected data to send to the dll somehow? Anyway, then the dll would still need some sort of periodic collecting/sending thread....hmmmmm

It might make sense to have one DLL which does the communication to the microcontroller and one for each game which provides data. The application could then select which of the game DLLs to load and activate at a time and also create a thread which polls the DLLs for new data from the games.

   Michael
13  Using Arduino / Project Guidance / Re: USB Game Controller Firmware, being able to receive data on: July 03, 2013, 02:02:41 pm
- Is it generally possible to have a HID device send "button events" and also receive "data events" at the same time ?

Sure, each HID device can have IN and OUT sections. Even a normal keyboard has the LEDs as OUT reports. You have to define the reports (telegrams) and how each bit is handled.

You should read the following documents from http://www.usb.org:

"USB in a Nutshell" is also a good starting point to understand USB.

Quote
- How can I write the PC utility/driver/software/whatever that has to provide the "data events" ? What is the communication protocol/frame?

Normally you use a standard driver and only write the application part.

For MS Windows you can use a user level dll and don't need to write a kernel mode driver:
http://msdn.microsoft.com/en-us/library/windows/hardware/jj126193%28v=vs.85%29.aspx


Quote
- How do I implement the firmware to send AND receive the events on the arduino?

The question is if it will be easier to do it with LUFA or Arduino. Arduino provides some support for standard USB devices, but it is not easy to extend this features. LUFA only provides an open framework to make your own USB devices (see the examples). Both require a lot of learning to make your own USB device with custom USB reports.

Quote
It's not that I am too lazy to read about how to write HID firmware for the arduino, I am just not sure, IF the concept is realizable without major hurdles like driver signing and so on.

For joysticks, you don't need an own driver for HID devices because the operating system already provides one. HID devices describe their features themselve.

   Michael



 
14  Using Arduino / Project Guidance / Re: leonardo as keyboard does not wake windows 7 from sleep on: July 02, 2013, 04:07:22 pm
I got it working when I used the code:
USBDevice.wakeupHost();
UDCON |= (1 << RMWKUP);

I don't understand, why you need this last line.

I made an updated version which handles the SUSPEND mode (at least it acknowledges SUSPEND). Install it like the previous version by replacing the original files in your Arduino installation path (see attachment USBWakup2.zip).

I also added a diagnostic sketch to show the state changes via a blink code of the internal LED (see attachment USBWakup-130702g.zip):

Meaning of the blink codes:
1x remote wakeup enabled from the PC
2x remote wakeup disabled from the PC
3x USB host signals SUSPEND state
4x USB host signals end of SUSPEND state (wakeup)
9x USB wakeup rejected because
10x USB wakeup accepted

When the Leonardo is starting (after the bootloader blinks), you should see [3x], 1x, 4x blink.
When the PC goes to standby, you should see 3x blink
When the PC wakes up, you should see 10x blink followed by 4x blink

Currently I don't understand the initial 3x blink which I see on Mac OSX.

What blink codes do you get?

  Michael

15  Using Arduino / Project Guidance / Re: leonardo as keyboard does not wake windows 7 from sleep on: July 01, 2013, 04:15:50 pm
I got it working when I used the code:
USBDevice.wakeupHost();
UDCON |= (1 << RMWKUP);

Did you wait at least 20s after going to standby and before calling USBDevice.wakeupHost()?
Which operating system are you using?
Can you please reboot your computer and plug-out and plug-in your Arduino and try again? I've seen that the HID descriptor is cached by the operating system and maybe it didn't recognize the USB_CONFIG_REMOTE_WAKEUP flag in the configuration.

   Michael
Pages: [1] 2 3 ... 13