# PICAXE Radio Project

#### DRock

Joined May 7, 2011
68
That is the one thing i wasn't sure about, I was trying to program a "virtual" pull-down by sending a low signal constantly but I will add a resistor now and hopefully that works.

EDIT: Still not working correctly, I will try to trace the steps and see what happens. I will report back with the results!

Thanks again.

EDIT2: So I traced the connection and pinC.3 is at a steady 0.33V until I press the button and then it goes down to 0.00V. When the transmitter data pin shows 0.00V the receiver data pin shows 0.33V and when the transmitter data pin shows 4.5V the receiver data pin shows 0.00V. So something a little weird is going on here and I am not quite sure yet.

Last edited:

#### DRock

Joined May 7, 2011
68
Attached are the updated schematics:

#### Attachments

• 13.6 KB Views: 19
• 15.1 KB Views: 20

#### DRock

Joined May 7, 2011
68
Ok so I had what I thought was a great way to test my circuitry to make sure everything is working correctly.

What I did was take out the transmitter and receiver while leaving everything else connected and I used two jumper wires to physically connect the two 08M2's together and then tested the system. So I took pinC.2 on the transmitter and connected it to pinC.3 on the resistor and connected them both with wires. The good news is everything works correctly!

The bad news is I believe the problem lies in the code and I really have no clue how to fix that.

I think it may be time to take this to the picaxe forum.

EDIT: I believe I have to use the SERIN and SEROUT commands instead of just HIGH and LOW like I have it. After I make those changes everything should work!

EDIT2: I have the code written but I can only get the LED to flash once, I am going to bounce over to the picaxe forum to see if they can offer me some help. This is code that ended up working for me:

Transmitter:
Rich (BB code):
main:

if pinC.3 = 1 then alarm

goto main

alarm:

SEROUT 2,N4800,(1)

if pinC.3 = 0 then main

goto alarm
Rich (BB code):
main:
SERIN 3,N4800,b1

if b1 = 1 then flash

goto main

flash:

high C.2

pause 100

low C.2

pause 100

goto main

Last edited:

#### tracecom

Joined Apr 16, 2010
3,944
Ok so I had what I thought was a great way to test my circuitry to make sure everything is working correctly.

What I did was take out the transmitter and receiver while leaving everything else connected and I used two jumper wires to physically connect the two 08M2's together and then tested the system. So I took pinC.2 on the transmitter and connected it to pinC.3 on the resistor and connected them both with wires. The good news is everything works correctly!
OK, I didn't realize you really had the actual transmitter and receiver in the circuit. I thought that what you just described was the way it was connected (hardwired.) That's the logical way to test it; now you know that your PICAXE circuitry is working as your code tells it to on both ends.

The bad news is I believe the problem lies in the code and I really have no clue how to fix that.

I think it may be time to take this to the picaxe forum.
Probably a good idea; I have no experience controlling RF gear with PICAXE's. Good luck to you.

Last edited:

#### DRock

Joined May 7, 2011
68
Update!

I finally have the system working exactly how I want it to and I couldn't be happier. The transmitter was sending the signal too frequently and the receiver wasn't looping quick enough to interpret the signal accurately so I slowed the TX down and sped the RX up and it works flawlessly!

Here is the code that ended up working for me:

Rich (BB code):
' Transmitter code
do
if pinC.3 = 1 then
SEROUT 2,N4800,("UUUUUUUUUUUUUUUUUUUUUUUUU")
pause 50
SEROUT 2,N4800,("ABC", 1)
pause 150
end if
loop

do
SERIN 3,N4800,("ABC"), b1
if b1 = 1 then
high C.2
pause 100
low C.2
end if
loop
I am going to mess around with DipTrace some more to come up with the optimal PCB routing and then I will be sure to post up some pics here at some point tonight.

What DipTrace components should I use if I am going to use a flat cell battery, like a watch battery, to power the transmitter and a 3AA holder with power leads soldered into the PCB?

Thanks!

Last edited:

#### tracecom

Joined Apr 16, 2010
3,944
I am going to mess around with DipTrace some more to come up with the optimal PCB routing and then I will be sure to post up some pics here at some point tonight.

What DipTrace components should I use if I am going to use a flat cell battery, like a watch battery, to power the transmitter and a 3AA holder with power leads soldered into the PCB?

Thanks!
If you are going to mount the PCB holders on the PCB, you will need to select the exact holders you are going to use and either find or build the patterns for those specific components. I expect that you will want the coin cell holder on the board, but I doubt that you will want a 3AA holder mounted to the board. Post a response advising your intentions and I'll try to help you find or design the DipTrace pattern(s).

Congratulations on getting your circuit to work. I followed your thread on the PICAXE forum. BTW, there are some DipTrace users over there as well.

#### DRock

Joined May 7, 2011
68
You are correct to assume that I would like the coin cell holder on the board and the 3AA off the board, in the future if I use plastic injection to make the housing for the TX I may design the holder into the housing but that's getting ahead of myself.

I messed around with patterns and components in DipTrace and I hope I correctly represented the TX and RX that I am using, I am attaching the two PCB diagrams here so you can look at them.

For the coin cell I would like to find the optimum cell of the smallest size. Ideally I would want a single 4.5V cell but I have only been able to find cheap 1.5V cells like those found in hearing aids. I am not even sure if they make a single 4.5V cell...?

I am going to draw up 3D models of all the components on the board because I want an accurate representation of what it is going to look like when done. And then I am going to design a new revision of the TX/RX housing assembly with the circuit board included. I have also attached an 08M2 I just finished modeling, figured I would give you guys a little taste of what I do for a living haha. Took me around 45 min or so and I think it came out pretty good!

Now I just have to figure out how to get the model into DipTrace and position it correctly on the board.

#### Attachments

• 14 KB Views: 18
• 13.3 KB Views: 18
• 63.7 KB Views: 17

#### tracecom

Joined Apr 16, 2010
3,944
I am going to draw up 3D models of all the components on the board because I want an accurate representation of what it is going to look like when done. And then I am going to design a new revision of the TX/RX housing assembly with the circuit board included. I have also attached an 08M2 I just finished modeling, figured I would give you guys a little taste of what I do for a living haha. Took me around 45 min or so and I think it came out pretty good!

Now I just have to figure out how to get the model into DipTrace and position it correctly on the board.
The 08M2 drawing looks great. The new version of DipTrace has 3D capabilities, but I have never used them. Apparently, you take a 2D pattern in the pattern editor, and somehow transform it to 3D. I bet you could figure it out in no time.

With regard to your transmitter battery, both the transmitter and the 08M2 will run on a CR2032 battery (3V). However, I don't know if the reduced transmitter power would be sufficient for your purposes. An additional concern is the life expectancy of the battery. All Electronics has a pretty good holder for 20mm diameter batteries; I use them and have already created a pattern for it. Take a look and if you want, I'll e-mail the pattern to you. http://www.allelectronics.com/make-a-store/item/BH-60/COIN-CELL-BATTERY-HOLDER-20MM-DIA-CELL/1.html

#### DRock

Joined May 7, 2011
68
Yeah you make or find a model such as the one I made for the 08M2 and then you can place it over the pattern and move/rotate it so that it sits where it actually will on the board. After that you click the 3D button and the program figures out the rest, it's pretty neat.

As for the battery holder that looks good, do you know what the rough outside diameter is of the plastic piece? It may be a little bigger than I would like for the final product but it should do just fine for a prototype and would allow me to test the system on 3V.

Thanks.

#### DRock

Joined May 7, 2011
68
I just finished up the RX model as well and decided to throw it into DipTrace. Does anyone know how I can get the 3D to come out colored in DipTrace? It seems to be having an issue importing the colors directly from Solidworks.

#### Attachments

• 42.9 KB Views: 16
• 55.3 KB Views: 15

#### tracecom

Joined Apr 16, 2010
3,944
As for the battery holder that looks good, do you know what the rough outside diameter is of the plastic piece? It may be a little bigger than I would like for the final product but it should do just fine for a prototype and would allow me to test the system on 3V.
I e-mailed you a DipTrace PCB layout that includes the battery holder; you can measure whatever you need. The PCB is my layout of a DS1307 Real Time Clock board; I had the boards made and they work great.

#### DRock

Joined May 7, 2011
68
I got your email, thank you very much. That holder seems small enough, if I can design a housing that looks good i might just keep it for the final revision to keep the complexity of the device and mold down.

I am going to use this switch as my tilt sensor which I just found on Mouser:

http://www.mouser.com/ProductDetail/E-Switch/TM1000/?qs=sGAEpiMZZMtCWdKUURnHj1%2bkvdiUuPvDlfB2tFt2oBI=

I can throw out the idea of using a mercury switch now, which is a good thing.

This is the board I came up with earlier if I was going to design the coin cell holder into the housing but I think it will be too complicated so I will probably end up scrapping it.

#### Attachments

• 27.3 KB Views: 18

#### tracecom

Joined Apr 16, 2010
3,944
In looking back at your PCB layouts, it seems that the tracks are quite narrow. You seem to have plenty of room on the boards; maybe you should widen the tracks some?

#### DRock

Joined May 7, 2011
68
Back to this project!

I have tweaked the code a little bit to make the light flash 20 times every time it gets a signal, instead of flashing once. Now it works fine at 30 yards with line of sight and will flash steadily until I let the button go.

I have a new addition now that I have ironed out the basics. I want to be able to use 6 systems in close proximity without setting each other off. I am going to use physical switches to pull certain pins high on the 08M2 both on the TX and RX side so you can "sync" them to one another.

For example:

Switch 1: Input 1 High
Switch 2: Input 2 High
Switch 3: Input 3 High
Switch 4: Inputs 1,2 High
Switch 5: Inputs 2,3 High
Switch 6: Inputs 1,3 High

That way I can say:

If Input 1 = High then send an "A" to the RX which will flash and it will not interfere with another RX set to receive the "B" if its switch 2 is set to high. So these switches will have to be on both the TX and RX in order to function correctly.

I am not sure what switch I should use for this, maybe a bank of DIP switches or a rotary dial. I tried my luck with hand sketching a schematic today during break and I am looking for some input on whether or not it will work.

Tracecom: I am definitely going to widen the tracks a bit once I get everything laid out correctly on the board, I am not sure what my size constraints are going to be yet.

Thanks for any replies!

#### Attachments

• 58.7 KB Views: 16

#### thatoneguy

Joined Feb 19, 2009
6,359
I am not sure what switch I should use for this, maybe a bank of DIP switches or a rotary dial. I tried my luck with hand sketching a schematic today during break and I am looking for some input on whether or not it will work.
On the schematic, you should only have 4 inputs, 1,2,3,4 then combine them through gates, making a truth table or whatever you need to help you along on that part.

For the bypass capacitor between pins 1 and 8, it needs to be as close to the uC as physically possible, with the leads cut as short as possible, it shouldn't stick up at all from the board as shown in the 3D rendering above.

I'm not quite sure what you are attempting to accomplish, with the 08M, you are limited on inputs and outputs, you may want to use a '595 shift register to read multiple buttons. Here's an example, source code is between the two videos