Progress on RFM12B… sorta

Notice how the antenna's are soldered on inconsistantly, I fixed that

So today, after updating LScreamer to run in Windows, and pushing those changes to the LScreamer Sourceforge page, I decided to work on getting the RFM12B’s up and running.  So i went ahead and looked at the JeeNode’s schematic, since I’ll be using their library for it.  Went and soldered them up, so all I had to do is to get 2 breadboarded ATMEGA328’s running at 16 MHz each.  Should be easy.

I took two breadboards, wired them up identically, and flashed a 16MHz bootloader on them, all without problem.  When I tried to communicate with one of them, I received a bunch of 0’s.  A quick test I do to test my MAX3232 serial to ttl converter is to connect the TX and RX lines, so anything it sends should be echo’d back.

To summarize, I spent about 2 hours troubleshooting this circuit, which is dead simple.  The moral of the story: know your programming tools, and have programming tools that work reliably.  I know my Serial to TTL circuit works reliably now, but it was one of the things I questioned.  My Serial cable sometimes has problems, which is solved by unplugging and replugging it.  Oh and having a capacitor between gnd and vcc is good, and if it causes your circuit to stop returning random noise, then that is a good thing.  Hopefully I’ll have some wireless 1’s and 0’s tomorrow!

Advertisements

Source Code for VDay 2012 Released, and it is called AdvMenu!

I am really happy with how much progress I did tonight.  I finished all of the LED functions, so that you can vary brightness, speed, and pattern, from the settings menu.  Those settings are stored in eeprom just like everything else.

When you first run it, you’ll import it into your Arduino libraries directory.  Then you’ll restart Arduino, and check out the example.  You can modify which pins are for the LCD, and which Analog input’s you want to use.  The circuit is described in AdvMenu.cpp, and I plan on posting a schematic eventually.  When you look at the example, you’ll see that only a few initializations are in the main arduino sketch.  You’ll have to modify the actual AdvMenu.cpp, AdvMenu.h and MusicMenu.cpp to suit your tastes.

I have included 1 sample card and 1 hidden card, just to show you the capabilities of the library.  I have also included #defines in the top of AdvMenu.h that can do things like disable music (saves 11274 bytes), disable cards (saves 664 bytes), disable passwords.  It also does some pretty necessary stuff.  The first time you run it, you’ll need SETUPEEPROM and SETUPMENU uncommented, since it will setup the default menu and then save it to eeprom.  After you do that, then you’ll need to comment them out.

For the Shift Registers, you’ll need to manually define them in AdvMenu.h.  Since I wanted speed, you’ll define the pin numbers, their ports, and the pin number of the port.  You can look at this pin mapping to figure out what you need to put there.

I’ll continue to update this library as I add more functions to this VDay card.  My next thing to add is a little game called Dodge.  Please let me know if you have any suggestions, or if you like it 🙂  Progress!!!

Working on LED functions for VDay Card

well I'm happy with it at least :PThe above picture is my improved desk layout, which seems to work pretty well for me.

I wasn’t feeling very motivated today, so I tried to do as much as I could.  I improved the functionality of the PS2X library for my controller, oddly enough, by enabling both of the debug comments.  I was testing this with a 8 MHz ATMEGA328, whereas the library was written using an 16MHz ATMEGA328.  For my next LCD controller, I’ll use 16MHz I think, but I also think it is good to see if your application can handle just 8MHz, since it will mean 1 less part.

I decided that after I get the LED functions ready, I will sanitize it then publish it as AdvMenu 1.0.  I’m not sure if people will be eager to remove music or the LED’s, but I’ll leave them enabled until someone actually is interested in me adding the option of #defining them.  This won’t be a library where you add it and your done, no, the menu system is very much integrated into the library, so to edit the menu, you’ll need to modify the library.  With this AdvMenu, your entire application is contained within the menu system, so your actual sketch is pretty empty.  You’d still need to enable the LCD and call AdvMenu by using MainMenu(lcd);, but that would be it.

When I use this library, I’ll use the menu system to hold the functions I would want to perform, plus any settings I wish to change.  I think I’ll still use the 6 buttons (DPad + B + A), since so much can be done with those buttons.  But I would also have a wireless controller as well (PS2 or Nunchuck).  Trying to find a good cheap PS2 controller, but I might wait until I can compare the PS2 controller to the Nunchuck, with and without wireless). Go!!!

PS2 controller working!

It wasn’t too hard to setup either, I just followed Bill Porter’s guide, as well as this post, which explicitly stated which wires went where.  This seems like it would be a good simple connection to support on a controller, I just need to compare it to the wiimote / nunchuck.  A nunchuck only has 1 joystick and 2 buttons and an accelerometer, whereas this has 2 joysticks and 8 analog buttons with 8 digital (2 in joysticks).  The analog button itself may be a input button, I’m not sure.

My idea with the controller, is since it will be pretty small, I can either clip it to my belt or hang it from my neck, using the controller to control the RC thing, without needing to look at the LCD (I got 5 3.3V 4×20 LCD’s today as well).  With the nunchuck, I could use the accelerometer to adjust trim, whereas I’d use the actual thumbstick for steering.

Yesterday I spent some time to reorganize my desk and now I am much happier with it.  I added a shelf to the side to provide more storage and equipment placement (power supply + oscilloscope ).  I’ll have 1 or 2 laptops there, and a spare monitor to use it if needed.  Synergy will be used so only 1 mouse and keyboard needed for the most part (login seems problematic).  I think it is a good practice to maintain your tools, and a computer desk is a workbench, so if you can improve your work area, it can make you more productive and focused.  At least I think so 😛  Next thing to play with will be the RFM12B modules, or perhaps the 3.3V LCD’s.  Oh and I need to continue working on the VDay card and getting it ready for release 🙂

USBasp… was a Failure!


So I built it, I tested it.  The usb worked fine, but it would never detect the to-be-flashed MCU.  I did a little thinking, and I think I will shelve this idea for now.  I couldn’t get it to work, the circuit is as described, I even tried 2 different circuits.

So I moved on… to upgrading my Bus Pirate with 40x faster firmware.  It makes the ISP much quicker to use.  I will eventually play around with Arduino ISP, but not yet.  Thats all I pretty much accomplished…  Oh I modified the programmers.txt and boards.txt files for arduino to add a 8MHZ board option for my ATMEGA328…

That reminds me, I discovered that I purchased 25 ATMEGA328’s, not ATMEGA328P’s.  It turns out that P means pico power, so my MCU’s will not be as energy efficient as the ATMEGA328P’s.  Be careful when buying components!   The price point makes it worth it to me though, since I’m aiming to make the cheapest diy arduino kits.

 

USBasp debugging

So I’ve been working on getting this USBasp working, and so far it has been pretty good.  I got the firmware flashed to the ATMEGA48p, and when I plug it into the computer, it recognizes it via USB!  But I haven’t been able to get it to flash a MCU yet.

Good news is that when I was first playing with it, I noticed that my mouse and keyboard (connected to the same USB hub) started to act funny.  Eh, I can live with that.  Same thing happened in Windows (I flashed it in Linux).  Eventually, the smell of components heating up struck my nose, and I quickly unplugged it.  It turns out, I connected Pin 7 and 8 of the MCU-to-be-flashed, to power.  So that MCU got really hot.  I was amazed that it still is detected using my Bus Pirate, I was sure that it was toast!

I considered playing with the PS2 controller, but this had my attention, so I kind of had to go with the flow.

I have several ideas why it may not be working:
-the ATMEGA48 that I have is the 10PU version, only rated up to 10MHz.  But since it is detected via USB, I’m not sure this is a problem.
– Perhaps I need to disconnect the to-be-flashed chip when I plug in the USBasp?

I’ll try to update tonight about my progress. 🙂

Progress, and New Project!

While my progress last night might not be steller, something is often better than nothing.  Many time it helps you to have many small projects completed than many projects unfinished.  I think the finished projects, no matter the size, gives you extra motivation to push through tough parts of current projects.

Yesterday I got my USB to RS232 -> FTDI cable working, with auto reset working as well. I had to flash a new ATMEGA328p last night since my last one stopped responding.  Well it responds with 0, but I’m not sure what that means.  It refuses to communicate to AVRDUDE, so I think it somehow got damaged during an upload/download sequence.  As a last test, I’ll try running it with a 16MHz processor in the RBBB, but I’m not sure if that will work.

I should have 25 more ATMEGA328’s showing up in the mail this week, as well as USBasp parts, so I will have lots to do 🙂  Yesterday I also completed 1/2 of the harness for a PS2 controller, all that is left is to crimp the pins so that they can fit nicely in the PS2 connector, and BAM, I should have a working PS2 controller using the PS2X library (bill porters).

I also got the quote back on the RFM12B’s and it is at a similar price point as the nRF24L01+ modules excluding shipping.  I think I will have to do a wireless showdown between XBee, RFM12B, nRF24L01+, and RF-2400P modules.  Maybe even serial bluetooth!  I understand that you can run multiple protocols at the same time, and that is good and all, but if I am going to standardize my projects to a particular protocol, it would be good to understand myself, what are the pros and cons between each module.

Technically, it will be a pro’s/con’s of each library + the module, since if the library is written poorly, it would effect performance.  I’m considering using 2 modules, 1 with an LCD on it.  I test in my home (with wifi, no wifi/bluetooth) and outdoors.  I enter the baud rate into the LCD one and go.  It configures the other module, then itself to the baudrate, it broadcasts 100 messages of varying length with checksum, and counts how many times the remote client asks for a retransmit (could have an LCD on it too).  The remote one could also send the number of retransmits, so we can compare (how many requests for retransmit got lost).

I would do the same test indoors and outdoors, with and without wifi/bluetooth since we are dealing with 2.4GHz modems.  Each test should be fairly quick, so I would just record the data and the module used, then continue.  Sounds like a perfect use for the $1 cases, just sit them on the ground :).  The outdoor place would be in the country, in an area pretty free from wireless interference.

I think that this project should be a pretty high priority, since to determine the best module, a good comparison should be made.  I am interested in picking the module that has the best bang for your buck, but with good performance.  If anyone wants a particular wireless module tested in this test and would be willing to send me 2 of them, feel free!

LScreamer in Windows debugging, USB serial to Arduino Programming cable

I had today off from work, so I spent most of it working on my projects.  I wanted to get LScreamer working in Windows, since I liked being able to wirelessly upload code to it.  I spent a few hours troubleshooting it with a good MAX3232 circuit to convert TTL to RS232, as well as 2 instances of HTerm.  Without XBees, the LScreamer program works as expected (using a serial cable).  With XBee’s packets are lost, and it’s not due to a buffer getting full, since even when I had it pause a second between sending each page, it would still loose things.  I believe it is something to do with the driver for the FTDI FT232RL module, but I’m not sure.  Bottom line is that in windows, wireless firmware transfer is out of the question for now.

But it does raise questions, such as for how many projects recently have I had to use wireless downloads?  None.  But when I start developing the slash again, it will be nice.

Looking around online, you can buy $20 FTDI cables to connect to your RBBB, BBB, or JeeNode.  You can even spend $12 for an adapter.  I’m cheap though, so I wanted to see if I could make something that would work like it.  Enter the USB -> Serial cable + MAX3232.  Using that, I can convert RS232 level signals to TTL levels, but what should we do about automatically resets?  Well I came up with a solution to that, I think.

I observed that when the RTS or DTS line wasn’t asserted, it was -6.5v, and when it was asserted it was 6.5V.  The ATMEGA328 needs 0V on the reset pin to trigger a reset, otherwise it should be up at the supply voltage. Using a 1N4001 diode should let us skip the negative voltage, and a properly configured 2N3904 will handle generating 0V when 6.5V is applied.  I’ll talk more about it soon, if it works, that is.  Progress!

Documentation, and future projects

This is a board that I will be making for my father, it is a 12V lead acid battery checker, where it lights up different LED’s depending on the voltage, using the LM3914N driver.

I’m still documenting the code for the LCD valentine 2012 card, but what I need, is an accessible working system, which is why I’m going to protoboard another one 🙂 That way I can work on new things without the system there, and put them on when I have the Card.

Another project that I’m sizing up is to use this basic 2×16 5V LCD and make a little prototype out of it, using a PS2 controller.  I was looking at this guide and this one so it seems that it is pretty doable, but since it uses the SPI bus, it might cause problems when I integrate the nRF12L01+ wireless module.

I’m also looking at all of the spare processing boards that I have, and thinking of ways I can use them.  Since i have them, I feel obligated to use them since they did cost money.  I’ll keep the blog updated on when I start using other things.

Video for LCD VDay Project Uploaded!

I uploaded it here, and it should be available in about 30 minutes from this post.

Last night, instead of working on a new project, I figured my #1 priority is to document my code for the VDay project.  Currently I know how it works inside and out, but a year from now I won’t.  So I’m trying to document as much as I can, including the hardware, so not only will I be able to add to it later, but when I share the source, everyone else will be able to know how to modify it to achieve their results.   To do this, I have many sections like the following:

Continue reading